instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_17510803_2 ( won VARCHAR, points_against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many won when points against is 410?
SELECT COUNT(won) FROM table_17510803_2 WHERE points_against = "410"
sql_create_context
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 airline ( airline_code varchar, airline_name text, note text ) CREATE ...
SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, equipment_sequence, 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.cit...
atis
CREATE TABLE table_30719 ( "Athens XI" text, "PIFA Colaba FC u-17" text, "Tata Power" text, "Dadar XI \u2018B\u2019" text, "IDBI" text, "World Network Services" text, "United FC" text, "Good Shepherd" text ) -- Using valid SQLite, answer the following questions for the tables provided ...
SELECT "United FC" FROM table_30719 WHERE "PIFA Colaba FC u-17" = 'Sporting Options'
wikisql
CREATE TABLE table_35938 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Location of hemisfair arena had what record?
SELECT "Record" FROM table_35938 WHERE "Location" = 'hemisfair arena'
wikisql
CREATE TABLE Allergy_type ( allergytype VARCHAR, allergy VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the type of allergy Cat?
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat"
sql_create_context
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), ...
SELECT HIRE_DATE, SALARY FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE Staff ( staff_id INTEGER, gender VARCHAR(1), first_name VARCHAR(80), last_name VARCHAR(80), email_address VARCHAR(255), phone_number VARCHAR(80) ) CREATE TABLE Customers ( customer_id INTEGER, customer_type_code VARCHAR(20), address_line_1 VARCHAR(80), address_line_...
SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code
nvbench
CREATE TABLE mzb ( 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 t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_ID = '52953159' AND qtb.MED_SER_ORG_NO = '3607978' AND qtb.IN_HOSP_DATE BETWEEN '2015-08-12' AND '2015-10-01' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_ID = ...
css
CREATE TABLE table_70949 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Points that Peter Whitehead earned in a Ferrari 125?
SELECT SUM("Points") FROM table_70949 WHERE "Entrant" = 'peter whitehead' AND "Chassis" = 'ferrari 125'
wikisql
CREATE TABLE dorm ( student_capacity INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the total capacity of all dorms.
SELECT SUM(student_capacity) FROM dorm
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 COUNT(*) FROM mzjzjlb JOIN hz_info_mzjzjlb JOIN hz_info ON hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.mzjzjlb_id = mzjzjlb.mzjzjlb_id AND hz_info_mzjzjlb.YLJGDM = hz_info.YLJGDM WHERE hz_info.YLJGDM = '51...
css
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.long_title = "Mitral valve disorders"
mimicsql_data
CREATE TABLE table_22593 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the ep...
SELECT "Title" FROM table_22593 WHERE "Production code" = '06-00-218'
wikisql
CREATE TABLE table_name_44 ( opponent VARCHAR, week VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who was the opponent when the week was 9?
SELECT opponent FROM table_name_44 WHERE week = "9"
sql_create_context
CREATE TABLE table_28429 ( "Club" text, "Wins" real, "Losses" real, "Points For" real, "Points Against" real, "Percentage" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many losses does Central Blues have?
SELECT MAX("Losses") FROM table_28429 WHERE "Club" = 'Central Blues'
wikisql
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 mzjzjlb.JZZTDM, mzjzjlb.JZZTMC FROM mzjzjlb WHERE mzjzjlb.JZLSH = '01573441264'
css
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 bedType, AVG(basePrice) FROM Rooms GROUP BY bedType
nvbench
CREATE TABLE table_name_3 ( goal_difference INTEGER, wins VARCHAR, draws VARCHAR, goals_against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the goal difference when there are fewer than 12 wins, 32 goals against and 8 draws?
SELECT SUM(goal_difference) FROM table_name_3 WHERE draws = 8 AND goals_against = 32 AND wins < 12
sql_create_context
CREATE TABLE table_12840 ( "Election" text, "1st Member" text, "1st Party" text, "2nd Member" text, "2nd Party" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which 2nd Member has a 1st Party of liberal?
SELECT "2nd Member" FROM table_12840 WHERE "1st Party" = 'liberal'
wikisql
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_CLINIC_ID FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '凤清华' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2010-10-13' AND '2013-09-11'
css
CREATE TABLE table_name_26 ( shutdown VARCHAR, electricity_grid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did the Electricity Grid 28.12.1972 officially shutdown?
SELECT shutdown FROM table_name_26 WHERE electricity_grid = "28.12.1972"
sql_create_context
CREATE TABLE table_34813 ( "Office" text, "Republican ticket" text, "Democratic ticket" text, "Liberal ticket" text, "Independent-Socialist ticket" text, "Socialist Labor ticket" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the Republi...
SELECT "Republican ticket" FROM table_34813 WHERE "Democratic ticket" = 'arthur levitt'
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 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND prescriptions.drug = "Fluoxetine"
mimicsql_data
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_name_31 ( party VARCHAR, member VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What the name of Peter White's party?
SELECT party FROM table_name_31 WHERE member = "peter white"
sql_create_context
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 t_kc21.MED_ORG_DEPT_CD, t_kc21.MED_ORG_DEPT_NM FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '6679422' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2000-04-05' AND '2005-10-09' GROUP BY t_kc21.MED_ORG_DEPT_CD ORDER BY SUM(t_kc24.OVE_PAY) DESC LIMIT 20
css
CREATE TABLE accounts ( custid number, name text ) CREATE TABLE savings ( custid number, balance number ) CREATE TABLE checking ( custid number, balance number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the balances of checking account...
SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT AVG(balance) FROM savings))
spider
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ...
SELECT DEPT_CODE, SUM(T1.CRS_CREDIT) FROM COURSE AS T1 JOIN CLASS AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY T1.DEPT_CODE ORDER BY SUM(T1.CRS_CREDIT) DESC
nvbench
CREATE TABLE table_name_16 ( circuit VARCHAR, fastest_lap VARCHAR, tyre VARCHAR, pole_position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When Jackie Stewart had the fastest lap and Jochen Rindt held the pole position with a D tyre, what was the ...
SELECT circuit FROM table_name_16 WHERE tyre = "d" AND pole_position = "jochen rindt" AND fastest_lap = "jackie stewart"
sql_create_context
CREATE TABLE table_name_85 ( week INTEGER, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Week number with a Result of W 30-28?
SELECT AVG(week) FROM table_name_85 WHERE result = "w 30-28"
sql_create_context
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE cost ( row_id numbe...
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'joint replaced hip') AND STRFTIME('%y', diagnoses_icd.charttime) >= '2105'...
mimic_iii
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 WHERE t_kc21.PERSON_ID = '30139154' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT <= 4566.82)
css
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( med...
SELECT DISTINCT patient.gender FROM patient WHERE patient.uniquepid = '031-1337'
eicu
CREATE TABLE table_name_74 ( result VARCHAR, score VARCHAR, competition VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Result has a Score of 2 0, and a Competition of 2006 fifa world cup qualification?
SELECT result FROM table_name_74 WHERE score = "2 – 0" AND competition = "2006 fifa world cup qualification"
sql_create_context
CREATE TABLE table_203_713 ( id number, "s.no." number, "name of kingdom" text, "name of king" text, "no. of villages" number, "capital" text, "names of districts" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- he was the king of the sihag k...
SELECT "name of king" FROM table_203_713 WHERE "name of kingdom" = 'sihag'
squall
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
eicu
CREATE TABLE table_name_11 ( bronze INTEGER, silver VARCHAR, gold VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the highest bronze when silver is less than 1 and gold is more than 0?
SELECT MAX(bronze) FROM table_name_11 WHERE silver < 1 AND gold > 0
sql_create_context
CREATE TABLE table_27549 ( "Order" real, "Episode" text, "U.S. air date" text, "Rating" text, "Share" real, "Rating/Share (18\u201349)" text, "Viewers (millions)" text, "Rank (timeslot)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Wha...
SELECT MAX("Share") FROM table_27549
wikisql
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 demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2198" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE table_178408_1 ( year_built INTEGER, church_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most year built for davik kyrkje
SELECT MAX(year_built) FROM table_178408_1 WHERE church_name = "Davik Kyrkje"
sql_create_context
CREATE TABLE table_name_64 ( north_america VARCHAR, europe VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the north america for september 18, 2009
SELECT north_america FROM table_name_64 WHERE europe = "september 18, 2009"
sql_create_context
CREATE TABLE table_name_53 ( venue VARCHAR, scored VARCHAR, competition VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- At what venue did Sigurd Rushfeldt score 1 point in the 2006 FIFA World Cup Qualification competition?
SELECT venue FROM table_name_53 WHERE scored = 1 AND competition = "2006 fifa world cup qualification"
sql_create_context
CREATE TABLE table_11852 ( "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 for grid 25?
SELECT COUNT("Laps") FROM table_11852 WHERE "Grid" = '25'
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 ACC_Regular_Season, All_Games_Percent FROM basketball_match ORDER BY ACC_Regular_Season
nvbench
CREATE TABLE table_name_63 ( date VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date has alamodome, san antonio, united states as the venue?
SELECT date FROM table_name_63 WHERE venue = "alamodome, san antonio, united states"
sql_create_context
CREATE TABLE table_204_654 ( id number, "year" number, "song" text, "u.s." number, "u.s.\nr&b" number, "u.s.\nac" number, "uk" number, "album" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which songs charted in the united states , but ...
SELECT "song" FROM table_204_654 WHERE NOT "u.s." IS NULL AND "uk" IS NULL
squall
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 jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb 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 AND jybgb.YLJGDM = jybgb_jyjgzbb.YLJGDM ...
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Candidal vulvovaginitis"
mimicsql_data
CREATE TABLE table_name_27 ( record VARCHAR, game__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record after game 79?
SELECT record FROM table_name_27 WHERE game__number = 79
sql_create_context
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 gwyjzb.MED_ORG_DEPT_CD, AVG(t_kc24.OVE_PAY) FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '7883638' GROUP BY gwyjzb.MED_ORG_DEPT_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_CD, AVG(t_kc24.OVE_PAY) FROM fgwyjzb JOIN t_kc24 ON fgwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINI...
css
CREATE TABLE table_name_72 ( active_service VARCHAR, reason_for_termination VARCHAR, senior_status VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which active services years ended in death and had senior status in 1972 2005?
SELECT active_service FROM table_name_72 WHERE reason_for_termination = "death" AND senior_status = "1972–2005"
sql_create_context
CREATE TABLE table_13741 ( "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 average total for countries with under 3 golds and 0 silvers?
SELECT AVG("Total") FROM table_13741 WHERE "Gold" < '3' AND "Silver" < '0'
wikisql
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 patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '008-24610') AND NOT patient.admissionheight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) = '2105-05' ORDER BY patient.unitadmittime DESC LIMIT ...
eicu
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varcha...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'DALLAS' AND ground_service.city_code = city.city_code
atis
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CRE...
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-116961')) AND treatment.treatmentname = 'agent specific thera...
eicu
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_labitems ( row_id number, itemid...
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'albumin, urine') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 94757) AND STRFTIME('%y-%m', labevents.charttime) >= '2104-03'
mimic_iii
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 Team_Name, All_Games_Percent FROM basketball_match ORDER BY Team_Name DESC
nvbench
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate ti...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7698 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND charteve...
mimic_iii
CREATE TABLE regions ( region_id number, region_name text ) CREATE TABLE job_history ( employee_id number, start_date time, end_date time, job_id text, department_id number ) CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TAB...
SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10
spider
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CRE...
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-34260' AND patient.hospitaldischargetime IS NULL))
eicu
CREATE TABLE table_name_66 ( rank VARCHAR, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What rank goes to a total of 92.7?
SELECT rank FROM table_name_66 WHERE total = 92.7
sql_create_context
CREATE TABLE table_37622 ( "Game #" real, "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Visitor has a Game # larger than 62, and a Date of february 25?
SELECT "Visitor" FROM table_37622 WHERE "Game #" > '62' AND "Date" = 'february 25'
wikisql
CREATE TABLE table_20095300_1 ( number INTEGER, trainer VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the number of the horse whose trainer is Kim Bailey?
SELECT MAX(number) FROM table_20095300_1 WHERE trainer = "Kim Bailey"
sql_create_context
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 medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-27397' AND patient.hospitaldischargetime IS NULL)) AND medicati...
eicu
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Pleural effusion NOS"
mimicsql_data
CREATE TABLE table_204_735 ( id number, "rank" number, "team" text, "names" text, "time" text, "qualification" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which country 's team ranked first ?
SELECT "team" FROM table_204_735 WHERE "rank" = 1
squall
CREATE TABLE Plays_Games ( StuID INTEGER, GameID INTEGER, Hours_Played INTEGER ) CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Ma...
SELECT AVG(Age), MAX(Age) FROM Student GROUP BY Major
nvbench
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 demographic.gender FROM demographic WHERE demographic.subject_id = "76446"
mimicsql_data
CREATE TABLE table_name_67 ( score VARCHAR, date VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score of the game home team gillingham played on 23 january 1982?
SELECT score FROM table_name_67 WHERE date = "23 january 1982" AND home_team = "gillingham"
sql_create_context
CREATE TABLE Accounts ( customer_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the customer id and number of accounts with most accounts.
SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text,...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'syringe (neonatal) *d5w*' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-4 year'))
mimic_iii
CREATE TABLE table_204_651 ( id number, "date" text, "championship" text, "location" text, "category" text, "surface" text, "prev. result" text, "prev. points" number, "new points" number, "outcome" text ) -- Using valid SQLite, answer the following questions for the tables pro...
SELECT COUNT(*) FROM table_204_651 WHERE "surface" = 'hard'
squall
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-24513')) AND DATETIME(microlab.culturetakentime, 'start of ye...
eicu
CREATE TABLE table_79071 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the Total of australia and a To par smaller than 7?
SELECT MIN("Total") FROM table_79071 WHERE "Country" = 'australia' AND "To par" < '7'
wikisql
CREATE TABLE table_2472711_31 ( team VARCHAR, up_down VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team has an up/down of + 3479?
SELECT team FROM table_2472711_31 WHERE up_down = "+ 3479"
sql_create_context
CREATE TABLE table_name_42 ( class VARCHAR, identifier VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Class has the Identifier fo CBFX-FM-2?
SELECT class FROM table_name_42 WHERE identifier = "cbfx-fm-2"
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT COUNT(DISTINCT t1.subject_id) 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 WHERE d_icd_procedures.short_title = 'parent infu...
mimic_iii
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Has_Allergy ( StuID INTEGE...
SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY AllergyType
nvbench
CREATE TABLE table_name_68 ( title VARCHAR, audience VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which title had an audience of 4.629.000?
SELECT title FROM table_name_68 WHERE audience = "4.629.000"
sql_create_context
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
SELECT P.Id AS "post_link", P.Score FROM Posts AS P WHERE (P.PostTypeId = 1 AND P.Score < 0 AND P.Tags LIKE '%homework%' AND P.ClosedDate IS NULL) ORDER BY P.Score
sede
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 name, number FROM course WHERE department = 'SOC' AND credits = 18
advising
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.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb 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 = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJ...
css
CREATE TABLE table_7926 ( "Tournament" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text ) -- Using vali...
SELECT "2009" FROM table_7926 WHERE "2011" = '1r' AND "2007" = 'a'
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 PER_EXP FROM t_kc24 WHERE MED_CLINIC_ID = '41549647267'
css
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT ACC_Regular_Season, All_Games_Percent FROM basketball_match ORDER BY All_Games_Percent DESC
nvbench
CREATE TABLE table_68882 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of the game when the record was 63-59 and the attendance was larger...
SELECT "Score" FROM table_68882 WHERE "Attendance" > '32,027' AND "Record" = '63-59'
wikisql
CREATE TABLE table_15621965_16 ( no INTEGER, school_club_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of the player who attended Delta State?
SELECT MAX(no) FROM table_15621965_16 WHERE school_club_team = "Delta State"
sql_create_context
CREATE TABLE table_name_93 ( english_translation VARCHAR, simplified_chinese VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the English translation of ?
SELECT english_translation FROM table_name_93 WHERE simplified_chinese = "山鬼"
sql_create_context
CREATE TABLE table_name_46 ( run_4 VARCHAR, athletes VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Run 4 has Athletes of hubert stevens & curtis stevens?
SELECT run_4 FROM table_name_46 WHERE athletes = "hubert stevens & curtis stevens"
sql_create_context
CREATE TABLE table_51782 ( "Name" text, "Years" text, "Area" text, "Authority" text, "Decile" real, "Roll" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Can you tell me the Name that has the Roll larger than 419?
SELECT "Name" FROM table_51782 WHERE "Roll" > '419'
wikisql
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text,...
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LAS VEGAS' AND NOT fare.round_trip_cost IS NULL AND flight_fare.fare_i...
atis
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 real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
SELECT Name, Height FROM people ORDER BY Name
nvbench
CREATE TABLE table_name_88 ( entrant VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the entrant when the chassis is ferrari 125?
SELECT entrant FROM table_name_88 WHERE chassis = "ferrari 125"
sql_create_context
CREATE TABLE table_70899 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which is the highest total at rank 6, bronze 2, and gold larger than 0?
SELECT MAX("Total") FROM table_70899 WHERE "Rank" = '6' AND "Bronze" = '2' AND "Gold" > '0'
wikisql
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, ...
SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'US'
atis
CREATE TABLE table_51943 ( "Name" text, "Street address" text, "Years as tallest" text, "Height ft (m)" text, "Floors" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the street address for the Prudential Tower building?
SELECT "Street address" FROM table_51943 WHERE "Name" = 'prudential tower'
wikisql
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 real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
SELECT Sex, COUNT(Sex) FROM people GROUP BY Sex
nvbench
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 SUM(t_kc24.MED_AMOUT), SUM(t_kc24.OVE_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 = '0036659' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2006-05-11' AND '2014-02-03'
css
CREATE TABLE table_name_30 ( name VARCHAR, episode_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which contestant was associated with episode 34?
SELECT name FROM table_name_30 WHERE episode_number = "episode 34"
sql_create_context
CREATE TABLE table_37777 ( "Date" text, "City" text, "Opponent" text, "Results\u00b9" text, "Type of game" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What type of game had a 0:0 result?
SELECT "Type of game" FROM table_37777 WHERE "Results\u00b9" = '0:0'
wikisql