instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation ORDER BY Affiliation
nvbench
CREATE TABLE table_2817196_1 ( season VARCHAR, goals_against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What sesaon(s) did they have 254 goals against?
SELECT season FROM table_2817196_1 WHERE goals_against = 254
sql_create_context
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE comment_instructor ( instructor_id int...
SELECT DISTINCT advisory_requirement, enforced_requirement, name FROM course WHERE department = 'EECS' AND number = 402
advising
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 person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) 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 mzjzjlb.JZZDSM = '抽动秽语综合征' GROUP BY person_info.JGDM
css
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'fiber-optic bronchoscopy')) GROUP BY cost.hadm_id) AS t1
mimic_iii
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiod...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute pyelonephritis')
eicu
CREATE TABLE table_33646 ( "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 name of the home team that played at...
SELECT "Home team" FROM table_33646 WHERE "Crowd" > '7,000' AND "Venue" = 'brunswick street oval'
wikisql
CREATE TABLE table_name_42 ( artist VARCHAR, issue VARCHAR, spoofed_title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the artist for Spoofed title Genteel Ben in an issue later than 74?
SELECT artist FROM table_name_42 WHERE issue > 74 AND spoofed_title = "genteel ben"
sql_create_context
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE table_name_44 ( hometown VARCHAR, number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the hometown of number 40?
SELECT hometown FROM table_name_44 WHERE number = 40
sql_create_context
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_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY ACC_Road DESC
nvbench
CREATE TABLE invoices ( billing_country VARCHAR, total INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.
SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8
sql_create_context
CREATE TABLE table_55649 ( "Player" text, "Rec." real, "Yards" real, "Avg." real, "TD's" real, "Long" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the least yards when the average is 7 and the long is less than 7?
SELECT MIN("Yards") FROM table_55649 WHERE "Avg." = '7' AND "Long" < '7'
wikisql
CREATE TABLE district ( district_id number, district_name text, headquartered_city text, city_population number, city_area number ) CREATE TABLE store_district ( store_id number, district_id number ) CREATE TABLE store ( store_id number, store_name text, type text, area_siz...
SELECT product FROM product WHERE max_page_size = "A4" AND pages_per_minute_color < 5
spider
CREATE TABLE table_name_90 ( race VARCHAR, circuit VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What race contains the Monaco circuit?
SELECT race FROM table_name_90 WHERE circuit = "monaco"
sql_create_context
CREATE TABLE table_name_32 ( competition VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which competition has aik club?
SELECT competition FROM table_name_32 WHERE club = "aik"
sql_create_context
CREATE TABLE table_1355 ( "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. -- Name th...
SELECT "Team" FROM table_1355 WHERE "Date" = 'November 9'
wikisql
CREATE TABLE table_name_3 ( rank VARCHAR, goals VARCHAR, matches VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Rank with 100 goals, and less than 300 matches?
SELECT COUNT(rank) FROM table_name_3 WHERE goals = 100 AND matches < 300
sql_create_context
CREATE TABLE table_1342013_9 ( party VARCHAR, candidates VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many party with candidates being charles edward bennett (d) unopposed
SELECT COUNT(party) FROM table_1342013_9 WHERE candidates = "Charles Edward Bennett (D) Unopposed"
sql_create_context
CREATE TABLE table_name_70 ( tournament VARCHAR, winning_score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Tournament when the winning score was 65-67-68-67=267?
SELECT tournament FROM table_name_70 WHERE winning_score = 65 - 67 - 68 - 67 = 267
sql_create_context
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, Team_ID FROM basketball_match ORDER BY ACC_Regular_Season
nvbench
CREATE TABLE table_1341672_6 ( result VARCHAR, candidates VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times did an election feature the result robert l. leggett (d) 50.2% albert dehr (r) 49.8%?
SELECT COUNT(result) FROM table_1341672_6 WHERE candidates = "Robert L. Leggett (D) 50.2% Albert Dehr (R) 49.8%"
sql_create_context
CREATE TABLE table_2655016_4 ( original_air_date VARCHAR, season__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date did season 12 premiere?
SELECT original_air_date FROM table_2655016_4 WHERE season__number = 12
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
SELECT jyjgzbb.JYZBLSH 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 AND jybgb.YLJGDM = ...
css
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE hz_info_mzjzjlb ( JZLSH number, ...
SELECT mzjzjlb.JZZDBM, mzjzjlb.JZZDSM FROM mzjzjlb WHERE mzjzjlb.JZLSH = '50289027885'
css
CREATE TABLE Plays_games ( Stuid VARCHAR, hours_played INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show all student ids and the number of hours played.
SELECT Stuid, SUM(hours_played) FROM Plays_games GROUP BY Stuid
sql_create_context
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Tracy Farmer"
mimicsql_data
CREATE TABLE table_204_843 ( id number, "volume" number, "year" text, "names" text, "articles" number, "pages" number, "images" number, "maps" number, "number of copies" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many fewer...
SELECT ABS((SELECT "maps" FROM table_204_843 WHERE "year" = 1986) - (SELECT "maps" FROM table_204_843 WHERE "year" = 1983))
squall
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 76886 AND DATETIME(admissions.dischtime) <= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY admissions.dischtime DESC LIMIT 1
mimic_iii
CREATE TABLE table_32021 ( "Week #" real, "Finalists" text, "Status" text, "Eliminated" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the status of eliminated of anton dela paz
SELECT "Status" FROM table_32021 WHERE "Eliminated" = 'anton dela paz'
wikisql
CREATE TABLE table_28035004_1 ( variant VARCHAR, bodybuilder VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different variants are there for Northern Counties bodybuilder?
SELECT COUNT(variant) FROM table_28035004_1 WHERE bodybuilder = "Northern Counties"
sql_create_context
CREATE TABLE table_name_72 ( score VARCHAR, money___$__ VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score of player darren clarke, who has $112,500?
SELECT score FROM table_name_72 WHERE money___$__ = "112,500" AND player = "darren clarke"
sql_create_context
CREATE TABLE table_13959 ( "Name" text, "Games" text, "A-League" text, "Finals" text, "Clean Sheets" real, "Saves" real, "Years" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the A-league with 39 saves?
SELECT "A-League" FROM table_13959 WHERE "Saves" = '39'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "BOWEL OBSTRUCTION" AND demographic.age >= "71"
mimicsql_data
CREATE TABLE table_42299 ( "Office" text, "Democratic ticket" text, "Republican ticket" text, "American Labor ticket" text, "Socialist ticket" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who's the Republican ticket with a Socialist ticket of fran...
SELECT "Republican ticket" FROM table_42299 WHERE "Socialist ticket" = 'frank r. crosswaith'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, sh...
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 = 1912 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chartevents...
mimic_iii
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'AT...
atis
CREATE TABLE table_32943 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance on week 7?
SELECT "Attendance" FROM table_32943 WHERE "Week" = '7'
wikisql
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimme...
SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200
nvbench
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 demographic.admission_type, demographic.diagnosis FROM demographic WHERE demographic.name = "James Sloan"
mimicsql_data
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalpe...
SELECT MAX(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-38131') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) >= '2105' GROUP BY STRFTIME('%y-%m', patient.unitadm...
eicu
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 All_Home, AVG(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY AVG(School_ID)
nvbench
CREATE TABLE table_45746 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What day was the visitor Cleveland when the record was 34-26...
SELECT "Date" FROM table_45746 WHERE "Visitor" = 'cleveland' AND "Record" = '34-26'
wikisql
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 MED_ORG_DEPT_CD, MED_ORG_DEPT_NM FROM t_kc22 WHERE STA_DATE BETWEEN '2010-04-17' AND '2017-08-10' AND MED_INV_ITEM_TYPE = '手术费' GROUP BY MED_ORG_DEPT_CD ORDER BY COUNT(*) LIMIT 6
css
CREATE TABLE table_name_86 ( year VARCHAR, result VARCHAR, champions VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Year of the game with Result of 4 3 and Champions of Daegu Tongyang Orions?
SELECT year FROM table_name_86 WHERE result = "4–3" AND champions = "daegu tongyang orions"
sql_create_context
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 employees ( EMPLOYEE_ID decimal(6,0),...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_name_41 ( school VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What school is in 36 Jackson?
SELECT school FROM table_name_41 WHERE county = "36 jackson"
sql_create_context
CREATE TABLE table_37548 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was the date of an event at Tokyo venue?
SELECT "Date" FROM table_37548 WHERE "Venue" = 'tokyo'
wikisql
CREATE TABLE table_66473 ( "Rank:" real, "State:" text, "Premier:" text, "Party:" text, "Assumed office:" text, "Left office:" text, "TOTAL Time in office:" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What average rank of the premier has ...
SELECT AVG("Rank:") FROM table_66473 WHERE "State:" = 'nsw' AND "Party:" = 'liberalism' AND "Assumed office:" = '22 march 1877'
wikisql
CREATE TABLE enroll ( class_code text, stu_num number, enroll_grade text ) CREATE TABLE course ( crs_code text, dept_code text, crs_description text, crs_credit number ) CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_add...
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_train_200 ( "id" int, "gender" string, "fasting_triglycerides" int, "fasting_plasma_glucose" int, "smoking" bool, "body_mass_index_bmi" float, "age" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- fastin...
SELECT * FROM table_train_200 WHERE fasting_plasma_glucose < 240
criteria2sql
CREATE TABLE table_19764939_1 ( rank INTEGER, total VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least rank for 2
SELECT MIN(rank) FROM table_19764939_1 WHERE total = 2
sql_create_context
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 demographic.diagnosis, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2110"
mimicsql_data
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE labevents ( row_id number, sub...
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1784)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'drain out #2 jp lat...
mimic_iii
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospit...
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-12480') AND treatment.treatme...
eicu
CREATE TABLE table_name_31 ( hometown VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the hometown of the player from Indonesia?
SELECT hometown FROM table_name_31 WHERE country = "indonesia"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-32921')) AND lab.labname = 'protein c' AND DATETIME(lab.labresulttime, 'start of yea...
eicu
CREATE TABLE table_158088_2 ( production_code VARCHAR, written_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the production code for the episode written by Drew Z. Greenberg?
SELECT production_code FROM table_158088_2 WHERE written_by = "Drew Z. Greenberg"
sql_create_context
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
SELECT DEPARTMENT_NAME, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY DEPARTMENT_NAME
nvbench
CREATE TABLE table_name_83 ( grid VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Driver Kimi R ikk nen's number on the grid?
SELECT grid FROM table_name_83 WHERE driver = "kimi räikkönen"
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_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '7434409' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_NM UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.OUT_DIAG_DIS_NM, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '7434409' GROUP BY gyb.MED_ORG_DEPT_NM, gyb....
css
CREATE TABLE table_name_41 ( winner_or_2nd VARCHAR, weight VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the the name of the winner or 2nd with a weight more than 7.3, and the result was ?
SELECT winner_or_2nd FROM table_name_41 WHERE weight > 7.3 AND result = "–"
sql_create_context
CREATE TABLE table_24964 ( "No." real, "Season" text, "Championship" real, "No. of teams" real, "Start (reg. season)" text, "Finish (incl. championship)" text, "Top record" text, "National Champion" text ) -- Using valid SQLite, answer the following questions for the tables provided ab...
SELECT "Season" FROM table_24964 WHERE "Finish (incl. championship)" = 'April 18'
wikisql
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 patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'leukocytosis - neutrophilia' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2104')
eicu
CREATE TABLE table_34254 ( "Venue" text, "Home" text, "Guest" text, "Score (first match)" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the home team for the match at Stadion pod Vrmcem?
SELECT "Home" FROM table_34254 WHERE "Venue" = 'stadion pod vrmcem'
wikisql
CREATE TABLE table_73797 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "F.L." real, "Podiums" real, "Points" real, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the mos...
SELECT MAX("Poles") FROM table_73797
wikisql
CREATE TABLE table_name_30 ( moroccan_population VARCHAR, name VARCHAR, population__2004_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number for the Moroccan population when the name is Sebt Saiss and the 2004 population is more than 11212...
SELECT COUNT(moroccan_population) FROM table_name_30 WHERE name = "sebt saiss" AND population__2004_ > 11212
sql_create_context
CREATE TABLE table_69398 ( "Riding" text, "Candidate's Name" text, "Gender" text, "Residence" text, "Occupation" text, "Votes" real, "Rank" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the candidate from happy valley-go...
SELECT "Candidate's Name" FROM table_69398 WHERE "Gender" = 'm' AND "Residence" = 'happy valley-goose bay'
wikisql
CREATE TABLE routes ( rid number, dst_apid number, dst_ap text, src_apid number, src_ap text, alid number, airline text, codeshare text ) CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, active text ) CREATE ...
SELECT COUNT(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States')
spider
CREATE TABLE table_name_42 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 1994 value with a 2r in 1996, A in 1993, and 2r in 1991?
SELECT 1994 FROM table_name_42 WHERE 1996 = "2r" AND 1993 = "a" AND 1991 = "2r"
sql_create_context
CREATE TABLE table_61525 ( "Quarterback" text, "Games" real, "Teams" text, "Wins" real, "Losses" real, "Percent" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the average wins when percent is more than 0.4 and teams is chargers~?
SELECT AVG("Wins") FROM table_61525 WHERE "Percent" > '0.4' AND "Teams" = 'chargers~'
wikisql
CREATE TABLE table_63140 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws P.K. Wins / P.K. Losses" text, "Losses" real, "Scored" real, "Conceded" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How man...
SELECT SUM("Position") FROM table_63140 WHERE "Played" < '12'
wikisql
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE pap...
SELECT DISTINCT paper.paperid FROM author, paper, writes WHERE author.authorname = 'mirella lapata' AND paper.year = 2016 AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
scholar
CREATE TABLE table_12044 ( "Year" real, "Film name" text, "Music director" text, "Lyricist" text, "Language" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What 1979 Hindi film had Ravindra Jain directing music?
SELECT "Film name" FROM table_12044 WHERE "Language" = 'hindi' AND "Lyricist" = 'ravindra jain' AND "Music director" = 'ravindra jain' AND "Year" = '1979'
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 demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Form cutan ileoureterost"
mimicsql_data
CREATE TABLE table_48316 ( "Date" text, "Title" text, "Peak position" real, "Weeks" text, "Sales" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Peak Position on July 11, 2001?
SELECT "Peak position" FROM table_48316 WHERE "Date" = 'july 11, 2001'
wikisql
CREATE TABLE customers ( customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text ...
SELECT date_of_birth FROM staff WHERE first_name = "Janessa" AND last_name = "Sawayn"
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 SUM(t_kc22.AMOUNT) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '杨芳洁' AND gwyjzb.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2000-11-30' AND '2008-07-05' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' UNION SELECT SUM(t_kc22.AMOUNT) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb...
css
CREATE TABLE table_56562 ( "Team #1" text, "Agg." text, "Team #2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the 2nd leg for alemannia aachen
SELECT "2nd leg" FROM table_56562 WHERE "Team #1" = 'alemannia aachen'
wikisql
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, basePrice INTEGER, decor TEXT ) CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adul...
SELECT bedType, COUNT(*) FROM Rooms GROUP BY bedType ORDER BY bedType
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id ...
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 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 AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND hz_info_mzjzjlb.JZLSH = mzjzjl...
css
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
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 = "Radical neck dissection, unilateral" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '姜新蕾' AND hz_info.YLJGDM = '4680590' AND zyjzjlb.CYKSMC LIKE '%免疫病%'
css
CREATE TABLE table_53079 ( "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. -- How many people were in the crowd when the away ...
SELECT SUM("Crowd") FROM table_53079 WHERE "Away team" = 'north melbourne'
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Form cutan ileoureterost"
mimicsql_data
CREATE TABLE table_1341586_19 ( result VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the result with district being louisiana 2
SELECT result FROM table_1341586_19 WHERE district = "Louisiana 2"
sql_create_context
CREATE TABLE procedures_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, ...
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 = 20165) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.item...
mimic_iii
CREATE TABLE table_52209 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Events" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank for the player with 5 wins and under 32 events?
SELECT SUM("Rank") FROM table_52209 WHERE "Wins" = '5' AND "Events" < '32'
wikisql
CREATE TABLE table_31310 ( "Date" text, "Competition" text, "Location" text, "Home Team" text, "Result" text, "Away Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who were the away teams when the competition was the 1st republic of srpska ...
SELECT "Away Team" FROM table_31310 WHERE "Competition" = '1st ``Republic of Srpska Football Day``' AND "Home Team" = 'U 14 Republic of Srpska'
wikisql
CREATE TABLE table_name_35 ( region VARCHAR, vehicles__1209_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What region has 57 vehicles?
SELECT region FROM table_name_35 WHERE vehicles__1209_ = 57
sql_create_context
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE aircraft (...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND CITY_2.cit...
atis
CREATE TABLE table_name_54 ( recopa_1994 VARCHAR, supercopa_1994 VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Recopa 1994 has a Supercopa 1994 of 1st round, and a Team of argentinos juniors?
SELECT recopa_1994 FROM table_name_54 WHERE supercopa_1994 = "1st round" AND team = "argentinos juniors"
sql_create_context
CREATE TABLE table_name_52 ( games VARCHAR, pen_min VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many games were played by the player who had 22 penalty minutes?
SELECT games FROM table_name_52 WHERE pen_min = "22"
sql_create_context
CREATE TABLE table_49212 ( "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 i...
SELECT "High points" FROM table_49212 WHERE "High rebounds" = 'ron artest (9)'
wikisql
CREATE TABLE table_name_7 ( rank INTEGER, period VARCHAR, games VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank for the period of 1973 89, with less than 423 games.
SELECT SUM(rank) FROM table_name_7 WHERE period = "1973–89" AND games < 423
sql_create_context
CREATE TABLE table_43199 ( "Year" real, "Winner" text, "Jockey" text, "Trainer" text, "Owner" text, "Distance (Miles)" text, "Time" text, "Purse" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Purse for Owner Harold A. Allen...
SELECT "Purse" FROM table_43199 WHERE "Year" < '2009' AND "Owner" = 'harold a. allen'
wikisql
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, U...
SELECT DISTINCT (u.Id) AS "user_link" FROM Users AS u INNER JOIN Badges AS gb ON gb.UserId = u.Id AND gb.Class = 1 LEFT JOIN Badges AS sb ON sb.UserId = u.Id AND sb.Class = 2 WHERE sb.Id IS NULL
sede
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 LAST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID
nvbench