instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Code
nvbench
CREATE TABLE table_10121127_1 ( number_of_australians_involved VARCHAR, un_operation_title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Australians were in the UN commission on Korea?
SELECT COUNT(number_of_australians_involved) FROM table_10121127_1 WHERE un_operation_title = "UN Commission on Korea"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtim...
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'bone fracture(s) - left lower extremity' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-1 year'))
eicu
CREATE TABLE volume ( volume_id number, volume_issue text, issue_date text, weeks_on_top number, song text, artist_id number ) CREATE TABLE music_festival ( id number, music_festival text, date_of_ceremony text, category text, volume number, result text ) CREATE TABLE a...
SELECT T2.issue_date FROM artist AS T1 JOIN volume AS T2 ON T1.artist_id = T2.artist_id WHERE T1.artist = "Gorgoroth"
spider
CREATE TABLE table_name_26 ( instant_messaging VARCHAR, telephony VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Instant Messaging, when Telephony is 'Yes with integrated Sametime'?
SELECT instant_messaging FROM table_name_26 WHERE telephony = "yes with integrated sametime"
sql_create_context
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, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "SINGLE" AND procedures.icd9_code = "4610"
mimicsql_data
CREATE TABLE table_name_89 ( win_percentage VARCHAR, postseason VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What number of win% has a postseason of did not qualify and rank larger than 8?
SELECT COUNT(win_percentage) FROM table_name_89 WHERE postseason = "did not qualify" AND rank > 8
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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 (...
SELECT demographic.religion, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "15898"
mimicsql_data
CREATE TABLE table_name_48 ( score VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score on April 12?
SELECT score FROM table_name_48 WHERE date = "april 12"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeo...
SELECT AVG(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-111412') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) >= '2104' GROUP BY STRFTIME('%y-%m', patient.unitad...
eicu
CREATE TABLE table_32982 ( "Chapter" text, "Colonized" text, "Chartered" text, "School" text, "State" text, "Status" text, "Charter Range" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the colonized year for the chartered year 1958?...
SELECT "Colonized" FROM table_32982 WHERE "Chartered" = '1958'
wikisql
CREATE TABLE table_52093 ( "Round" real, "Pick" real, "Name" text, "Position" text, "School" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What position after round 8 has a pick less than 270?
SELECT "Position" FROM table_52093 WHERE "Round" > '8' AND "Pick" < '270'
wikisql
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, ...
SELECT MIN(Users.DisplayName) AS username, MIN(Users.Reputation) AS reputation, Comments.UserId, COUNT(Score) AS numcomments, SUM(Score) AS totalscore FROM Comments JOIN Users ON (Comments.UserId = Users.Id) WHERE Text LIKE '%codereview%' GROUP BY Comments.UserId ORDER BY numcomments DESC
sede
CREATE TABLE table_36252 ( "Rank" real, "Name" text, "Club" text, "Nation" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank associated with 141.48 points?
SELECT "Rank" FROM table_36252 WHERE "Points" = '141.48'
wikisql
CREATE TABLE table_name_46 ( position VARCHAR, pick VARCHAR, college VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which position was picked before 63, for Oklahoma College?
SELECT position FROM table_name_46 WHERE pick < 63 AND college = "oklahoma"
sql_create_context
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 ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
nvbench
CREATE TABLE volume ( Volume_ID int, Volume_Issue text, Issue_Date text, Weeks_on_Top real, Song text, Artist_ID int ) CREATE TABLE artist ( Artist_ID int, Artist text, Age int, Famous_Title text, Famous_Release_date text ) CREATE TABLE music_festival ( ID int, Musi...
SELECT Category, COUNT(*) FROM music_festival GROUP BY Category
nvbench
CREATE TABLE table_name_70 ( construction_completed VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date construction is completed in Jo Daviess county?
SELECT construction_completed FROM table_name_70 WHERE county = "jo daviess"
sql_create_context
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT COUNT(*) FROM person_info JOIN hz_info JOIN zzmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE person_info.XM = '张梦竹' AND zzmzjzjlb.JZKSRQ BETWEEN '2006-07-05' AND '2011-05-15' AND zzmzjzjlb.YLJGDM = '9146029' UNI...
css
CREATE TABLE table_22835602_1 ( directed_by VARCHAR, viewers__in_millions_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List all directors from episodes with viewership of 1.945 million.
SELECT directed_by FROM table_22835602_1 WHERE viewers__in_millions_ = "1.945"
sql_create_context
CREATE TABLE table_57887 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did Richmond play an away game against Coll...
SELECT "Date" FROM table_57887 WHERE "Away team" = 'richmond'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, ...
SELECT mzjzjlb.JZZDBM, mzjzjlb.JZZDSM FROM hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLS...
css
CREATE TABLE table_name_71 ( conference VARCHAR, season VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Conference for the 1967 68 season?
SELECT conference FROM table_name_71 WHERE season = "1967–68"
sql_create_context
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter DESC
nvbench
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) -- Using valid SQLite, answer the following questions for the tables provide...
SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag ORDER BY COUNT(*)
nvbench
CREATE TABLE table_name_99 ( circuit VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the circuit for 20 august
SELECT circuit FROM table_name_99 WHERE date = "20 august"
sql_create_context
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE cost ( row_id number, subject_id n...
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'other brain dx procedure') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1815 AND NOT admissions.di...
mimic_iii
CREATE TABLE table_66915 ( "Stage" text, "Winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Intergiro classification" text, "Trofeo Fast Team" text ) -- Using valid SQLite, answer the following questions for the tables provided abo...
SELECT "Winner" FROM table_66915 WHERE "Mountains classification" = 'not awarded' AND "Stage" = '1'
wikisql
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...
SELECT v.Id AS "user_link", v.UpVotes, v.DownVotes FROM Users AS v
sede
CREATE TABLE table_35793 ( "Engine" text, "Type" text, "Displacement" text, "Power" text, "Torque" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the power of the engine with a torque of n m (lb ft) at1,500rpm?
SELECT "Power" FROM table_35793 WHERE "Torque" = 'n·m (lb·ft) at1,500rpm'
wikisql
CREATE TABLE table_9942 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the rank when silver is 0, bronze is more than 1 and the total is more than 3?
SELECT "Rank" FROM table_9942 WHERE "Silver" = '0' AND "Bronze" > '1' AND "Total" > '3'
wikisql
CREATE TABLE table_41179 ( "Team" text, "Match" text, "Points" text, "Draw" text, "Lost" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Draw for match 10, and the team was skra warszawa?
SELECT "Draw" FROM table_41179 WHERE "Match" = '10' AND "Team" = 'skra warszawa'
wikisql
CREATE TABLE table_35796 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average position with an against va...
SELECT AVG("Position") FROM table_35796 WHERE "Against" < '11'
wikisql
CREATE TABLE table_58351 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the margin of victory for the waste management phoenix open tournament?
SELECT "Margin of victory" FROM table_58351 WHERE "Tournament" = 'waste management phoenix open'
wikisql
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH ...
SELECT COUNT(*) FROM zyjzjlb WHERE YLJGDM = '1511362' AND RYDJSJ BETWEEN '2018-09-20' AND '2020-02-03' AND DATEDIFF(CYSJ, RYSJ) > 8
css
CREATE TABLE table_43116 ( "Player" text, "Club" text, "League" real, "FA Cup" real, "FA Trophy" real, "League Cup" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many FA Trophy that have a Player of paul dobson, and a Leag...
SELECT COUNT("FA Trophy") FROM table_43116 WHERE "Player" = 'paul dobson' AND "League Cup" < '2'
wikisql
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TA...
SELECT PostId AS "post_link", SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS upvotes, SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS downvotes, MIN(p.Score) AS score FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId WHERE VoteTypeId IN (2, 3) AND PostTypeId IN (1, 2) AND ('##userid?674039##' = 'none' OR ...
sede
CREATE TABLE table_name_10 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2004 tournament that has a Q1 of 2011?
SELECT 2004 FROM table_name_10 WHERE 2011 = "q1"
sql_create_context
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb...
css
CREATE TABLE table_41112 ( "Headphone Model" text, "Headphone Class" text, "Driver-matched dB" real, "Construction" text, "Earpads" text, "Termination" text, "US MSRP" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the earpads for t...
SELECT "Earpads" FROM table_41112 WHERE "Headphone Class" = 'reference' AND "US MSRP" = '$695'
wikisql
CREATE TABLE table_name_59 ( date_final VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date final has 1982 as the year?
SELECT date_final FROM table_name_59 WHERE year = "1982"
sql_create_context
CREATE TABLE country ( country_id number, country text, last_update time ) CREATE TABLE film_text ( film_id number, title text, description text ) CREATE TABLE customer ( customer_id number, store_id number, first_name text, last_name text, email text, address_id number...
SELECT T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY COUNT(*) LIMIT 1
spider
CREATE TABLE table_name_51 ( round VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What round was matt brait?
SELECT round FROM table_name_51 WHERE player = "matt brait"
sql_create_context
CREATE TABLE zyb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_NM = '方刚洁' AND qtb.MED_SER_ORG_NO = '0788925' AND NOT qtb.OUT_DIAG_DIS_NM LIKE '%牙隐裂%' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_NM = '方刚洁' AND gyb.MED_SER_ORG_NO = '0788925' AND NOT gyb.OUT_DIAG_DIS_NM LIKE '%牙隐裂%' UNION SELECT zyb.MED_CLINIC_ID FROM zy...
css
CREATE TABLE bridge ( architect_id VARCHAR, length_meters INTEGER ) CREATE TABLE architect ( Id VARCHAR ) CREATE TABLE mill ( name VARCHAR, architect_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the distinct name of the mills buil...
SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.Id JOIN bridge AS T3 ON T3.architect_id = T2.Id WHERE T3.length_meters > 80
sql_create_context
CREATE TABLE table_name_43 ( species VARCHAR, voges_proskauer VARCHAR, indole VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which species has a Voges-Proskauer reading of negative and an indole reading of negative?
SELECT species FROM table_name_43 WHERE voges_proskauer = "negative" AND indole = "negative"
sql_create_context
CREATE TABLE table_name_11 ( college_junior_club_team VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which College/junior/club team has a Round of 4?
SELECT college_junior_club_team FROM table_name_11 WHERE round = 4
sql_create_context
CREATE TABLE table_name_94 ( format VARCHAR, call_sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the format for the one which has a call sign of cite-fm-1?
SELECT format FROM table_name_94 WHERE call_sign = "cite-fm-1"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 3
eicu
CREATE TABLE table_name_97 ( record VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the record of game 33?
SELECT record FROM table_name_97 WHERE game = 33
sql_create_context
CREATE TABLE table_22745 ( "Player" text, "Original Season" text, "Gender" text, "Eliminated" text, "Placing" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the contestant eliminated on episode 8 of RW: Key West season?
SELECT "Player" FROM table_22745 WHERE "Original Season" = 'RW: Key West' AND "Eliminated" = 'Episode 8'
wikisql
CREATE TABLE table_1437 ( "Pick #" real, "NFL Team" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What college did the defensive back attend?
SELECT "College" FROM table_1437 WHERE "Position" = 'Defensive Back'
wikisql
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment ...
SELECT DISTINCT airport.airport_code FROM airport, airport_service, city WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'NEW YORK'
atis
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 prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 76275) AND prescriptions.drug = 'estradiol' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-3 year')
mimic_iii
CREATE TABLE COURSE ( CName VARCHAR, Credits VARCHAR, Hours VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the names of courses that have either 3 credits or 1 credit but 4 hours.
SELECT CName FROM COURSE WHERE Credits = 3 UNION SELECT CName FROM COURSE WHERE Credits = 1 AND Hours = 4
sql_create_context
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, ...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "GANGRENE" AND demographic.admityear >= "2164"
mimicsql_data
CREATE TABLE table_26611679_3 ( category VARCHAR, totals VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the category for 50 totals
SELECT category FROM table_26611679_3 WHERE totals = "50"
sql_create_context
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostHistory...
SELECT u.Id AS "user_link", u.LastAccessDate, p.CreationDate, p.Id AS "post_link" FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE u.Id IN (2, 3, 66, 121, 1409, 2000, 2926) ORDER BY p.CreationDate DESC LIMIT 100
sede
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 prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.discharge_location = "DEAD/EXPIRED"
mimicsql_data
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD ...
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_CD, MIN(t_kc24.ILL_PAY) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '5569109' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_CD
css
CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_...
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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA...
atis
CREATE TABLE table_name_12 ( venue VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the venue of the race where Lineth Chepkurui placed 4th?
SELECT venue FROM table_name_12 WHERE position = "4th"
sql_create_context
CREATE TABLE table_name_17 ( launched VARCHAR, spacecraft VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What launched has mariner 4 as the spacecraft?
SELECT launched FROM table_name_17 WHERE spacecraft = "mariner 4"
sql_create_context
CREATE TABLE table_name_37 ( skip VARCHAR, third VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Skip has a Third of constanze hummelt?
SELECT skip FROM table_name_37 WHERE third = "constanze hummelt"
sql_create_context
CREATE TABLE table_69781 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "10:00" text, "10:30" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- for the 9:00 of bionic woman what is the 8:30?
SELECT "8:30" FROM table_69781 WHERE "9:00" = 'bionic woman'
wikisql
CREATE TABLE table_name_26 ( song_choice VARCHAR, order__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Song choice when there is an Order # of 4?
SELECT song_choice FROM table_name_26 WHERE order__number = "4"
sql_create_context
CREATE TABLE field ( fieldid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE T...
SELECT DISTINCT paperdataset.datasetid FROM author, paper, paperdataset, writes WHERE author.authorname = 'oren etzioni' AND paper.paperid = paperdataset.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
scholar
CREATE TABLE table_24412 ( "Satellite" text, "Launch date (UTC)" text, "Decay" text, "Mass(kg)" text, "Diameter(m)" text, "NSSDC ID" text, "Nation" text, "Usage" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the decay for the s...
SELECT "Decay" FROM table_24412 WHERE "Mass(kg)" = '180'
wikisql
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, pr...
SELECT DISTINCT department FROM course WHERE name LIKE '%Research Colloquium Design Studies%'
advising
CREATE TABLE table_27744844_5 ( high_points VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player scored the most points and how many were scored on November 6?
SELECT high_points FROM table_27744844_5 WHERE date = "November 6"
sql_create_context
CREATE TABLE table_45588 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the record when the game is 13?
SELECT "Record" FROM table_45588 WHERE "Game" = '13'
wikisql
CREATE TABLE table_41547 ( "Season" text, "Series" text, "Team" text, "Races" real, "wins" real, "Poles" real, "Fast laps" real, "Points" real, "Pos." text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest Poles with a wi...
SELECT MAX("Poles") FROM table_41547 WHERE "wins" < '0'
wikisql
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostsWithDeleted ( Id number, PostTyp...
SELECT COUNT(*) FROM Users AS u WHERE u.Reputation > 2440 AND u.Reputation < 3000
sede
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE wdmzjzjlb.JZZDBM = 'F51.X21' AND jyjgzbb.JCZBMC = '...
css
CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255) ) CREATE TABLE Customers_Cards ( card_id INTEGER, ...
SELECT card_type_code, COUNT(*) FROM Customers_Cards GROUP BY card_type_code ORDER BY COUNT(*)
nvbench
CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZD...
SELECT * FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '鲁霞飞' AND hz_info.YLJGDM = '8557825' AND NOT wdmzjzjlb.JZKSMC LIKE '%导管%' UNION SELECT * FROM person_info JO...
css
CREATE TABLE table_2866503_1 ( us_viewers__million_ VARCHAR, written_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many millions of viewers are listed where the writer is Matthew Okumura?
SELECT us_viewers__million_ FROM table_2866503_1 WHERE written_by = "Matthew Okumura"
sql_create_context
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int...
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 ((((flight.arrival_time <= 1245 AND flight.arrival_time >= 1115) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1...
atis
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE Posts ( Id number, PostTypeId number, Accepted...
SELECT q.Id, MIN(CAST((JULIANDAY(CreationDate) - JULIANDAY(q.CreationDate)) * 1440.0 AS INT)) AS "timeinterval" FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id AND a.Id = q.AcceptedAnswerId GROUP BY q.Id ORDER BY q.Id
sede
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE semester ( semester_id int, ...
SELECT COUNT(*) = 0 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_offering.friday = ...
advising
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...
SELECT diagnoses.short_title, procedures.short_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "74463"
mimicsql_data
CREATE TABLE table_name_8 ( tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which tournament had 1R in 2013?
SELECT tournament FROM table_name_8 WHERE 2013 = "1r"
sql_create_context
CREATE TABLE table_name_89 ( winner VARCHAR, circuit VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won at the Circuit of lakeside international raceway?
SELECT winner FROM table_name_89 WHERE circuit = "lakeside international raceway"
sql_create_context
CREATE TABLE table_2401326_1 ( bush_percentage VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of the people in Bonneville voted for Bush?
SELECT bush_percentage FROM table_2401326_1 WHERE county = "Bonneville"
sql_create_context
CREATE TABLE photos ( id int, camera_lens_id int, mountain_id int, color text, name text ) CREATE TABLE camera_lens ( id int, brand text, name text, focal_length_mm real, max_aperture real ) CREATE TABLE mountain ( id int, name text, Height real, Prominence real...
SELECT color, COUNT(color) FROM photos GROUP BY color ORDER BY COUNT(color) DESC
nvbench
CREATE TABLE table_19359427_6 ( replaced_by VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who came as a replacement in Sheffield United?
SELECT replaced_by FROM table_19359427_6 WHERE team = "Sheffield United"
sql_create_context
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...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "85" AND lab.itemid = "51274"
mimicsql_data
CREATE TABLE table_name_67 ( engine VARCHAR, torque VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which engine has a torgue of lb ft (n m)?
SELECT engine FROM table_name_67 WHERE torque = "lb·ft (n·m)"
sql_create_context
CREATE TABLE table_30859 ( "Episode #" real, "Series #" real, "Episode Title" text, "Original air date" text, "Production Code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the series number of 'the fallen star'?
SELECT "Series #" FROM table_30859 WHERE "Episode Title" = 'The Fallen Star'
wikisql
CREATE TABLE table_21539 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what w...
SELECT "Score" FROM table_21539 WHERE "Team" = 'Milwaukee'
wikisql
CREATE TABLE table_28681 ( "Fluorescent dye" text, "Color" text, "mass (g/mol)" real, "Absorb (nm)" real, "Emit (nm)" real, "\u03b5 (M \u22121 cm \u22121 )" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the (m 1 cm 1 ) of the red dye?
SELECT "\u03b5 (M \u22121 cm \u22121 )" FROM table_28681 WHERE "Color" = 'red'
wikisql
CREATE TABLE table_73284 ( "Season" real, "Episode" real, "Episode Summary" text, "Premier date" text, "External Link" text, "Coach" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What the summary of episode 15?
SELECT "Episode Summary" FROM table_73284 WHERE "Episode" = '15'
wikisql
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden ...
SELECT Count, ('site://tags/' + TagName + '|' + TagName) AS TagName, ExcerptPostId AS "post_link", WikiPostId AS "post_link" FROM Tags AS t LEFT JOIN Posts AS pe ON pe.Id = t.ExcerptPostId LEFT JOIN Posts AS pw ON pw.Id = t.WikiPostId WHERE ExcerptPostId IS NULL OR WikiPostId IS NULL OR LENGTH(pe.Body) = 0 OR LENGTH(pw...
sede
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '4732810' AND t_kc22.SOC_SRT_DIRE_CD = '7409-e' UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.MED_SER_ORG_NO = '4732810' AND t_kc22.SOC_SRT_DIRE_CD = '7409-e' UN...
css
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 varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.friday = 'N' AND course_offering.monday = 'Y' AND course_offering.thursday = 'N' AND course_offering.tuesday = 'N' AND course_offering.wednesday = 'Y' AND course.course_id = course_offering.course_id AND course.department = 'EECS' AND cour...
advising
CREATE TABLE table_204_266 ( id number, "#" number, "event year" number, "season" text, "flag bearer" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who was the first flag bearer ?
SELECT "flag bearer" FROM table_204_266 ORDER BY "event year" LIMIT 1
squall
CREATE TABLE table_name_28 ( chapter VARCHAR, chinese VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the chapter with chinese of
SELECT chapter FROM table_name_28 WHERE chinese = "釋水"
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, g...
SELECT COUNT(*) 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 = 15447)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = '.9% normal s...
mimic_iii
CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starting_year int ) CREATE TABLE player ( Player_ID int, Sponsor_name text, Player_name text, Gender text, Residence text, Occupation text, Votes int, Rank text ) CREATE TABLE coach ( Coach_ID int, Coach_name ...
SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_18908 ( "Tournament" text, "Matches" real, "Wins Olimpia" real, "Empates" real, "Wins Cerro" real, "Goals Olimpia" real, "Goals Cerro" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many goals Olimpia recorded for 32 m...
SELECT COUNT("Goals Olimpia") FROM table_18908 WHERE "Matches" = '32'
wikisql