table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE table_name_95 (
position VARCHAR,
round VARCHAR,
college VARCHAR
) | What position does the player from Oklahoma who was drafted in round 7 play? | SELECT position FROM table_name_95 WHERE round = 7 AND college = "oklahoma" |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | provide the number of patients whose admission year is less than 2155 and diagnoses long title is sinoatrial node dysfunction? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2155" AND diagnoses.long_title = "Sinoatrial node dysfunction" |
CREATE TABLE table_name_78 (
date VARCHAR,
venue VARCHAR
) | When was there a game at Kardinia Park? | SELECT date FROM table_name_78 WHERE venue = "kardinia park" |
CREATE TABLE table_203_377 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | how long is the list of countries that won any medals ? | SELECT COUNT("nation") FROM table_203_377 WHERE "total" > 0 |
CREATE TABLE table_49710 (
"Position" real,
"Name" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Points" real
) | What was the average points for someone who has played more than 10? | SELECT AVG("Points") FROM table_49710 WHERE "Played" > '10' |
CREATE TABLE sportsinfo (
stuid number,
sportname text,
hoursperweek number,
gamesplayed number,
onscholarship text
)
CREATE TABLE video_games (
gameid number,
gname text,
gtype text
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text... | What is the count of different game types? | SELECT COUNT(DISTINCT gtype) FROM video_games |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE a... | what was the organism detected during the first urine, catheter specimen microbiology test of patient 031-1337 on the first hospital encounter? | SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-1337' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.... |
CREATE TABLE table_63698 (
"Draw" real,
"Language" text,
"Artist" text,
"Song" text,
"English translation" text,
"Place" real,
"Points" real
) | What is the place when less than 1 point is scored? | SELECT AVG("Place") FROM table_63698 WHERE "Points" < '1' |
CREATE TABLE table_17913 (
"Team" text,
"Location" text,
"Stadium" text,
"Founded" real,
"Joined" real,
"Head Coach" text,
"Captain" text
) | Where is Bluetongue Stadium located? | SELECT "Location" FROM table_17913 WHERE "Stadium" = 'Bluetongue Stadium' |
CREATE TABLE table_35945 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Location" text,
"Record" text
) | Which Date has a Score of 106 112? | SELECT "Date" FROM table_35945 WHERE "Score" = '106–112' |
CREATE TABLE table_15158 (
"Game" real,
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Series" text
) | Who has a Home of detroit on april 22? | SELECT "Visitor" FROM table_15158 WHERE "Home" = 'detroit' AND "Date" = 'april 22' |
CREATE TABLE table_39595 (
"Name" text,
"Dist. from Origin" text,
"Dist. from Terminus" text,
"Speed Limit" text,
"Location (all in Nagano )" text
) | What location has the name of Sakakita BS? | SELECT "Location (all in Nagano )" FROM table_39595 WHERE "Name" = 'sakakita bs' |
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time... | How many 'bad' questions have >10k rep users asked?. | SELECT Id, DisplayName, Reputation, (SELECT COUNT(*) FROM Posts WHERE Posts.OwnerUserId = Users.Id AND Posts.PostTypeId = 1) AS num_questions, (SELECT COUNT(*) FROM Posts WHERE Posts.OwnerUserId = Users.Id AND Posts.PostTypeId = 2) AS num_answers, (SELECT COUNT(*) FROM Posts WHERE Posts.OwnerUserId = Users.Id AND Posts... |
CREATE TABLE table_2668374_18 (
party VARCHAR,
first_elected VARCHAR
) | How many parties were first elected in 1805? | SELECT COUNT(party) FROM table_2668374_18 WHERE first_elected = "1805" |
CREATE TABLE table_204_291 (
id number,
"rank" number,
"name" text,
"nation" text,
"cp" number,
"fp" number,
"points" number,
"placings" number
) | how many women from the united states competed in the 1971 world figure skating championships ? | SELECT COUNT("name") FROM table_204_291 WHERE "nation" = 'united states' |
CREATE TABLE table_14102 (
"Pick" real,
"Player" text,
"Team" text,
"Position" text,
"Hometown/School" text
) | What is the hometown of Mike White? | SELECT "Hometown/School" FROM table_14102 WHERE "Position" = 'of' AND "Player" = 'mike white' |
CREATE TABLE table_15511178_3 (
winning_driver VARCHAR,
rd VARCHAR
) | how many winners were in round 8 | SELECT COUNT(winning_driver) FROM table_15511178_3 WHERE rd = 8 |
CREATE TABLE table_69555 (
"Name" text,
"Years" text,
"Area" text,
"Authority" text,
"Decile" real,
"Roll" real
) | What is the decile sum with a roll smaller than 25, and franz josef area? | SELECT SUM("Decile") FROM table_69555 WHERE "Roll" < '25' AND "Area" = 'franz josef' |
CREATE TABLE table_72668 (
"#" real,
"Minnesota River Conference" text,
"Records" text,
"Pct." text,
"MRC Championships" real,
"Solo" real,
"Co-Champions" real,
"State Champions" real
) | What are the record(s) for the team with a winning percentage of .464? | SELECT "Records" FROM table_72668 WHERE "Pct." = '.464' |
CREATE TABLE table_name_16 (
week_2 VARCHAR,
week_3 VARCHAR
) | What Week 2 has a Week 3 of casey mae? | SELECT week_2 FROM table_name_16 WHERE week_3 = "casey mae" |
CREATE TABLE table_18489 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | In what district was incumbent first elected in 1938? | SELECT "District" FROM table_18489 WHERE "First elected" = '1938' |
CREATE TABLE wine (
No INTEGER,
Grape TEXT,
Winery TEXT,
Appelation TEXT,
State TEXT,
Name TEXT,
Year INTEGER,
Price INTEGER,
Score INTEGER,
Cases INTEGER,
Drink TEXT
)
CREATE TABLE appellations (
No INTEGER,
Appelation TEXT,
County TEXT,
State TEXT,
Area... | For those wines with a price is bigger than 100, count then and group by year, order by year. Visualize the result with a bar chart. | SELECT Year, COUNT(Year) FROM wine WHERE Price > 100 GROUP BY Year ORDER BY Year |
CREATE TABLE list (
firstname VARCHAR,
lastname VARCHAR,
classroom VARCHAR
)
CREATE TABLE teachers (
classroom VARCHAR,
firstname VARCHAR,
lastname VARCHAR
) | Find all students taught by MARROTTE KIRK. Output first and last names of students. | SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK" |
CREATE TABLE table_name_98 (
result VARCHAR,
competition VARCHAR,
goal VARCHAR
) | What was the final score in a 2002 fifa world cup qualification that was less than 10? | SELECT result FROM table_name_98 WHERE competition = "2002 fifa world cup qualification" AND goal < 10 |
CREATE TABLE table_15921 (
"Country ( exonym )" text,
"Capital ( exonym )" text,
"Country ( endonym )" text,
"Capital ( endonym )" text,
"Official or native language(s) (alphabet/script)" text
) | In which country (endonym) is Irish English the official or native language(s) (alphabet/script)? | SELECT "Country ( endonym )" FROM table_15921 WHERE "Official or native language(s) (alphabet/script)" = 'Irish English' |
CREATE TABLE table_79331 (
"Rank" real,
"Rowers" text,
"Country" text,
"Time" text,
"Notes" text
) | What country is ranked #2? | SELECT "Country" FROM table_79331 WHERE "Rank" = '2' |
CREATE TABLE table_name_67 (
year VARCHAR,
score VARCHAR
) | What year had a score of 0.586? | SELECT COUNT(year) FROM table_name_67 WHERE score = "0.586" |
CREATE TABLE Accounts (
Account_ID INTEGER,
Statement_ID INTEGER,
Account_Details VARCHAR(255)
)
CREATE TABLE Statements (
Statement_ID INTEGER,
Statement_Details VARCHAR(255)
)
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER,
Budget_Type_Code CHAR(15),
Document_Details VARC... | What is the project id and detail for the project with at least two documents. Show a pie chart. | SELECT T1.Project_Details, T1.Project_ID FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID |
CREATE TABLE table_64452 (
"Actor" text,
"Character" text,
"Soap Opera" text,
"Years" text,
"Duration" text
) | How long did Witold Latoszek character lasted? | SELECT "Duration" FROM table_64452 WHERE "Character" = 'witold latoszek' |
CREATE TABLE table_27450976_1 (
written_by VARCHAR,
production_code VARCHAR
) | How many people wrote the episode with a production code of 2j5507? | SELECT COUNT(written_by) FROM table_27450976_1 WHERE production_code = "2J5507" |
CREATE TABLE table_name_48 (
opponent_in_the_final VARCHAR,
outcome VARCHAR,
date VARCHAR
) | Who is the Opponent in the final after 1983 with an Outcome of runner-up? | SELECT opponent_in_the_final FROM table_name_48 WHERE outcome = "runner-up" AND date > 1983 |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | how many office admitted patients have aortic valve insufficiency/aortic valve replacement/sda primary disease? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" |
CREATE TABLE table_1036 (
"Player" text,
"Position" text,
"Starter" text,
"Touchdowns" real,
"Extra points" real,
"Field goals" real,
"Points" real
) | Which players have made a total of 12 extra points? | SELECT "Player" FROM table_1036 WHERE "Extra points" = '12' |
CREATE TABLE Employees (
Employee_ID INTEGER,
Role_Code CHAR(15),
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1),
Date_of_Birth DATETIME,
Other_Details VARCHAR(255)
)
CREATE TABLE Document_Locations (
Document_ID INTEGER,
Location_Code CHAR(15),
Date_in_Location_From DATETIME,
D... | Show the number of documents in different starting date Bin starting date by weekday and group by location code with a stacked bar chart, show by the y-axis in desc. | SELECT Date_in_Location_From, COUNT(Date_in_Location_From) FROM Document_Locations GROUP BY Location_Code ORDER BY COUNT(Date_in_Location_From) DESC |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
countr... | For Core , can you take DESCI 995 ? | SELECT COUNT(*) > 0 FROM course, program, program_course WHERE course.department = 'DESCI' AND course.number = 995 AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id |
CREATE TABLE table_1434788_5 (
incumbent VARCHAR,
district VARCHAR
) | Who was the incumbent in the Ohio 16 district? | SELECT incumbent FROM table_1434788_5 WHERE district = "Ohio 16" |
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
) | Draw a bar chart of founder versus sum revenue, sort from low to high by the Y. | SELECT Founder, SUM(Revenue) FROM Manufacturers GROUP BY Founder ORDER BY SUM(Revenue) |
CREATE TABLE table_18143210_2 (
number_of_seasons_in_top_division INTEGER,
first_season_in_top_division VARCHAR
) | How many 'number of seasons in top division' were played if the 'first season in top division' games is in 1990-91? | SELECT MAX(number_of_seasons_in_top_division) FROM table_18143210_2 WHERE first_season_in_top_division = "1990-91" |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is the number of female patients who have procedure icd9 code 3799? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.icd9_code = "3799" |
CREATE TABLE table_40244 (
"Call sign" text,
"Frequency MHz" text,
"City of license" text,
"ERP W" real,
"FCC info" text
) | What call sign has ERP W greater than 197? | SELECT "Call sign" FROM table_40244 WHERE "ERP W" > '197' |
CREATE TABLE table_77694 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What did the away team score when playing Footscray? | SELECT "Away team score" FROM table_77694 WHERE "Home team" = 'footscray' |
CREATE TABLE table_name_70 (
result VARCHAR,
opponent VARCHAR
) | What is the Result of the game against the Indianapolis Colts? | SELECT result FROM table_name_70 WHERE opponent = "indianapolis colts" |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskResults (
Id number,
... | Comments on my answers with fixed score. How many comments do I have for each score. | SELECT p.Id AS "post_link", c.Text FROM Posts AS p JOIN Comments AS c ON c.PostId = p.Id WHERE p.OwnerUserId = @UserId AND NOT c.UserId = @UserId |
CREATE TABLE table_19118 (
"#" real,
"Sanskrit \u0938\u0902\u0938\u094d\u0915\u0943\u0924\u092e\u094d" text,
"Tamil \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" text,
"Telugu \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" text,
"Kannada \u0c95\u0ca8\u0ccd\u0ca8\u0ca1" text,
"Malayalam \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u... | What is the Telugu word for in Mongolian? | SELECT "Telugu \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" FROM table_19118 WHERE "Mongolian" = 'Хонгорцог' |
CREATE TABLE player (
School_ID VARCHAR
)
CREATE TABLE school (
Location VARCHAR,
School_ID VARCHAR
) | Show the locations of schools that have more than 1 player. | SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1 |
CREATE TABLE table_61893 (
"Week 1" text,
"Week 2" text,
"Week 3" text,
"Week 4" text,
"Week 5" text
) | When Alinna D Penta was the cyber girl in week 3, who was the cyber girl in week 1? | SELECT "Week 1" FROM table_61893 WHERE "Week 3" = 'alinna d penta' |
CREATE TABLE table_203_404 (
id number,
"pennant\nnumber" text,
"name" text,
"builder" text,
"laid down" text,
"launched" text,
"completed" text,
"fate" text
) | total number of j class ships completed . | SELECT COUNT(*) FROM table_203_404 WHERE NOT "completed" IS NULL |
CREATE TABLE table_name_48 (
total_votes INTEGER,
_percentage_of_popular_vote VARCHAR,
_number_of_seats_won VARCHAR
) | Can you tell me the highest Total votes that has the % of popular vote of 0.86%, and the # of seats won larger than 0? | SELECT MAX(total_votes) FROM table_name_48 WHERE _percentage_of_popular_vote = "0.86%" AND _number_of_seats_won > 0 |
CREATE TABLE Ref_Transaction_Types (
transaction_type_description VARCHAR,
transaction_type_code VARCHAR
)
CREATE TABLE TRANSACTIONS (
transaction_type_code VARCHAR
) | Show the description of the transaction type that occurs most frequently. | SELECT T1.transaction_type_description FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code GROUP BY T1.transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE table_name_9 (
set_3 VARCHAR,
set_1 VARCHAR
) | Which Set 3 has a Set 1 of 25 20? | SELECT set_3 FROM table_name_9 WHERE set_1 = "25–20" |
CREATE TABLE time_slot (
time_slot_id text,
day text,
start_hr number,
start_min number,
end_hr number,
end_min number
)
CREATE TABLE takes (
id text,
course_id text,
sec_id text,
semester text,
year number,
grade text
)
CREATE TABLE advisor (
s_id text,
i_id te... | Find courses that ran in Fall 2009 but not in Spring 2010. | SELECT course_id FROM section WHERE semester = 'Fall' AND year = 2009 EXCEPT SELECT course_id FROM section WHERE semester = 'Spring' AND year = 2010 |
CREATE TABLE table_28565 (
"Finished" text,
"Performance Order" real,
"Percentage of votes" text,
"Artist" text,
"Act" text,
"Semi Finals Result" text
) | Name the performance order for 2.15% | SELECT "Performance Order" FROM table_28565 WHERE "Percentage of votes" = '2.15%' |
CREATE TABLE table_35884 (
"Year" real,
"Chassis" text,
"Engine" text,
"Start" real,
"Finish" real,
"Team" text
) | How many starts have a year prior to 2012, and team penske as the team, with a finish greater than 27? | SELECT SUM("Start") FROM table_35884 WHERE "Year" < '2012' AND "Team" = 'team penske' AND "Finish" > '27' |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_typ... | on this hospital encounter what is the first careunit of patient 20898? | SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20898 AND admissions.dischtime IS NULL) AND NOT transfers.careunit IS NULL ORDER BY transfers.intime LIMIT 1 |
CREATE TABLE table_30060356_3 (
gt4_cup_winner VARCHAR,
circuit VARCHAR
) | List all GT4 Cup winners played on the Spa-Francorchamps Report. | SELECT gt4_cup_winner FROM table_30060356_3 WHERE circuit = "Spa-Francorchamps Report" |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is the number of patients whose admission year is less than 2180 and procedure icd9 code is 4513? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2180" AND procedures.icd9_code = "4513" |
CREATE TABLE table_name_12 (
big__ INTEGER,
total VARCHAR,
micro__10ha_ VARCHAR,
department VARCHAR
) | Which Big (>500ha) has a Micro (10ha) larger than 940, and a Department of potos , and a Total smaller than 16,240? | SELECT MAX(big__) > 500 AS ha_ FROM table_name_12 WHERE micro__10ha_ > 940 AND department = "potosí" AND total < 16 OFFSET 240 |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is drug code and drug route of drug name mult? | SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Mult" |
CREATE TABLE table_name_6 (
venue VARCHAR,
competition VARCHAR,
result VARCHAR
) | What is the location of the game that was friendly and resulted in 2-3? | SELECT venue FROM table_name_6 WHERE competition = "friendly" AND result = "2-3" |
CREATE TABLE table_name_25 (
evening_gown INTEGER,
swimsuit VARCHAR,
interview VARCHAR
) | Name the least evening gown for interview more than 7.97 and swimsui of 7.24 | SELECT MIN(evening_gown) FROM table_name_25 WHERE swimsuit = 7.24 AND interview > 7.97 |
CREATE TABLE table_name_22 (
home_team VARCHAR
) | What is the home team score for Footscray? | SELECT home_team AS score FROM table_name_22 WHERE home_team = "footscray" |
CREATE TABLE table_35268 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents in the final" text,
"Score" text
) | What date shows the Outcome of winner against nikola fra kov carmen klaschka? | SELECT "Date" FROM table_35268 WHERE "Outcome" = 'winner' AND "Opponents in the final" = 'nikola fraňková carmen klaschka' |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE labevents (
row_id number,
subject_id ... | what is the average yearly number of people diagnosed with dental caries nec until 1 year ago? | SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'dental caries nec') AND DATETIME(diagnoses_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP... |
CREATE TABLE Lives_in (
stuid INTEGER,
dormid INTEGER,
room_number INTEGER
)
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Dorm_amenity (
amenid INTEGER,
amenity_name VARCHAR(25)
)
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_ca... | A pie chart for what are the number of the first names of all students in Smith Hall? | SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname |
CREATE TABLE table_48517 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | What was the location attendance on January 19? | SELECT "Location Attendance" FROM table_48517 WHERE "Date" = 'january 19' |
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,
... | how many patients whose admission year is less than 2200 and procedure long title is angiocardiography of right heart structures? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2200" AND procedures.long_title = "Angiocardiography of right heart structures" |
CREATE TABLE table_16388047_1 (
time VARCHAR,
date VARCHAR
) | Name the time for saturday 4 march 1995 | SELECT time FROM table_16388047_1 WHERE date = "Saturday 4 March 1995" |
CREATE TABLE table_name_3 (
opened INTEGER,
category VARCHAR
) | Which Opened has a Category of diesel light rail? | SELECT MAX(opened) FROM table_name_3 WHERE category = "diesel light rail" |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
lan... | how many times levetiracetam has been prescribed to patient 90663 in this hospital visit? | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90663 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'levetiracetam' |
CREATE TABLE table_name_90 (
code_name VARCHAR,
distribution VARCHAR
) | with distribution of 20.6% what is the code name? | SELECT code_name FROM table_name_90 WHERE distribution = "20.6%" |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE diagnosis (
diagnosisid number... | what is the ingesting method of 0.9%nacl 1,000 ml? | SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = '0.9%nacl 1,000 ml' |
CREATE TABLE table_28822 (
"Category" text,
"Player" text,
"Games played" real,
"Totals" text,
"Average" text
) | Name the average for 23 games played | SELECT "Average" FROM table_28822 WHERE "Games played" = '23' |
CREATE TABLE table_22839669_1 (
championship VARCHAR,
score_in_the_final VARCHAR
) | What championship had a final score of 6 4, 6 2, 6 2? | SELECT championship FROM table_22839669_1 WHERE score_in_the_final = "6–4, 6–2, 6–2" |
CREATE TABLE table_39862 (
"SEASON" text,
"FIRST" text,
"SECOND" text,
"THIRD" text,
"FOURTH" text,
"FIFTH" text,
"SIXTH" text
) | What team placed second during the season where Western Australia placed fifth, South Australia placed sixth, and Tasmania placed fourth? | SELECT "SECOND" FROM table_39862 WHERE "FIFTH" = 'western australia' AND "SIXTH" = 'south australia' AND "FOURTH" = 'tasmania' |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
... | count the number of patients whose admission type is elective and primary disease is morbid obesity/sda? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.diagnosis = "MORBID OBESITY/SDA" |
CREATE TABLE club (
Club_ID int,
name text,
Region text,
Start_year text
)
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
CREATE TABLE player (
Player_ID int,
name text,
Position text,
Club_ID int,
Apps real,
Trie... | A bar chart showing the number of different competition types. | SELECT Competition_type, COUNT(Competition_type) FROM competition GROUP BY Competition_type |
CREATE TABLE table_name_43 (
number_s_ VARCHAR,
quantity VARCHAR,
year_s__of_manufacture VARCHAR
) | What number was manufactured 1 in 1841? | SELECT number_s_ FROM table_name_43 WHERE quantity = "1" AND year_s__of_manufacture = "1841" |
CREATE TABLE table_67526 (
"Name" text,
"Street address" text,
"Years as tallest" text,
"Height feet / m" text,
"Floors" real
) | What is listsed as the Height feet/m and has a Street address of 2345 Grand Avenue? | SELECT "Height feet / m" FROM table_67526 WHERE "Street address" = '2345 grand avenue' |
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varc... | For CS majors what BUDDHST prerequistes needed ? | SELECT DISTINCT course.department, course.name, course.number FROM program_course INNER JOIN course ON program_course.course_id = course.course_id WHERE course.department = 'BUDDHST' |
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE member_of_club (
stuid number,
clubid number,
position text
)
CREATE TABLE club (
clubid number,
clubname text,
clubdes... | Who is the president of the club 'Bootup Baltimore'? Give me the first and last name. | SELECT t3.fname, t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t2.position = "President" |
CREATE TABLE table_name_93 (
opponent_in_the_final VARCHAR,
tournament VARCHAR,
date VARCHAR
) | Who was the final opponent in the tournament in Taipei, Taiwan on November 14, 1994? | SELECT opponent_in_the_final FROM table_name_93 WHERE tournament = "taipei, taiwan" AND date = "november 14, 1994" |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE diagnoses_icd (
... | calculate the difference between the total input and the output of patient 16088 on the last icu visit. | SELECT (SELECT SUM(inputevents_cv.amount) 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 = 16088) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1)) - ... |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsysto... | how did patient 027-107035 last come into the hospital since 2105? | SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '027-107035' AND STRFTIME('%y', patient.hospitaladmittime) >= '2105' ORDER BY patient.hospitaladmittime DESC LIMIT 1 |
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TAB... | what LIMOUSINE service is in BOSTON | SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'BOSTON' AND ground_service.city_code = city.city_code AND ground_service.transport_type = 'LIMOUSINE' |
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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | provide the number of patients with bradycardia primary disease who were born before 2121. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BRADYCARDIA" AND demographic.dob_year < "2121" |
CREATE TABLE artist (
artist_name varchar2(50),
country varchar2(20),
gender varchar2(20),
preferred_genre varchar2(50)
)
CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE song (
song_name varchar2(50),
artist_name varchar2(5... | How many songs were released for each format. Show bar chart. | SELECT formats, COUNT(*) FROM files GROUP BY formats |
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
)
... | what is maximum age of patients whose gender is m and days of hospital stay is 26? | SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.days_stay = "26" |
CREATE TABLE documents (
document_name VARCHAR,
document_code VARCHAR
)
CREATE TABLE document_sections (
document_code VARCHAR
) | What is the name of the document with the most number of sections? | SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE shops (
shop_id number,
shop_details text
)
CREATE TABLE ref_attraction_types (
attraction_type_code text,
attraction_type_description text
)
CREATE TABLE features (
feature_id number,
feature_details text
)
CREATE TABLE staff (
staff_id number,
tourist_attraction_id numb... | Give me the star rating descriptions of the hotels that cost more than 10000. | SELECT T2.star_rating_description FROM hotels AS T1 JOIN ref_hotel_star_ratings AS T2 ON T1.star_rating_code = T2.star_rating_code WHERE T1.price_range > 10000 |
CREATE TABLE table_24099628_1 (
brand_name VARCHAR,
model__list_ VARCHAR
) | What is the brand name associated with a model name e4xxx? | SELECT brand_name FROM table_24099628_1 WHERE model__list_ = "E4xxx" |
CREATE TABLE table_28298471_14 (
stage INTEGER,
winner VARCHAR
) | When svein tuft is the winner what is the highest stage? | SELECT MAX(stage) FROM table_28298471_14 WHERE winner = "Svein Tuft" |
CREATE TABLE transactions_lots (
transaction_id number,
lot_id number
)
CREATE TABLE investors (
investor_id number,
investor_details text
)
CREATE TABLE lots (
lot_id number,
investor_id number,
lot_details text
)
CREATE TABLE purchases (
purchase_transaction_id number,
purchase_... | Show the minimum amount of transactions whose type code is 'PUR' and whose share count is bigger than 50. | SELECT MIN(amount_of_transaction) FROM transactions WHERE transaction_type_code = "PUR" AND share_count > 50 |
CREATE TABLE table_5548 (
"Rider" text,
"Manufacturer" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What is the lowest grid number that had a rider with KTM as the manufacturer who did more than 20 laps? | SELECT MIN("Grid") FROM table_5548 WHERE "Manufacturer" = 'ktm' AND "Laps" > '20' |
CREATE TABLE table_51061 (
"Model number" text,
"sSpec number" text,
"Frequency" text,
"GPU frequency" text,
"L2 cache" text,
"I/O bus" text,
"Memory" text,
"Socket" text,
"Release date" text,
"Part number(s)" text
) | What is Model Number, when Part Number(s) is AY80609003987AB? | SELECT "Model number" FROM table_51061 WHERE "Part number(s)" = 'ay80609003987ab' |
CREATE TABLE table_30788 (
"Player" text,
"Matches" real,
"Innings" real,
"Runs" real,
"Average" text,
"Highest Score" text,
"100s" real,
"50s" real
) | How many entries is under 50s column when the average is 39.60? | SELECT "50s" FROM table_30788 WHERE "Average" = '39.60' |
CREATE TABLE products (
code number,
name text,
price number,
manufacturer number
)
CREATE TABLE manufacturers (
code number,
name text,
headquarter text,
founder text,
revenue number
) | Find the name, headquarter and founder of the manufacturer that has the highest revenue. | SELECT name, headquarter, founder FROM manufacturers ORDER BY revenue DESC LIMIT 1 |
CREATE TABLE table_986 (
"Name Of Place" text,
"Height from Sea Level In Meters" text,
"Nearby Town" text,
"Trekking Route" text,
"Category" text
) | picturesque and trekking route is the category what is the height from sea level in meters? | SELECT "Height from Sea Level In Meters" FROM table_986 WHERE "Category" = 'Picturesque and Trekking Route' |
CREATE TABLE table_66863 (
"Player" text,
"Years" text,
"Goals" real,
"Assists" real,
"Points" real
) | How many assists does David Tomlinson have? | SELECT SUM("Assists") FROM table_66863 WHERE "Player" = 'david tomlinson' |
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fa... | how many fares are there one way from TACOMA to MONTREAL | SELECT COUNT(DISTINCT fare.fare_id) FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TACOMA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_... |
CREATE TABLE table_25455 (
"Date" text,
"Location" text,
"Opponent" text,
"Terps Points" real,
"Opp. Points" real,
"Record" text
) | Where was the game on jan. 16/06 played? | SELECT "Location" FROM table_25455 WHERE "Date" = 'Jan. 16/06' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.