table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_55070 ( "Rank" real, "Movie" text, "Year" real, "Studio(s)" text, "Lifetime India Distributor share" real )
What is the total number of Lifetime India Distributor share earlier than 2009?
SELECT COUNT("Lifetime India Distributor share") FROM table_55070 WHERE "Year" < '2009'
CREATE TABLE table_10015132_3 ( years_in_toronto VARCHAR, player VARCHAR )
During what period did Dell Curry play for Toronto?
SELECT years_in_toronto FROM table_10015132_3 WHERE player = "Dell Curry"
CREATE TABLE table_name_75 ( band VARCHAR, year INTEGER )
What band has a year above 2011?
SELECT band FROM table_name_75 WHERE year > 2011
CREATE TABLE county ( county_id number, county_name text, population number, zip_code text ) CREATE TABLE election ( election_id number, counties_represented text, district number, delegate text, party number, first_elected number, committee text ) CREATE TABLE party ( ...
On average how large is the population of the counties?
SELECT AVG(population) FROM county
CREATE TABLE table_14637853_3 ( directed_by VARCHAR, original_air_date VARCHAR )
who directed with original air date being november18,1995
SELECT directed_by FROM table_14637853_3 WHERE original_air_date = "November18,1995"
CREATE TABLE table_40289 ( "Week of" text, "Tier" text, "Winner" text, "Runner-up" text, "Semi finalists" text )
What is the Week when the winner was mary joe fern ndez 6 4, 7 5?
SELECT "Week of" FROM table_40289 WHERE "Winner" = 'mary joe fernández 6–4, 7–5'
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
give me the number of patients whose days of hospital stay is greater than 0 and procedure short title is contrast arteriogram-leg?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "0" AND procedures.short_title = "Contrast arteriogram-leg"
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
Anonymous Feedback for a specific question and its answers. Gets: Score, Age, Views, and Anonymous Feedback for a specific post and any answers it may have. (If given an answer-post ID, it just fetches data for that answer.)
SELECT pt.PostId, p.Title, COUNT(*) AS posts, COUNT(CASE WHEN pf.VoteTypeId = 2 THEN 1 ELSE NULL END) AS Anon_up, COUNT(CASE WHEN pf.VoteTypeId = 3 THEN 1 ELSE NULL END) AS Anon_down FROM Tags AS t JOIN PostTags AS pt ON pt.TagId = t.Id JOIN PostFeedback AS pf ON pf.PostId = pt.PostId JOIN Posts AS p ON p.Id = pt.PostI...
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
how many of the male patients were admitted on transfer from hosp/extram?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM"
CREATE TABLE table_3106 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
What is the name of the episode that aired originally on October 18, 1991?
SELECT "Title" FROM table_3106 WHERE "Original air date" = 'October 18, 1991'
CREATE TABLE table_name_30 ( record VARCHAR, game_site VARCHAR )
What was the record at Tiger Stadium?
SELECT record FROM table_name_30 WHERE game_site = "tiger stadium"
CREATE TABLE table_name_26 ( result VARCHAR, date VARCHAR )
Who won that game on 24 July 2010?
SELECT result FROM table_name_26 WHERE date = "24 july 2010"
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, P...
Users that only down-vote questions. A list of users who happily down-vote questions, but don't down-vote answers.
SELECT COUNT(UserId) FROM Votes AS V, Posts AS P WHERE P.PostTypeId = 2 AND P.Id = V.PostId GROUP BY V.UserId
CREATE TABLE table_43823 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Record" text )
What is the score of game 37?
SELECT "Score" FROM table_43823 WHERE "Game" = '37'
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what would be the average daily number of patients diagnosed with cardiac hardware malfunction - pacemaker this year?
SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'cardiac hardware malfunction - pacemaker' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY STRFTIME('%y-%m-%d', diagnosis...
CREATE TABLE table_name_22 ( director VARCHAR, rank VARCHAR )
Which Director has a Rank of 12?
SELECT director FROM table_name_22 WHERE rank = 12
CREATE TABLE table_13981938_1 ( vineyard_surface__2010_ VARCHAR, grand_cru VARCHAR )
what's the vineyard surface (2010) with grand cru being bienvenues-b tard-montrachet
SELECT vineyard_surface__2010_ FROM table_13981938_1 WHERE grand_cru = "Bienvenues-Bâtard-Montrachet"
CREATE TABLE table_19018191_5 ( nat VARCHAR, total_apps VARCHAR )
Name the nat for total apps for 27
SELECT nat FROM table_19018191_5 WHERE total_apps = 27
CREATE TABLE table_78342 ( "Candidate" text, "Money Raised, 2Q" text, "Loans Received, 2Q" text, "Money Spent, 2Q" text, "Total Receipts" text, "Cash On Hand" text )
Name the loans received for 2Q having total receipts of $25,328,694
SELECT "Loans Received, 2Q" FROM table_78342 WHERE "Total Receipts" = '$25,328,694'
CREATE TABLE table_40568 ( "Rank" text, "Route" text, "Avg. Daily Flts" real, "# of Airlines" real, "Distance (km)" real, "Market Share Leader" text )
How many Airlines have a total distance of 705 (km)?
SELECT COUNT("# of Airlines") FROM table_40568 WHERE "Distance (km)" = '705'
CREATE TABLE table_203_98 ( id number, "title" text, "year" number, "director" text, "budget" text, "gross (worldwide)" text, "notes" text )
which morgan creek film grossed the most money prior to 1994 ?
SELECT "title" FROM table_203_98 WHERE "year" < 1994 ORDER BY "gross (worldwide)" DESC LIMIT 1
CREATE TABLE table_35822 ( "Date" text, "City" text, "Opponent" text, "Results\u00b9" text, "Type of game" text )
what city has a game of friendly and an opponent of tunisia?
SELECT "City" FROM table_35822 WHERE "Type of game" = 'friendly' AND "Opponent" = 'tunisia'
CREATE TABLE table_41190 ( "City" text, "Comprehension of Danish" text, "Comprehension of Swedish" text, "Comprehension of Norwegian" text, "Average" real )
Which Comprehension of Danish has an Average smaller than 6.85, and a Comprehension of Norwegian of 4.13?
SELECT "Comprehension of Danish" FROM table_41190 WHERE "Average" < '6.85' AND "Comprehension of Norwegian" = '4.13'
CREATE TABLE table_49620 ( "Region (year)" text, "No. 1" text, "No. 2" text, "No. 3" text, "No. 4" text, "No. 5" text, "No. 6" text, "No. 7" text, "No. 8" text, "No. 9" text, "No. 10" text )
What is the No. 1 of the person with a No. 2 of John?
SELECT "No. 1" FROM table_49620 WHERE "No. 2" = 'john'
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id nu...
when has patient 19175 had a microbiology test for the first time during a month before?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19175) AND DATETIME(microbiologyevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY microbiologyevent...
CREATE TABLE table_10874 ( "Date" text, "Round" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
Who is the opponent of the match with an attendance larger than 59,000?
SELECT "Opponent" FROM table_10874 WHERE "Attendance" > '59,000'
CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday v...
Are Prof. Karie Slavik and Prof. Stephen Rush the only teachers who teach MCDB 310 ?
SELECT COUNT(*) = 0 FROM course, course_offering, instructor, offering_instructor WHERE (NOT instructor.name LIKE '%Karie Slavik%' AND NOT instructor.name LIKE '%Stephen Rush%') AND course.course_id = course_offering.course_id AND course.department = 'MCDB' AND course.number = 310 AND offering_instructor.instructor_id ...
CREATE TABLE table_29652 ( "Week #" text, "Theme" text, "Song Choice" text, "Original Artist" text, "Order #" text, "Result" text )
What was Barreto's song choice when the theme was samba?
SELECT "Song Choice" FROM table_29652 WHERE "Theme" = 'Samba'
CREATE TABLE table_21284653_1 ( municipal_status VARCHAR, population_density VARCHAR )
What is the municipal status where the population density is 895.5?
SELECT municipal_status FROM table_21284653_1 WHERE population_density = "895.5"
CREATE TABLE table_60444 ( "Year" real, "Delegate" text, "Hometown" text, "Placement in Miss Universe" text, "Other awards" text )
Which Placement in Miss Universe has a Delegate of janine mari raymundo tugonon?
SELECT "Placement in Miss Universe" FROM table_60444 WHERE "Delegate" = 'janine mari raymundo tugonon'
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, Par...
How many words did I have to write per upvote?.
SELECT Id AS "post_link", LENGTH(Body) * 1.0 / Score AS "letters_per_upvote" FROM Posts WHERE OwnerUserId = '##user##' AND Score > 0 ORDER BY 2
CREATE TABLE table_204_631 ( id number, "#" number, "title" text, "english translation" text, "original album" text, "length" text )
what is the number of songs that were also on the bintang di surga album ?
SELECT COUNT("title") FROM table_204_631 WHERE "original album" = 'bintang di surga'
CREATE TABLE lessons ( lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number ) CREATE TABLE customers ( customer_id number, customer_address_id number, customer_status_code text, ...
When did Carole Bernhard first become a customer?
SELECT date_became_customer FROM customers WHERE first_name = "Carole" AND last_name = "Bernhard"
CREATE TABLE table_9771 ( "Episode #" text, "Original airdate (UK)" text, "Episode title" text, "Doctor Who episode" text, "Webcast link" text )
Which Original airdate (UK) has a Doctor Who episode of ' the doctor dances '?
SELECT "Original airdate (UK)" FROM table_9771 WHERE "Doctor Who episode" = ' the doctor dances '
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
During next Winter who will be teaching PreMajor classes ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr...
CREATE TABLE table_204_783 ( id number, "position" text, "player" text, "free agency\ntag" text, "date signed" text, "2013 team" text )
how many players play cb or og ?
SELECT COUNT("player") FROM table_204_783 WHERE "position" IN ('cb', 'og')
CREATE TABLE table_14589 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Name the place for south africa and retief goosen
SELECT "Place" FROM table_14589 WHERE "Country" = 'south africa' AND "Player" = 'retief goosen'
CREATE TABLE table_name_6 ( opponents VARCHAR, partner VARCHAR, outcome VARCHAR, surface VARCHAR )
Who were the Opponents in the match on a Hard Surface with Catherine Suire as Partner and Outcome of runner-up?
SELECT opponents FROM table_name_6 WHERE outcome = "runner-up" AND surface = "hard" AND partner = "catherine suire"
CREATE TABLE table_32427 ( "Team" text, "Chassis" text, "Engine" text, "Tires" text, "Drivers" text )
What is the engine for the Machinists Union Racing team?
SELECT "Engine" FROM table_32427 WHERE "Team" = 'machinists union racing'
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
Search comments for given string on others' posts.
SELECT c.Id AS "comment_link", u.DisplayName FROM Comments AS c FULL OUTER JOIN Posts AS p ON c.PostId = p.Id JOIN Users AS u ON u.Id = p.OwnerUserId WHERE u.Id != '##Userid##' AND Text LIKE '##SearchString##'
CREATE TABLE table_name_1 ( genitive VARCHAR, ergative VARCHAR )
What is the genitive for the ergative shen?
SELECT genitive FROM table_name_1 WHERE ergative = "shen"
CREATE TABLE table_22997 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text )
who directed the episode that have 14.59 million viewers
SELECT "Directed by" FROM table_22997 WHERE "U.S. viewers (millions)" = '14.59'
CREATE TABLE table_22032 ( "Home (1st leg)" text, "Home (2nd leg)" text, "1st Leg" text, "2nd leg" text, "Aggregate" text )
If second leg is Newell's Old Boys, what name is first leg?
SELECT "1st Leg" FROM table_22032 WHERE "Home (2nd leg)" = 'Newell''s Old Boys'
CREATE TABLE table_name_68 ( population INTEGER, simplified VARCHAR, area VARCHAR )
What's the sum of the population for the place simplified with an area smaller than 2,879?
SELECT SUM(population) FROM table_name_68 WHERE simplified = "上杭县" AND area < 2 OFFSET 879
CREATE TABLE table_name_47 ( school_club_team VARCHAR, round VARCHAR, player VARCHAR )
Which team has fewer than 4 rounds for Jan Van Breda Kolff?
SELECT school_club_team FROM table_name_47 WHERE round < 4 AND player = "jan van breda kolff"
CREATE TABLE table_40704 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the earliest week with a game attended by 60,233?
SELECT MIN("Week") FROM table_40704 WHERE "Attendance" = '60,233'
CREATE TABLE station ( id number, name text, lat number, long number, dock_count number, city text, installation_date text ) CREATE TABLE trip ( id number, duration number, start_date text, start_station_name text, start_station_id number, end_date text, end_stat...
What are the ids and durations of the trips with the top 3 durations?
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3
CREATE TABLE table_52456 ( "Game" real, "Date" text, "Location" text, "Time" text, "Attendance" real )
How many attended the game at Busch Stadium (ii) when the time was 3:54?
SELECT "Attendance" FROM table_52456 WHERE "Location" = 'busch stadium (ii)' AND "Time" = '3:54'
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( me...
how much does it cost for -bands lab tests?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'lab' AND cost.eventid IN (SELECT lab.labid FROM lab WHERE lab.labname = '-bands')
CREATE TABLE PersonFriend ( name VARCHAR, friend VARCHAR ) CREATE TABLE Person ( name VARCHAR, gender VARCHAR )
Find the names of females who are friends with Zach
SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female'
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
what was the first drug prescribed to patient 006-149686 via the iv push route?
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-149686')) AND medication.routeadmin = 'iv push' ORDER BY medica...
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE labevents ( r...
how much cost is it to perform triiodothyronine (t3) lab tests?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'triiodothyronine (t3)'))
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For each manufacturer, what are the names and prices of their most expensive product?
SELECT T1.Name, MAX(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what is the number of patients whose marital status is single and admission year is less than 2180?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.admityear < "2180"
CREATE TABLE table_11602313_4 ( release_date VARCHAR, sspec_number VARCHAR )
What is the release date for the model with sspec number sla4h(m0)?
SELECT release_date FROM table_11602313_4 WHERE sspec_number = "SLA4H(M0)"
CREATE TABLE table_name_91 ( category VARCHAR, award VARCHAR )
Which category does drama league award belong to?
SELECT category FROM table_name_91 WHERE award = "drama league award"
CREATE TABLE table_463 ( "Name" text, "Pennant" text, "Builder" text, "Laid Down" text, "Launched" text, "Commissioned" text, "Fate" text )
What is the total number of fate for pennant of u33?
SELECT COUNT("Fate") FROM table_463 WHERE "Pennant" = 'U33'
CREATE TABLE table_204_204 ( id number, "rank" number, "heat" number, "country" text, "cyclists" text, "result" number, "notes" text )
what country finished after great britain ?
SELECT "country" FROM table_204_204 WHERE "rank" = (SELECT "rank" FROM table_204_204 WHERE "country" = 'great britain') + 1
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, ...
what was the dose of metronidazole (flagyl) that was prescribed to patient 27703 the last time in 11/this year?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27703) AND prescriptions.drug = 'metronidazole (flagyl)' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year...
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int...
What are the CJS 592 and 281 prerequisites ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE (COURSE_1.number = 592 OR COURSE_1.number = 281) AND COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.depar...
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, t...
Who is the teacher of STATS 401 next semester ?
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester...
CREATE TABLE table_25192 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Name the location attendance for 22-8
SELECT "Location Attendance" FROM table_25192 WHERE "Record" = '22-8'
CREATE TABLE table_72971 ( "Segment description" text, "Date opened" text, "Line(s)" text, "Endpoints" text, "# of new stations" text, "Length (miles)" text )
What is the length (miles) when pico to 7th st/metro center are the endpoints?
SELECT "Length (miles)" FROM table_72971 WHERE "Endpoints" = 'Pico to 7th St/Metro Center'
CREATE TABLE Apartments ( apt_number VARCHAR, room_count VARCHAR )
Return the apartment number and the number of rooms for each apartment.
SELECT apt_number, room_count FROM Apartments
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
what is subject name and language of subject id 2560?
SELECT demographic.name, demographic.language FROM demographic WHERE demographic.subject_id = "2560"
CREATE TABLE table_name_6 ( date VARCHAR, network_brand_name VARCHAR )
What date was Movistar accredited?
SELECT date FROM table_name_6 WHERE network_brand_name = "movistar"
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE microlab ( microl...
what are the newly prescribed drugs of patient 006-76924 today compared to those prescribed yesterday?
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '006-76924') AND DATETIME(medication.drugstarttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT medication.drugname FROM medica...
CREATE TABLE table_name_45 ( laps INTEGER, time VARCHAR, grid VARCHAR )
Tell me the least Laps for grid larger than 2 with 35:26.734
SELECT MIN(laps) FROM table_name_45 WHERE time = "35:26.734" AND grid > 2
CREATE TABLE table_48620 ( "Date" text, "Pos." text, "Player" text, "From club" text, "Transfer fee" text )
What is Pos., when From Club is 'Chelsea', and when Date is '30 July 2008'?
SELECT "Pos." FROM table_48620 WHERE "From club" = 'chelsea' AND "Date" = '30 july 2008'
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_l...
Who was the most recent instructor to teach CEE 651 ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course_offeri...
CREATE TABLE table_1691 ( "Province" text, "Provincial capital" text, "Largest city" text, "Area (km 2 )" real, "Population (2013)" real )
what is the numbe of provincial captial where the population is 1162900?
SELECT COUNT("Provincial capital") FROM table_1691 WHERE "Population (2013)" = '1162900'
CREATE TABLE table_5372 ( "Date" text, "Result" text, "Score" text, "Brazil scorers" text, "Competition" text )
What Brazil scorers have a 2-1 Score?
SELECT "Brazil scorers" FROM table_5372 WHERE "Score" = '2-1'
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
count the number of patients whose admission type is emergency and drug code is d545ns1000
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.formulary_drug_cd = "D545NS1000"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
provide the number of patients whose discharge location is home and days of hospital stay is greater than 13?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.days_stay > "13"
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, ...
Mobile App Trends (# of Questions per Month).
SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ...
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
Of those teaching next Winter , who is teaching Core classes ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr...
CREATE TABLE table_22265716_1 ( director VARCHAR, original_title VARCHAR )
Who directed the film with the original title of ?
SELECT director FROM table_22265716_1 WHERE original_title = "Три летња дана"
CREATE TABLE table_33348 ( "Translator Call Letters" text, "B Mountain Channel" text, "Laurel Mountain Channel" text, "PSIP" text, "Station Call Letters" text, "Network Affiliation ID" text, "Original Channel" text, "Signal Quality" text )
What B Mountain Channel has station call letters of k41go?
SELECT "B Mountain Channel" FROM table_33348 WHERE "Station Call Letters" = 'k41go'
CREATE TABLE table_name_44 ( final VARCHAR, athlete VARCHAR )
What was the final round result of Mohammad Reza Samadi?
SELECT final FROM table_name_44 WHERE athlete = "mohammad reza samadi"
CREATE TABLE table_name_43 ( city VARCHAR, icao VARCHAR )
Where has an ICAO of EPWA?
SELECT city FROM table_name_43 WHERE icao = "epwa"
CREATE TABLE table_name_5 ( team VARCHAR, city VARCHAR )
What team is located in brooklyn?
SELECT team FROM table_name_5 WHERE city = "brooklyn"
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TAB...
During the Spring term are any PreMajor or MDE courses offered ?
SELECT DISTINCT course.department, course.name, course.number, program_course.category FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category IN ('PreMajor', 'MDE') AND program_course.course_id = course.course_id AND semester.semester = 'Spr...
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number...
Top Answerers for a Given Tag in a specific Location. The Stats of a Tag only gives the Top-20 answerers. This query can list more of them and give other info as well.
SELECT Users.Id AS "user_link", MAX(Age) AS Age, MAX(Location) AS Location, MAX(WebsiteUrl) AS Website, MAX(Reputation) AS Rep, COUNT(Answers.Id) AS Answers, SUM(Answers.Score) AS Score, CAST(AVG(CAST(Answers.Score AS FLOAT)) AS FLOAT(6, 1)) AS "avg" FROM Tags JOIN PostTags ON PostTags.TagId = Tags.Id JOIN Posts ON Pos...
CREATE TABLE table_22406 ( "Episode" text, "Garfield Episode 1" text, "U.S. Acres Episode" text, "Garfield Episode 2" text, "Original Airdate" text )
What are the episodes for 'Crime and Nourishment'?
SELECT "Episode" FROM table_22406 WHERE "Garfield Episode 2" = 'Crime and Nourishment'
CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, state varchar(20) ) CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state ...
Visualize a bar chart for what are the names and account balances of customers with the letter 'a' in their names?, rank names from low to high order.
SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' ORDER BY cust_name
CREATE TABLE table_994 ( "Variant id" text, "5\u2019UTR splice" text, "Coding" text, "3\u2019UTR sequence" text, "GenBank id" text )
What is the 3utr sequence when the genbank id is hq021437?
SELECT "3\u2019UTR sequence" FROM table_994 WHERE "GenBank id" = 'HQ021437'
CREATE TABLE table_name_1 ( host_team VARCHAR, stadium VARCHAR )
What was the name of the host team at Texas stadium?
SELECT host_team FROM table_name_1 WHERE stadium = "texas stadium"
CREATE TABLE table_28196105_1 ( written_by VARCHAR, _number VARCHAR )
Who wrote episode number 18?
SELECT written_by FROM table_28196105_1 WHERE _number = 18
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE time_int...
what are the flights between PITTSBURGH and BALTIMORE on 8 10
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND date_day.day_number = 10 AND date_day.month_number = 8 AND...
CREATE TABLE table_name_29 ( total_points INTEGER, bonus_pts VARCHAR, matches VARCHAR, rides VARCHAR )
What is the total for 34 matches with 111 rides, but no more than 15 bonus points?
SELECT AVG(total_points) FROM table_name_29 WHERE matches = 34 AND rides = 111 AND bonus_pts > 15
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code...
when was the first time patient 31854 since 06/15/2104 had promote w/fiber intake?
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31854)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label...
CREATE TABLE table_25256368_1 ( february_2010 VARCHAR, june_2010 VARCHAR )
Name the bed 2010 for 6.5%
SELECT february_2010 FROM table_25256368_1 WHERE june_2010 = "6.5%"
CREATE TABLE table_3736 ( "Club" text, "Played" text, "Won" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Bonus points" text, "Points" text )
Which club had 5 bonus points?
SELECT "Club" FROM table_3736 WHERE "Bonus points" = '5'
CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIG...
Find the relationship between minimum and maximum gpa of all students in each department with a scatter chart grouping by department code.
SELECT MAX(STU_GPA), MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is discharge time and procedure short title of subject id 21796?
SELECT demographic.dischtime, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "21796"
CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE department ( dept_name varchar(20), building varchar(15), budget n...
Bar chart of mean salary from each dept name, list in ascending by the y axis.
SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name ORDER BY AVG(salary)
CREATE TABLE table_28200 ( "Date" text, "Tournament" text, "Location" text, "Purse ( $ )" real, "Winner" text, "Score" text, "1st Prize ( $ )" text )
Name the winner for jan 24
SELECT "Winner" FROM table_28200 WHERE "Date" = 'Jan 24'
CREATE TABLE table_47489 ( "Game" real, "November" real, "Opponent" text, "Score" text, "Decision" text, "Record" text )
What is the Record for a game smaller than 24, Lundqvist was the decision, November less than 8, and opponent Was New York Islanders?
SELECT "Record" FROM table_47489 WHERE "Game" < '24' AND "Decision" = 'lundqvist' AND "November" < '8' AND "Opponent" = 'new york islanders'
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Average Comment Score by Hour. Find out if time of day when you make a comment may affect the number of votes you receive. Results are skewed by different parts of the world being awake at different times, with each region possibly posting comments of different perceived quality.
SELECT TIME_TO_STR(CreationDate, '%h') AS hour, COUNT(*) AS comments, AVG(CAST(Score AS FLOAT)) AS "average comment score" FROM Comments GROUP BY TIME_TO_STR(CreationDate, '%h') ORDER BY hour
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE...
Create a bar chart showing the number of meter 200 across meter 200, and I want to show Y-axis in descending order.
SELECT meter_200, COUNT(meter_200) FROM swimmer GROUP BY meter_200 ORDER BY COUNT(meter_200) DESC