instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name
nvbench
CREATE TABLE table_66764 ( "Rank" real, "Year" real, "Name" text, "Moving from" text, "Moving to" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The player with a rank of 9, made a move from what football club?
SELECT "Moving from" FROM table_66764 WHERE "Rank" = '9'
wikisql
CREATE TABLE table_261941_1 ( founded VARCHAR, type VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the private/baptist school founded?
SELECT founded FROM table_261941_1 WHERE type = "Private/Baptist"
sql_create_context
CREATE TABLE table_name_1 ( location VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was the location where justin robbins fought against billy kidd?
SELECT location FROM table_name_1 WHERE opponent = "billy kidd"
sql_create_context
CREATE TABLE table_160510_1 ( capital VARCHAR, hanja VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The hanja is for what capital?
SELECT capital FROM table_160510_1 WHERE hanja = "尙州"
sql_create_context
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 text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '6226694' AND t_kc21.IN_HOSP_DATE BETWEEN '2011-07-25' AND '2019-11-30' AND t_kc21.INSU_TYPE = '儿童'
css
CREATE TABLE table_76384 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was the fight located that lasted 1 round against luiz claudio...
SELECT "Location" FROM table_76384 WHERE "Round" = '1' AND "Opponent" = 'luiz claudio das dores'
wikisql
CREATE TABLE table_62241 ( "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 nation when bronze is less than 7, gold is larger than 0, total is larger than 7...
SELECT "Nation" FROM table_62241 WHERE "Bronze" < '7' AND "Gold" > '0' AND "Total" > '7' AND "Silver" < '3'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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 departments ( DEP...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID
nvbench
CREATE TABLE table_name_24 ( event VARCHAR, opponent VARCHAR, res VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which event is a win by an opponent of Nicolas Smith, with the round marked n/a?
SELECT event FROM table_name_24 WHERE res = "win" AND round = "n/a" AND opponent = "nicolas smith"
sql_create_context
CREATE TABLE table_name_64 ( byes INTEGER, against VARCHAR, wins VARCHAR, benalla_dfl VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest value for Byes, when Wins is less than 16, when Benalla DFL is 'Swanpool', and when Against is le...
SELECT MAX(byes) FROM table_name_64 WHERE wins < 16 AND benalla_dfl = "swanpool" AND against < 2177
sql_create_context
CREATE TABLE table_42628 ( "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. -- Which average against has a lost less than 1?
SELECT AVG("Against") FROM table_42628 WHERE "Lost" < '1'
wikisql
CREATE TABLE table_27755603_11 ( game VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What numbered game did they play chicago?
SELECT game FROM table_27755603_11 WHERE team = "Chicago"
sql_create_context
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-62783')) AND lab.labname = 'magnesium' AND STRFTIME('%y', lab.labresulttime) <= '2103'
eicu
CREATE TABLE table_43268 ( "Date" text, "Label" text, "Format" text, "Country" text, "Catalog" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Catalog with a Format of lp, a Country of us, a Label of sundazed, and a Date of 2006?
SELECT "Catalog" FROM table_43268 WHERE "Format" = 'lp' AND "Country" = 'us' AND "Label" = 'sundazed' AND "Date" = '2006'
wikisql
CREATE TABLE table_34961 ( "Eruptions" text, "Country" text, "Location" text, "Year" real, "Volcanic Explosivity Index" text, "Fatalities" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Eruptions have a Location of pacific ring of fire, an...
SELECT "Eruptions" FROM table_34961 WHERE "Location" = 'pacific ring of fire' AND "Volcanic Explosivity Index" = '6' AND "Country" = 'peru'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '凤清华' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2010-10-13' AND '2013-09-11'
css
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 cost ( costid num...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'cardiac arrest' AND STRFTIME('%y', diagnosis.diagn...
eicu
CREATE TABLE table_28035004_1 ( variant VARCHAR, bodybuilder VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the variant when Alexander was the bodybuilder?
SELECT variant FROM table_28035004_1 WHERE bodybuilder = "Alexander"
sql_create_context
CREATE TABLE table_11391 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many laps are associated with a time of + 1:39.591?
SELECT "Laps" FROM table_11391 WHERE "Time/Retired" = '+ 1:39.591'
wikisql
CREATE TABLE table_name_77 ( goal_difference INTEGER, losses VARCHAR, points VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Goal Difference has 28 Points, and a Club of cd cartagena, more than 15 losses?
SELECT MAX(goal_difference) FROM table_name_77 WHERE points = 28 AND club = "cd cartagena" AND losses > 15
sql_create_context
CREATE TABLE table_38907 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the Visitor on march 16?
SELECT "Visitor" FROM table_38907 WHERE "Date" = 'march 16'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "JEHOVAH'S WITNESS" AND lab.label = "Creatine Kinase, MB Isoenzyme"
mimicsql_data
CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_...
SELECT DISTINCT fare.fare_id, flight.airline_code, 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 = 'BALTIMORE' AND CITY_1.city_code = AI...
atis
CREATE TABLE table_name_60 ( date VARCHAR, opponent VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which date has a Opponent of juan m naco, and a Score of 6 2, 4 6, 7 6 (7 3)?
SELECT date FROM table_name_60 WHERE opponent = "juan mónaco" AND score = "6–2, 4–6, 7–6 (7–3)"
sql_create_context
CREATE TABLE table_79402 ( "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Turkey's average Gold entry that also has a Bronze entry that is smaller than 2 and the Total is grea...
SELECT AVG("Gold") FROM table_79402 WHERE "Bronze" < '2' AND "Nation" = 'turkey' AND "Total" > '1'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
SELECT ViewCount / 100 AS Hundred_Views, COUNT(*) AS Nquestions FROM Posts WHERE PostTypeId = 1 GROUP BY ViewCount / 100 ORDER BY ViewCount / 100
sede
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, ...
(SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb ON 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 hz_info.RYBH = '43179204' AND NOT jybgb.BGDH IN (SELECT BGDH FROM jyjgzbb WHERE JCZ...
css
CREATE TABLE table_name_81 ( average INTEGER, city VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Average of bergen, norway?
SELECT MIN(average) FROM table_name_81 WHERE city = "bergen, norway"
sql_create_context
CREATE TABLE table_19412902_1 ( clubs VARCHAR, group_stage VARCHAR, member_association VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which club in group stage 4 had member association iran
SELECT clubs FROM table_19412902_1 WHERE group_stage = 4 AND member_association = "Iran"
sql_create_context
CREATE TABLE table_27455 ( "Rank" real, "Rider" text, "Sat 29 May" text, "Mon 31 May" text, "Tues 1 June" text, "Wed 2 June" text, "Thurs 3 June" text, "Fri 4 June" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If Thursday 3 June is 20'...
SELECT "Rider" FROM table_27455 WHERE "Thurs 3 June" = '20'' 27.93 110.615mph'
wikisql
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 gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_CD, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '9645673' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.IN_DIAG_DIS_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_NM, fgwyjzb.IN_DIAG_DIS_CD, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '96456...
css
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "10" AND procedures.long_title = "(Aorto)coronary bypass of two coronary arteries"
mimicsql_data
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND diagnoses.icd9_code = "7069"
mimicsql_data
CREATE TABLE table_28192 ( "Metropolitan ring" text, "Localities" real, "Total" real, "Jews and others 1" real, "Thereof: Jews" real, "Arabs" real, "Population density (per km\u00b2)" text, "Annual Population growth rate" text ) -- Using valid SQLite, answer the following questions for...
SELECT MIN("Jews and others 1") FROM table_28192 WHERE "Localities" = '11'
wikisql
CREATE TABLE table_name_49 ( starts INTEGER, year VARCHAR, avg_start VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the highest number of starts in 2007 when the average start was over 17.6?
SELECT MAX(starts) FROM table_name_49 WHERE year = 2007 AND avg_start > 17.6
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Promethazine HCl"
mimicsql_data
CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id number ) 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 tex...
SELECT COUNT(*) FROM jybgb WHERE jybgb.YLJGDM = '5651827' AND jybgb.BGRQ BETWEEN '2001-04-15' AND '2006-05-09'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.age >= "79"
mimicsql_data
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, ...
SELECT p.Id AS "user_link", p.Ranking, SUBSTRING(CAST(CAST(Ranking AS FLOAT) / Count * 100.00 AS TEXT), 1, 6) + '%' AS Percentile, Reputation, SUBSTRING(CAST(CAST(Reputation AS FLOAT) / Sum * 100.00 AS TEXT), 1, 6) + '%' AS "Hoarded rep" FROM (SELECT Id, ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Ranking, Reputati...
sede
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, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND lab.itemid = "50983"
mimicsql_data
CREATE TABLE table_12752 ( "Season" real, "Winners" text, "Total wins" real, "Runners-up" text, "Third-place" text, "Number of clubs" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of the number of clubs in seasons before 1992 wi...
SELECT SUM("Number of clubs") FROM table_12752 WHERE "Season" < '1992' AND "Total wins" > '3'
wikisql
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '32360025' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC
css
CREATE TABLE table_name_66 ( opponent VARCHAR, arena VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Opponent at the Honda Center on March 29?
SELECT opponent FROM table_name_66 WHERE arena = "honda center" AND date = "march 29"
sql_create_context
CREATE TABLE table_name_19 ( against INTEGER, draw VARCHAR, played VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total against with 1 draw and less than 8 played?
SELECT SUM(against) FROM table_name_19 WHERE draw = 1 AND played < 8
sql_create_context
CREATE TABLE table_32706 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which opponent had an attendance of 40,070?
SELECT "Opponent" FROM table_32706 WHERE "Attendance" = '40,070'
wikisql
CREATE TABLE table_69694 ( "Year" real, "Winners" text, "2nd place" text, "3rd place" text, "4th place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the 3rd place with winners of weymouth wildcats and 4th place of boston barracudas
SELECT "3rd place" FROM table_69694 WHERE "Winners" = 'weymouth wildcats' AND "4th place" = 'boston barracudas'
wikisql
CREATE TABLE table_1341865_40 ( district VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What district is incumbent albert w. johnson from?
SELECT district FROM table_1341865_40 WHERE incumbent = "Albert W. Johnson"
sql_create_context
CREATE TABLE table_74970 ( "Condition" text, "Prothrombin time" text, "Partial thromboplastin time" text, "Bleeding time" text, "Platelet count" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Condition has a Bleeding time of unaffected, and a ...
SELECT "Condition" FROM table_74970 WHERE "Bleeding time" = 'unaffected' AND "Partial thromboplastin time" = 'prolonged' AND "Prothrombin time" = 'unaffected'
wikisql
CREATE TABLE table_test_29 ( "id" int, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "trauma" bool, "renal_disease" bool, "creatinine_clearance_cl" float, "hemorrhagic_stroke" ...
SELECT * FROM table_test_29 WHERE hemorrhagic_stroke = 1
criteria2sql
CREATE TABLE table_name_50 ( member VARCHAR, electorate VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which member has an Electorate of kennedy?
SELECT member FROM table_name_50 WHERE electorate = "kennedy"
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 WHERE demographic.expire_flag = "0"
mimicsql_data
CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Student ( StuID INTEGE...
SELECT dorm_name, COUNT(*) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name ORDER BY COUNT(*)
nvbench
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 jyjgzbb.JCFF FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb....
css
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 Founder, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Price) DESC
nvbench
CREATE TABLE table_19479 ( "Date Released" text, "Polling institute" text, "Socialist" text, "Social Democratic" text, "Peoples Party" text, "Green-Communist" text, "Left Bloc" text, "Lead" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- ...
SELECT COUNT("Left Bloc") FROM table_19479 WHERE "Social Democratic" = '32.1%'
wikisql
CREATE TABLE table_39471 ( "Name" text, "Type" text, "Year Built" real, "Where Built" text, "Initial Owners" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where was something built earlier than 1858?
SELECT "Where Built" FROM table_39471 WHERE "Year Built" < '1858'
wikisql
CREATE TABLE table_39448 ( "PRINT NAME" text, "NICKNAME" text, "NUMBER OF COLORS" text, "FRAMED SIZE" text, "DATE COMPLETED" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the print name in 07/87?
SELECT "PRINT NAME" FROM table_39448 WHERE "DATE COMPLETED" = '07/87'
wikisql
CREATE TABLE table_name_4 ( date VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did the Score of 195 (-21) happen?
SELECT date FROM table_name_4 WHERE score = "195 (-21)"
sql_create_context
CREATE TABLE qtb ( 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 NOT qtb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 3461.35) UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_NM = '凤香馨' AND NOT gyb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUN...
css
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_MED_SER_ORG_NO = '3974649' AND t_kc22.SOC_SRT_DIRE_CD = '165044266-n'
css
CREATE TABLE table_29271 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (in millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many viewer data were given for episo...
SELECT COUNT("U.S. viewers (in millions)") FROM table_29271 WHERE "Title" = 'If at First You Don''t Succeed, Lie, Lie Again'
wikisql
CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text ) CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text ) -- Using valid SQLite, answer the following questions for the tabl...
SELECT Date_of_Birth, COUNT(Date_of_Birth) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones"
nvbench
CREATE TABLE table_204_486 ( id number, "name" text, "season(s)" text, "position(s)" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- tell me the number of left fielders on the list .
SELECT COUNT(*) FROM table_204_486 WHERE "position(s)" = 'left fielder'
squall
CREATE TABLE table_name_20 ( loss VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the loss from the coyotes as opponents?
SELECT loss FROM table_name_20 WHERE opponent = "coyotes"
sql_create_context
CREATE TABLE table_name_30 ( position VARCHAR, year VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the position of Greg Fredlund in years after 2008?
SELECT position FROM table_name_30 WHERE year > 2008 AND player = "greg fredlund"
sql_create_context
CREATE TABLE table_name_90 ( mountain_range VARCHAR, region VARCHAR, mountain_peak VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the mountain range when the region is british columbia and mountain pea is mount edziza?
SELECT mountain_range FROM table_name_90 WHERE region = "british columbia" AND mountain_peak = "mount edziza"
sql_create_context
CREATE TABLE table_51672 ( "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. -- What is the Home team score for the Home team fr...
SELECT "Home team score" FROM table_51672 WHERE "Home team" = 'south melbourne'
wikisql
CREATE TABLE table_name_50 ( number VARCHAR, language VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many speak german?
SELECT number FROM table_name_50 WHERE language = "german"
sql_create_context
CREATE TABLE table_name_97 ( to_par VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which To par has a Score of 70-73-80-68=291?
SELECT to_par FROM table_name_97 WHERE score = 70 - 73 - 80 - 68 = 291
sql_create_context
CREATE TABLE table_name_58 ( score VARCHAR, opponent VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the score for opponent @ Tigers on July 24?
SELECT score FROM table_name_58 WHERE opponent = "@ tigers" AND date = "july 24"
sql_create_context
CREATE TABLE table_13086 ( "Constituency number" text, "Name" text, "Reserved for ( SC / ST /None)" text, "District" text, "Number of electorates (2009)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Number of electorates (2009) has a District...
SELECT MIN("Number of electorates (2009)") FROM table_13086 WHERE "District" = 'mathura' AND "Name" = 'mant'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.days_stay = "27"
mimicsql_data
CREATE TABLE table_name_74 ( established VARCHAR, institution VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the year established of North Jersey Phoenix?
SELECT established FROM table_name_74 WHERE institution = "north jersey phoenix"
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugsto...
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
eicu
CREATE TABLE table_name_74 ( attendance INTEGER, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance for the game on August 16?
SELECT SUM(attendance) FROM table_name_74 WHERE date = "august 16"
sql_create_context
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructo...
SELECT DISTINCT course.department, course.name, course.number 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.ins...
advising
CREATE TABLE table_4051 ( "Year" real, "Host Nation(s)" text, "Final Venue" text, "Winner" text, "Result" text, "Runner-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the final venue whene England hasted the competition and the runn...
SELECT "Final Venue" FROM table_4051 WHERE "Host Nation(s)" = 'England' AND "Runner-up" = '[[|]] 4 points' AND "Winner" = '[[|]] 6 points'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '0781537' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM
css
CREATE TABLE table_name_19 ( mascot VARCHAR, year_joined VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the mascot for moores hill that joined later than 1952?
SELECT mascot FROM table_name_19 WHERE year_joined > 1952 AND school = "moores hill"
sql_create_context
CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text ) CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) CREATE TABLE course (...
SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_203_345 ( id number, "name" text, "party" text, "took office" number, "left office" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- when did the first provincial representative for gilbert plains take office ?
SELECT MIN("took office") FROM table_203_345
squall
CREATE TABLE table_2160 ( "Election" text, "# of candidates nominated" real, "# of seats won" real, "# of total votes" real, "% of popular vote" text, "result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most number of total votes fo...
SELECT MAX("# of total votes") FROM table_2160 WHERE "Election" = '1878'
wikisql
CREATE TABLE table_11413 ( "Name" text, "Builder" text, "Type" text, "Date" real, "Works number" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total work number of Gowrie after 1875?
SELECT SUM("Works number") FROM table_11413 WHERE "Date" > '1875' AND "Name" = 'gowrie'
wikisql
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_Home, School_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY All_Home
nvbench
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time,...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B...
mimic_iii
CREATE TABLE table_78930 ( "Elector" text, "Place of birth" text, "Cardinalatial title" text, "Elevated" text, "Elevator" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the Elector with a Cardinalatial title of Priest of S. Sabina and Archbis...
SELECT "Elector" FROM table_78930 WHERE "Cardinalatial title" = 'priest of s. sabina and archbishop of reims'
wikisql
CREATE TABLE election ( Election_ID int, Representative_ID int, Date text, Votes real, Vote_Percent real, Seats real, Place real ) CREATE TABLE representative ( Representative_ID int, Name text, State text, Party text, Lifespan text ) -- Using valid SQLite, answer the ...
SELECT Date, Vote_Percent FROM election ORDER BY Vote_Percent DESC
nvbench
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimme...
SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY AVG(ID)
nvbench
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, h...
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'esophagogastroduodenoscopy - with biopsy...
eicu
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate re...
SELECT Sex, COUNT(Sex) FROM people GROUP BY Sex ORDER BY COUNT(Sex)
nvbench
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT ILL_PAY FROM t_kc24 WHERE MED_CLINIC_ID = '91538093313'
css
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 text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.PERSON_NM = '水宏茂' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2008-01-30' AND '2008-06-28'
css
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2103" AND procedures.icd9_code = "93"
mimicsql_data
CREATE TABLE table_31785 ( "Year" text, "Men's Singles" text, "Women's Singles" text, "Men's Doubles" text, "Women's Doubles" text, "Mixed Doubles" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who played men's doubles in 2012?
SELECT "Men's Doubles" FROM table_31785 WHERE "Year" = '2012'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, Rejecti...
SELECT b.UserId AS "user_link", u.Reputation, b.Date FROM Badges AS b LEFT JOIN Users AS u ON u.Id = b.UserId WHERE b.Name = 'Illuminator' ORDER BY u.Reputation, u.DisplayName
sede
CREATE TABLE table_name_67 ( year INTEGER, event VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the highest Year for the Venue of Santiago De Chile and the Event of 800 m?
SELECT MAX(year) FROM table_name_67 WHERE event = "800 m" AND venue = "santiago de chile"
sql_create_context
CREATE TABLE table_16812 ( "Series" real, "Year" text, "Winner" text, "Runner-up" text, "Third place" text, "Fourth place" text, "Fifth place" text, "Sixth place" text, "Host" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many f...
SELECT COUNT("Fourth place") FROM table_16812 WHERE "Year" = '2003'
wikisql
CREATE TABLE table_name_8 ( school VARCHAR, year_left VARCHAR, mascot VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which School has a Year Left of 1966, and a Mascot of indians?
SELECT school FROM table_name_8 WHERE year_left = 1966 AND mascot = "indians"
sql_create_context
CREATE TABLE table_61328 ( "Outcome" text, "Date" real, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which Surface has Opponents in the ...
SELECT "Surface" FROM table_61328 WHERE "Opponents in the final" = 'mark edmondson sherwood stewart' AND "Tournament" = 'dallas , u.s.'
wikisql