instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price real ) CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Rankin...
SELECT Carrier, AVG(Memory_in_G) FROM phone GROUP BY Carrier ORDER BY Carrier
nvbench
CREATE TABLE table_18943444_1 ( samples_taken VARCHAR, product VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many samples were taken of 2 ?
SELECT COUNT(samples_taken) FROM table_18943444_1 WHERE product = "嬰幼兒配方乳粉2段基粉"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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,...
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDSM = '牙列缺失' AND jyjgzbb.JCZBDM = '492...
css
CREATE TABLE table_name_98 ( laps VARCHAR, driver VARCHAR, grid VARCHAR, time_retired VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many laps did Emerson Fittipaldi do on a grid larger than 14, and when was the Time/Retired of accident?
SELECT COUNT(laps) FROM table_name_98 WHERE grid > 14 AND time_retired = "accident" AND driver = "emerson fittipaldi"
sql_create_context
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, even...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures ...
mimic_iii
CREATE TABLE table_35683 ( "Name" text, "Town/City" text, "Region" text, "On Dinosaur Trail?" text, "Education programs/ Guided tours?" text, "Associated Field Digs?" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the museum ...
SELECT "Name" FROM table_35683 WHERE "Associated Field Digs?" = 'no' AND "Town/City" = 'malta'
wikisql
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT FIRST_NAME, LOCATION_ID FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.EMPLOYEE_ID = T2.MANAGER_ID ORDER BY FIRST_NAME
nvbench
CREATE TABLE Addresses ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50) ) CREATE TABLE Products ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), ...
SELECT product_type_code, COUNT(product_type_code) FROM Products WHERE product_price > 1000 OR product_price < 500 GROUP BY product_type_code ORDER BY COUNT(product_type_code)
nvbench
CREATE TABLE table_7983 ( "Frequency" text, "Call sign" text, "Branding" text, "Format" text, "Owner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which frequency belongs to the beat branding?
SELECT "Frequency" FROM table_7983 WHERE "Branding" = 'the beat'
wikisql
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, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jybgb.KSBM, jybgb.KSMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '俞...
css
CREATE TABLE table_2128 ( "Rank" real, "Couple" text, "Judges" real, "Public" real, "Total" real, "Vote percentage" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many results do Ellery and Frankie have?
SELECT COUNT("Result") FROM table_2128 WHERE "Couple" = 'Ellery and Frankie'
wikisql
CREATE TABLE table_31041 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text ) -- Using valid SQLite, answer the following questions for the tables provided ab...
SELECT MIN("No. in season") FROM table_31041
wikisql
CREATE TABLE customer_orders ( order_id VARCHAR, customer_id VARCHAR, order_status_code VARCHAR, order_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List the order id, customer id for orders in Cancelled status, ordered by their order dates.
SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = "Cancelled" ORDER BY order_date
sql_create_context
CREATE TABLE table_name_77 ( defending_forces VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which defending forces have the name Danna?
SELECT defending_forces FROM table_name_77 WHERE name = "danna"
sql_create_context
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, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT * FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_i...
css
CREATE TABLE table_5804 ( "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 is...
SELECT "High rebounds" FROM table_5804 WHERE "Record" = '18-14'
wikisql
CREATE TABLE table_9693 ( "Year" real, "Lansing (LAN)" text, "Detroit (DTW)" text, "Grand Rapids (GRR)" text, "Flint (FNT)" text, "Kalamazoo (AZO)" text, "Saginaw (MBS)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Before the year 2010, an...
SELECT "Detroit (DTW)" FROM table_9693 WHERE "Year" < '2010' AND "Kalamazoo (AZO)" = '$517.32'
wikisql
CREATE TABLE table_name_42 ( league INTEGER, total VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which league has total smaller than 284, with Sandro Mazzola league?
SELECT MIN(league) FROM table_name_42 WHERE total < 284 AND name = "sandro mazzola"
sql_create_context
CREATE TABLE table_name_33 ( category VARCHAR, pilot VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In which category is Frank Scarabino a pilot?
SELECT category FROM table_name_33 WHERE pilot = "frank scarabino"
sql_create_context
CREATE TABLE table_name_40 ( first_elected INTEGER, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest First Elected, when District is 'Massachusetts 10'?
SELECT MIN(first_elected) FROM table_name_40 WHERE district = "massachusetts 10"
sql_create_context
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 diagnosis ( diagn...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'valve replacement < 7days - tricuspid' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-5...
eicu
CREATE TABLE table_67064 ( "Season" real, "Series" text, "Wins" text, "Podiums" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the value for Podiums when the value for Wins is 2, and when the Season is 2008?
SELECT "Podiums" FROM table_67064 WHERE "Wins" = '2' AND "Season" = '2008'
wikisql
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_fl...
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, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CIT...
atis
CREATE TABLE table_44968 ( "Pollutant" text, "Type" text, "Standard" text, "Averaging Time" text, "Regulatory Citation" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the polluntant when the regulatory citation is 40 cfr 50.7(a) and the type...
SELECT "Pollutant" FROM table_44968 WHERE "Regulatory Citation" = '40 cfr 50.7(a)' AND "Type" = 'primary'
wikisql
CREATE TABLE table_13617 ( "Club" text, "Nickname" text, "Years in Competition" text, "No. of Premierships" real, "Premiership Years" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Premierships have Nicknamed of kangaroos?
SELECT COUNT("No. of Premierships") FROM table_13617 WHERE "Nickname" = 'kangaroos'
wikisql
CREATE TABLE table_name_32 ( popular_vote INTEGER, year VARCHAR, liberal_leader VARCHAR, seats_won VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Popular vote has a Liberal leader of king, and Seats won larger than 116, and a Year of 1921?
SELECT AVG(popular_vote) FROM table_name_32 WHERE liberal_leader = "king" AND seats_won > 116 AND year = "1921"
sql_create_context
CREATE TABLE table_72117 ( "Rnd" text, "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Winning driver" text, "Winning team" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How...
SELECT COUNT("Winning driver") FROM table_72117 WHERE "Rnd" = '5'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperio...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL
eicu
CREATE TABLE table_53114 ( "Name" text, "Actual version" text, "System" text, "Platform" text, "License" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which System's Name is Steem, and has a Freeware License?
SELECT "System" FROM table_53114 WHERE "License" = 'freeware' AND "Name" = 'steem'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TI...
SELECT PHONE_NUMBER, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY PHONE_NUMBER DESC
nvbench
CREATE TABLE table_22346 ( "Transmitter" text, "Service area" text, "Radio 1 (MHz)" text, "2FM (MHz)" text, "RnaG (MHz)" text, "Lyric FM (MHz)" text, "ERP (kW)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 2fm for rnag 94.4?
SELECT "2FM (MHz)" FROM table_22346 WHERE "RnaG (MHz)" = '94.4'
wikisql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location te...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =...
mimic_iii
CREATE TABLE table_name_87 ( score VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many scores have paul casey as a player?
SELECT COUNT(score) FROM table_name_87 WHERE player = "paul casey"
sql_create_context
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_DIRE_CD text, MED_DIRE_NM text,...
SELECT t_kc21.OUT_DIAG_DOC_CD, t_kc21.OUT_DIAG_DOC_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '52767851' AND t_kc21.IN_HOSP_DATE BETWEEN '2004-09-17' AND '2014-04-08' GROUP BY t_kc21.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1
css
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, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Arteriography of other intra-abdominal arteries" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, ...
SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala...
eicu
CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM tex...
SELECT SHRGH, SHRXM FROM jybgb WHERE BGDH = '61753289782'
css
CREATE TABLE table_27227 ( "No." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title of the ep...
SELECT "Title" FROM table_27227 WHERE "Production code" = '3X5405'
wikisql
CREATE TABLE table_name_92 ( skip VARCHAR, nation VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Spain's skip?
SELECT skip FROM table_name_92 WHERE nation = "spain"
sql_create_context
CREATE TABLE table_63939 ( "Rank" real, "Lane" real, "Athlete" text, "Time ( sec )" real, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank for the person with time 11.14?
SELECT AVG("Rank") FROM table_63939 WHERE "Time ( sec )" = '11.14'
wikisql
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...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Chordae tendinae rupture"
mimicsql_data
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 Headquarter, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter DESC
nvbench
CREATE TABLE table_21757 ( "Year" real, "Network" text, "Play-by-play" text, "Color commentator" text, "Sideline reporters" text, "Pregame host" text, "Pregame analysts" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What pregame host was on...
SELECT "Pregame host" FROM table_21757 WHERE "Network" = 'ESPN' AND "Color commentator" = 'Taylor Twellman'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_20863 ( "Player" text, "No." real, "Nationality" text, "Position" text, "Years for Grizzlies" text, "School/Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who are the players that have attended Stanford?
SELECT "Player" FROM table_20863 WHERE "School/Club Team" = 'Stanford'
wikisql
CREATE TABLE table_48968 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of game 30?
SELECT "Score" FROM table_48968 WHERE "Game" = '30'
wikisql
CREATE TABLE table_44739 ( "Coach" text, "First Yr" real, "Last Yr" real, "W-L%" real, "G > .500" real, "Yr plyf" real, "G plyf" real, "W plyf" real, "L plyf" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average last yr...
SELECT AVG("Last Yr") FROM table_44739 WHERE "L plyf" < '0'
wikisql
CREATE TABLE table_6533 ( "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 highest number of silvers for qatar with under 8 total, 0 golds, and over 2 bronzes?
SELECT MAX("Silver") FROM table_6533 WHERE "Total" < '8' AND "Gold" = '0' AND "Nation" = 'qatar' AND "Bronze" > '2'
wikisql
CREATE TABLE table_18841 ( "Autonomous Community" text, "Hydroelectric power" real, "Wind power" real, "Solar power" real, "Biomass power" real, "Solid waste power" real, "Total Renewable Generation" real, "Total Electricity Demand" real, "% Renewable of Total Electricity Demand" tex...
SELECT COUNT("Autonomous Community") FROM table_18841 WHERE "Total Renewable Generation" = '1375'
wikisql
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 prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51221" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE tweets ( id number, uid number, text text, createdate time ) CREATE TABLE follows ( f1 number, f2 number ) CREATE TABLE user_profiles ( uid number, name text, email text, partitionid number, followers number ) -- Using valid SQLite, answer the following quest...
SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "Mary" INTERSECT SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "Susan"
spider
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'ibuprofen' AND patient.uniquepid = '028-40370' AND STRFTIME('%y-%m', medication.drugstarttime) = '2105-10') AS t1 JOIN (S...
eicu
CREATE TABLE table_name_67 ( date VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date is aston villa away?
SELECT date FROM table_name_67 WHERE away_team = "aston villa"
sql_create_context
CREATE TABLE table_name_33 ( week VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the total number of weeks with a result of l 31-21?
SELECT COUNT(week) FROM table_name_33 WHERE result = "l 31-21"
sql_create_context
CREATE TABLE table_name_89 ( tournament VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Tournament has a Score of 1 6, 0 6?
SELECT tournament FROM table_name_89 WHERE score = "1–6, 0–6"
sql_create_context
CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE course ( c...
SELECT DISTINCT instructor.name FROM instructor, course, course_offering, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course_offering.offering_id = offering_instructor.offering_id AND instructor.instructor_id = offering_instructor.instructor_id AND NOT instr...
advising
CREATE TABLE hall_of_fame ( player_id text, yearid number, votedby text, ballots number, needed number, votes number, inducted text, category text, needed_note text ) CREATE TABLE postseason ( year number, round text, team_id_winner text, league_id_winner text, t...
SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1
spider
CREATE TABLE table_204_540 ( id number, "name" text, "town" text, "deanery" text, "vicariate" text, "founded" number, "original ethnic community" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- name the only multi ethnic parish .
SELECT "name" FROM table_204_540 WHERE "original ethnic community" = 'multi-ethnic'
squall
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( la...
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-202970') AND patient.unitdischargetime IS NULL) AND inta...
eicu
CREATE TABLE table_204_269 ( id number, "week" number, "room" text, "winning couple" text, "2nd couple" text, "3rd couple" text, "chumps" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- number of weeks that there were no chumps
SELECT COUNT("week") FROM table_204_269 WHERE "chumps" IS NULL
squall
CREATE TABLE table_name_60 ( model VARCHAR, torque VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What model is the n m (lb ft)@1500-2500 torque?
SELECT model FROM table_name_60 WHERE torque = "n·m (lb·ft)@1500-2500"
sql_create_context
CREATE TABLE table_name_27 ( games INTEGER, team VARCHAR, rebounds VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many games did team iurbentia bilbao have with rebounds higher than 212?
SELECT SUM(games) FROM table_name_27 WHERE team = "iurbentia bilbao" AND rebounds > 212
sql_create_context
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flig...
SELECT DISTINCT AIRPORT_SERVICE_0.minutes_distant FROM airport, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1 WHERE airport.airport_code = AIRPORT_SERVICE_0.airport_code AND airport.airport_code = AIRPORT_SERVICE_1.airport_code AND CITY_0.city_code = AIRPORT_...
atis
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT All_Games, All_Games_Percent FROM basketball_match ORDER BY All_Games_Percent
nvbench
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 COUNT(*) FROM t_kc22 WHERE t_kc22.MED_ORG_DEPT_CD = '2668' AND t_kc22.STA_DATE BETWEEN '2000-08-04' AND '2001-05-25' AND t_kc22.SOC_SRT_DIRE_CD = '592949'
css
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TA...
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-95970')) AND DATETIME(allergy.allergytime, 'start of month') = DATETIME(...
eicu
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 ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.long_title = "Left heart cardiac catheterization"
mimicsql_data
CREATE TABLE table_39025 ( "Country" text, "Date" text, "Label" text, "Format" text, "Catalogue #" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date for Hydra Head Records with a CD format?
SELECT "Date" FROM table_39025 WHERE "Label" = 'hydra head records' AND "Format" = 'cd'
wikisql
CREATE TABLE movie ( movie_id int, Title text, Year int, Director text, Budget_million real, Gross_worldwide int ) CREATE TABLE culture_company ( Company_name text, Type text, Incorporated_in text, Group_Equity_Shareholding real, book_club_id text, movie_id text ) CREAT...
SELECT Category, COUNT(*) FROM book_club GROUP BY Category ORDER BY Category DESC
nvbench
CREATE TABLE table_name_33 ( score VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score on april 4, 1993?
SELECT score FROM table_name_33 WHERE date = "april 4, 1993"
sql_create_context
CREATE TABLE table_name_92 ( pr_top_up VARCHAR, percentage VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS TOTAL NUMBER OF PR TOP-UPS THAT HAVE A PERCENTAGE OF 0.8%, TOTAL LARGER THAN 1?
SELECT COUNT(pr_top_up) FROM table_name_92 WHERE percentage = "0.8%" AND total > 1
sql_create_context
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...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 98015) AND prescriptions.drug IN ('metoprolol', 'labetalol hcl', 'hydrocortisone na succ.') AND STRFTIME('%y-%m', prescriptions.startdate) <= '2105-10'
mimic_iii
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
SELECT roomName, COUNT(roomName) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%' GROUP BY roomName
nvbench
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE S...
WITH TopTags AS (SELECT TagName FROM Tags ORDER BY Count DESC LIMIT 10) SELECT DISTINCT T.TagName FROM TopTags AS T WHERE PATINDEX('%' + T.TagName + '%', 'java,javascript') > 0 INTERSECT SELECT DISTINCT T.TagName FROM TopTags AS T WHERE PATINDEX('%' + T.TagName + '%', 'java') > 0
sede
CREATE TABLE table_name_90 ( date VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the date when the attendance was 77,918?
SELECT date FROM table_name_90 WHERE attendance = "77,918"
sql_create_context
CREATE TABLE table_24841 ( "Type" text, "Registration" text, "Design" text, "Construction" text, "Service" text, "Construction date" text, "Conformity to original design" text, "Interest" text, "Number existing in Switzerland" text, "Number existing worldwide" text, "Status" ...
SELECT "Registration" FROM table_24841 WHERE "Type" = 'T 6 G'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, ...
SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 13622 AND DATETIME(admissions.dischtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.dischtime LIMIT 1
mimic_iii
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 (SELECT COUNT(*) FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '张承悦' AND mzjzjlb.JZKSRQ BETWEEN '2004-12-30' AND '2008-02-28') + (SELECT COUNT(*) FROM person_info J...
css
CREATE TABLE table_4105 ( "Player" text, "County" text, "Matches" real, "Innings" real, "Runs" real, "Average" text, "Highest Score" text, "100s" real, "50s" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many 100 for the player ...
SELECT "100s" FROM table_4105 WHERE "50s" = '3'
wikisql
CREATE TABLE table_21075 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter (km)" text, "Year named" real, "Name origin" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- At what latitude can the name origin of naijok fossae be found?
SELECT "Latitude" FROM table_21075 WHERE "Name" = 'Naijok Fossae'
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 COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'SPACE' AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
advising
CREATE TABLE table_name_54 ( date VARCHAR, outcome VARCHAR, opponents_in_the_final VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date shows the Outcome of winner against nikola fra kov carmen klaschka?
SELECT date FROM table_name_54 WHERE outcome = "winner" AND opponents_in_the_final = "nikola fraňková carmen klaschka"
sql_create_context
CREATE TABLE table_54100 ( "Tournament" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "Career SR" text ) -- Using valid SQLite, answer the following questions for the tables provid...
SELECT "Tournament" FROM table_54100 WHERE "2004" = '1r' AND "1998" = '2r'
wikisql
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 ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "8" AND prescriptions.drug = "traZODONE"
mimicsql_data
CREATE TABLE table_63896 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date was Ipswich Town the away team?
SELECT "Date" FROM table_63896 WHERE "Away team" = 'ipswich town'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime t...
SELECT DISTINCT patient.gender FROM patient WHERE patient.uniquepid = '032-19209'
eicu
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, d...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY outputevents.itemid) AS...
mimic_iii
CREATE TABLE customers ( customer_id number, payment_method text, customer_name text, date_became_customer time, other_customer_details text ) CREATE TABLE order_items ( order_id number, product_id number, order_quantity text ) CREATE TABLE addresses ( address_id number, addres...
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY SUM(t3.order_quantity) DESC LIMIT 1
spider
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) 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...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB ...
css
CREATE TABLE table_19047_2 ( year INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the first year in the competition?
SELECT MIN(year) FROM table_19047_2
sql_create_context
CREATE TABLE assignedto ( scientist number, project text ) CREATE TABLE projects ( code text, name text, hours number ) CREATE TABLE scientists ( ssn number, name text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the total hours of all p...
SELECT SUM(hours) FROM projects
spider
CREATE TABLE gwyjzb ( 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 text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '凤清华' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2010-10-13' AND '2013-09-11' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb JOIN t_kc24 ON fgwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE fgwyjzb.PER...
css
CREATE TABLE table_dev_2 ( "id" int, "nutrient_absorption" bool, "systolic_blood_pressure_sbp" int, "active_metabolic" bool, "hepatic_disease" bool, "surgery" bool, "diastolic_blood_pressure_dbp" int, "gastrointestinal_disease" bool, "organ_failure" bool, "NOUSE" float ) -- Usi...
SELECT * FROM table_dev_2 WHERE active_metabolic = 1 OR (gastrointestinal_disease = 1 OR nutrient_absorption = 1)
criteria2sql
CREATE TABLE table_203_763 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how long did gonzelz throw for in 1983 ?
SELECT "notes" FROM table_203_763 WHERE "year" = 1983
squall
CREATE TABLE table_15780718_8 ( high_assists VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who scored the most assists in game 59?
SELECT high_assists FROM table_15780718_8 WHERE game = 59
sql_create_context
CREATE TABLE table_58391 ( "AVE- No." real, "Name" text, "Country" text, "Highest mountain" text, "Height (m)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which sum of AVE-No has a Name of albula alps, and a Height (m) larger than 3418?
SELECT SUM("AVE- No.") FROM table_58391 WHERE "Name" = 'albula alps' AND "Height (m)" > '3418'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-18...
eicu
CREATE TABLE table_1066 ( "Pos" real, "Member Association" text, "Points (total 500)" real, "Clubs" real, "Group stage" real, "Play-off" real, "AFC Cup" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the group stage has been 4 what is t...
SELECT MAX("Play-off") FROM table_1066 WHERE "Group stage" = '4'
wikisql
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 demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ACIDOSIS" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
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...
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73362) AND STRFTIME('%y-%m', microbiologyevents.charttime) = '2103-05' ORDER BY microbiologyevents.charttime LIMIT 1
mimic_iii