instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT 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 table_58589 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What time did the ferrari car that finished 62 laps have?
SELECT "Time/Retired" FROM table_58589 WHERE "Laps" < '62' AND "Constructor" = 'ferrari'
wikisql
CREATE TABLE table_20540 ( "Species" text, "Indole" text, "Methyl Red" text, "Voges-Proskauer" text, "Citrate" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result for salmonella spp. if you use citrate?
SELECT COUNT("Citrate") FROM table_20540 WHERE "Species" = 'Salmonella spp.'
wikisql
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) 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 TAB...
SELECT DISTINCT fare.fare_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 = AIRPORT_SERVICE_1.city_code AND CITY_1.ci...
atis
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE l...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
eicu
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_re...
SELECT DISTINCT airline.airline_code FROM airline, 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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_na...
atis
CREATE TABLE table_12399 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score when the to par was 5, for Peter Jacobsen?
SELECT SUM("Score") FROM table_12399 WHERE "To par" = '–5' AND "Player" = 'peter jacobsen'
wikisql
CREATE TABLE table_name_48 ( attendance INTEGER, week VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the lowest attendance for week 1?
SELECT MIN(attendance) FROM table_name_48 WHERE week = 1
sql_create_context
CREATE TABLE table_58258 ( "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. -- Which team is Lake Oval home to?
SELECT "Home team" FROM table_58258 WHERE "Venue" = 'lake oval'
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 diagnoses.short_title, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Roxanna Weaver"
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Skin disorders NEC" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE table_52201 ( "Rank" real, "Name" text, "Team" text, "Games" real, "Rebounds" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many rebounds occurred in a rank 4 game?
SELECT "Rebounds" FROM table_52201 WHERE "Rank" = '4'
wikisql
CREATE TABLE table_204_614 ( id number, "date announced" text, "plant name" text, "location" text, "date of closing" text, "products" text, "employees" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the top company that has the mos...
SELECT "plant name" FROM table_204_614 ORDER BY "employees" DESC LIMIT 1
squall
CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE writes ( paperid int, aut...
SELECT DISTINCT COUNT(DISTINCT writes.paperid) FROM author, writes WHERE author.authorname = 'james fogarty' AND writes.authorid = author.authorid
scholar
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 = '6969950' AND t_kc21.IN_HOSP_DATE BETWEEN '2010-12-11' AND '2012-10-29' AND t_kc21.CLINIC_TYPE = '门诊'
css
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, ...
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f > 85 ORDER BY COUNT(date)
nvbench
CREATE TABLE table_74163 ( "Warrior" text, "Close ranged weapons" text, "Mid ranged weapons" text, "Long ranged weapons" text, "Armor" text, "Special weapon" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If the special weapon is the Grenado, wh...
SELECT "Armor" FROM table_74163 WHERE "Special weapon" = 'Grenado'
wikisql
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB ...
css
CREATE TABLE table_name_34 ( record VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which record happened on the date of May 7?
SELECT record FROM table_name_34 WHERE date = "may 7"
sql_create_context
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, Rejection...
SELECT Users.DisplayName, Users.Id, sub.totalVotes, Users.WebsiteUrl FROM (SELECT Users.Id, Tags.TagName, COUNT(*) AS totalVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND Votes.VoteTypeId = 2 INNER JOIN ...
sede
CREATE TABLE table_5837 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent that also has a save of Smith (26)?
SELECT "Opponent" FROM table_5837 WHERE "Save" = 'smith (26)'
wikisql
CREATE TABLE table_32863 ( "Club" text, "Played" real, "Lost" real, "Drawn" real, "Against" real, "Diff." real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the maximum number of draws when the diff is smaller than 186, po...
SELECT MAX("Drawn") FROM table_32863 WHERE "Diff." < '186' AND "Points" < '12' AND "Played" < '6'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID)
nvbench
CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE aircraft ( ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER'...
atis
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 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '孔诗蕊' AND t_kc22.STA_DATE BETWEEN '2020-11-19' AND '2021-05-01' AND t_kc22.SELF_PAY_AMO > 411.49
css
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( uniquepid text, ...
SELECT DISTINCT patient.gender FROM patient WHERE patient.uniquepid = '027-94756'
eicu
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, ...
SELECT COUNT(*) = 0 FROM course, program_course WHERE course.credits <> 15 AND course.department = 'EECS' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id
advising
CREATE TABLE table_name_67 ( year INTEGER, rider VARCHAR, final_position___giro VARCHAR, final_position___tour VARCHAR, final_position___vuelta VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the earliest year of Valdimir Poelnikov, who ha...
SELECT MIN(year) FROM table_name_67 WHERE final_position___tour > 72 AND final_position___vuelta < 77 AND final_position___giro < 57 AND rider = "valdimir poelnikov"
sql_create_context
CREATE TABLE table_32281 ( "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. -- Who was the home team when Footscray was the awa...
SELECT "Home team" FROM table_32281 WHERE "Away team" = 'footscray'
wikisql
CREATE TABLE table_name_98 ( date VARCHAR, winning_score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Date has a Winning score of 15 (71-69-68-65=273)?
SELECT date FROM table_name_98 WHERE winning_score = −15(71 - 69 - 68 - 65 = 273)
sql_create_context
CREATE TABLE table_19011 ( "Rank" real, "Airport" text, "Total Passengers" real, "% Change 2008/2009" text, "International Passengers" real, "Domestic Passengers" real, "Transit Passengers" real, "Aircraft Movements" real, "Freight ( Metric Tonnes )" real ) -- Using valid SQLite, a...
SELECT "Rank" FROM table_19011 WHERE "Freight ( Metric Tonnes )" = '255121'
wikisql
CREATE TABLE table_name_44 ( events VARCHAR, top_25 INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of events with a top-25 less than 0?
SELECT COUNT(events) FROM table_name_44 WHERE top_25 < 0
sql_create_context
CREATE TABLE table_79285 ( "TV Station (Operator)" text, "2005" real, "2006" real, "2007" real, "2008" real, "2009" real, "2010" real, "2011 1H" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many 2011 1H values have a 2006 of 27.4 a...
SELECT COUNT("2011 1H") FROM table_79285 WHERE "2006" = '27.4' AND "2007" > '27.7'
wikisql
CREATE TABLE table_name_33 ( total INTEGER, name VARCHAR, vuelta VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total for miguel indur in with a Vuelta larger than 1?
SELECT MIN(total) FROM table_name_33 WHERE name = "miguel induráin" AND vuelta > 1
sql_create_context
CREATE TABLE table_17323092_5 ( team VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Whic teams scored l 97 107 (ot)
SELECT team FROM table_17323092_5 WHERE score = "L 97–107 (OT)"
sql_create_context
CREATE TABLE table_36029 ( "Team" text, "Location" text, "Venue" text, "Capacity" real, "Position in 2001" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the venue of belshina
SELECT "Venue" FROM table_36029 WHERE "Team" = 'belshina'
wikisql
CREATE TABLE table_49731 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team (League)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player has fewer than 3 rounds and the position of (g)?
SELECT "Player" FROM table_49731 WHERE "Round" < '3' AND "Position" = '(g)'
wikisql
CREATE TABLE table_12995531_3 ( total_viewers INTEGER, date_of_first_broadcast VARCHAR, episode_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the total viewers where the date of first broadcast is 28 january 2010 and the episode number is...
SELECT MIN(total_viewers) FROM table_12995531_3 WHERE date_of_first_broadcast = "28 January 2010" AND episode_number = 1
sql_create_context
CREATE TABLE table_54645 ( "Event" text, "Data" text, "Athlete" text, "Date" text, "Place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What day did Chris Maddocks compete in the 35000 m?
SELECT "Date" FROM table_54645 WHERE "Athlete" = 'chris maddocks' AND "Event" = '35000 m'
wikisql
CREATE TABLE table_78780 ( "Edition" text, "Date" text, "Winner" text, "Country" text, "Time ( h : m : s )" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the winner of the 23rd Edition?
SELECT "Winner" FROM table_78780 WHERE "Edition" = '23rd'
wikisql
CREATE TABLE table_71127 ( "Year" real, "Entrant" text, "Class" text, "Chassis" text, "Engine" text, "Tyres" text, "Rank" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Chassis ranked 18th?
SELECT "Chassis" FROM table_71127 WHERE "Rank" = '18th'
wikisql
CREATE TABLE Trained_In ( Physician INTEGER, Treatment INTEGER, CertificationDate DATETIME, CertificationExpires DATETIME ) CREATE TABLE Affiliated_With ( Physician INTEGER, Department INTEGER, PrimaryAffiliation BOOLEAN ) CREATE TABLE Room ( RoomNumber INTEGER, RoomType VARCHAR(30...
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN GROUP BY Name
nvbench
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 t_kc24.t_kc21_IN_DIAG_DIS_CD, t_kc24.t_kc21_IN_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '王志尚' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 5598.78)
css
CREATE TABLE table_7967 ( "Player" text, "League" real, "Scottish Cup" real, "League Cup" real, "Challenge Cup" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum for the Scottish cup that has player Damon Gray, and mor...
SELECT SUM("Scottish Cup") FROM table_7967 WHERE "Player" = 'damon gray' AND "League" > '1'
wikisql
CREATE TABLE mzjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
SELECT zyjybgb.BBCJBW FROM hz_info JOIN mzjzjlb JOIN zyjybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '60960957' AND zyjybgb.BGRQ BETWEEN '2014-02-27' AND '2014-...
css
CREATE TABLE table_73145 ( "Tournament" text, "Also currently known as" text, "City" text, "Country" text, "Court surface" text, "Defending champion" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What tournament is in katowice?
SELECT "Tournament" FROM table_73145 WHERE "City" = 'Katowice'
wikisql
CREATE TABLE table_name_37 ( driver VARCHAR, season VARCHAR, tuner VARCHAR, governing_body VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the driver in season 2003 with a tuner of N. Leelakrishnan and a Mai governing body?
SELECT driver FROM table_name_37 WHERE tuner = "n. leelakrishnan" AND governing_body = "mai" AND season = 2003
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Long-term (current) use of anticoagulants" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE chartevent...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.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 = 'pros rep atrial def-opn') AND DATETIME(procedures_ic...
mimic_iii
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(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND DATETIME(patient.hospitaldischargetime) <= DATETIME(CURRENT_TIME(), '-4 year')
eicu
CREATE TABLE table_name_44 ( home_team VARCHAR, tie_no VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Home Team, when Tie No is Replay, and when Attendance is 2,048?
SELECT home_team FROM table_name_44 WHERE tie_no = "replay" AND attendance = "2,048"
sql_create_context
CREATE TABLE table_28688 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many differe...
SELECT COUNT("Production code") FROM table_28688 WHERE "U.S. viewers (millions)" = '4.69'
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_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '6085358' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY SUM(t_kc22.AMOUNT) DESC LIMIT 12 UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM fgwyjzb JOIN t_k...
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "MIDA100" AND lab.fluid = "Joint Fluid"
mimicsql_data
CREATE TABLE table_12113888_1 ( built VARCHAR, name_as_rebuilt VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the built data for Knocklayd rebuild?
SELECT built FROM table_12113888_1 WHERE name_as_rebuilt = "Knocklayd"
sql_create_context
CREATE TABLE address ( district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which districts have at least two addresses?
SELECT district FROM address GROUP BY district HAVING COUNT(*) >= 2
sql_create_context
CREATE TABLE table_73247 ( "Barangay" text, "Population (2004)" real, "Population (2010)" real, "Area (km 2 )" text, "District" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the area where barangay is guadalupe viejo?
SELECT "Area (km 2 )" FROM table_73247 WHERE "Barangay" = 'Guadalupe Viejo'
wikisql
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, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road
nvbench
CREATE TABLE table_38001 ( "Date" text, "Round" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real, "Scorers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which round has the scorer of Di Matteo?
SELECT "Round" FROM table_38001 WHERE "Scorers" = 'di matteo'
wikisql
CREATE TABLE table_name_28 ( language VARCHAR, network VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Language for Network PTC Punjabi?
SELECT language FROM table_name_28 WHERE network = "ptc punjabi"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Dementia in conditions classified elsewhere without behavioral disturbance" AND lab.fluid = "Blood"
mimicsql_data
CREATE TABLE table_name_52 ( time_elapsed VARCHAR, launched VARCHAR, closest_approach VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Time elapsed has both the Launched of 15 October 1997 and the Closest approach of 24 June 1999?
SELECT time_elapsed FROM table_name_52 WHERE launched = "15 october 1997" AND closest_approach = "24 june 1999"
sql_create_context
CREATE TABLE person_info_hz_info ( RYBH text, KH number, KLX number, YLJGDM number ) CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text ) CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLS...
SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info JOIN person_info 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 = jyjgzbb.YLJGDM AND jybgb....
css
CREATE TABLE table_name_88 ( record VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record of the game that went 3-5?
SELECT record FROM table_name_88 WHERE score = "3-5"
sql_create_context
CREATE TABLE Documents ( Document_ID INTEGER, Document_Type_Code CHAR(15), Project_ID INTEGER, Document_Date DATETIME, Document_Name VARCHAR(255), Document_Description VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255)...
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code ORDER BY Budget_Type_Code DESC
nvbench
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 flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 20 AND date_day.month_number = 1...
atis
CREATE TABLE table_name_52 ( points INTEGER, games VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest value for Points, when Games is 21, and when Rank is greater than 2?
SELECT MAX(points) FROM table_name_52 WHERE games = 21 AND rank > 2
sql_create_context
CREATE TABLE table_1900 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" text, "Water (sqmi)" text, "Latitude" text, "Longitude" text, "GEO ID" real, "ANSI code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Nam...
SELECT MIN("ANSI code") FROM table_1900 WHERE "Pop. (2010)" = '609'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT lab.label, lab.fluid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Shawn Green"
mimicsql_data
CREATE TABLE table_name_63 ( formula VARCHAR, refractive_index_es__5893nm VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which formula has a refractive index 589.3 at 1.97?
SELECT formula FROM table_name_63 WHERE refractive_index_es__5893nm = "1.97"
sql_create_context
CREATE TABLE table_16710971_2 ( result VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the 1978 Atlanta Falcons season when the record was 1-2?
SELECT result FROM table_16710971_2 WHERE record = "1-2"
sql_create_context
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM txmzjzjlb JOIN jybgb JOIN jyjgzbb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE txmzjzjlb.JZZDSM = '阿尔茨海默病' AND jyjgzbb.JCZBDM = '273122' UNION SELECT jyjgzbb.CKZFWXX...
css
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
SELECT zyjzjlb.JZLSH 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 NOT zyjzjlb.JZLSH IN (SELECT JZLSH FROM jybgb WHERE BGRQ >= '2014-04-18')
css
CREATE TABLE publication_keyword ( kid int, pid int ) CREATE TABLE conference ( cid int, homepage varchar, name varchar ) CREATE TABLE publication ( abstract varchar, cid int, citation_num int, jid int, pid int, reference_num int, title varchar, year int ) CREATE T...
SELECT publication.title FROM author, publication, writes WHERE author.name = 'H. V. Jagadish' AND publication.year > 2000 AND writes.aid = author.aid AND writes.pid = publication.pid
academic
CREATE TABLE table_name_33 ( failures INTEGER, orbital_regime VARCHAR, launches VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total failures of heliocentric orbit orbital regimes and launches less than 1?
SELECT SUM(failures) FROM table_name_33 WHERE orbital_regime = "heliocentric orbit" AND launches < 1
sql_create_context
CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER, Customer_Policy_ID INTEGER ) CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Da...
SELECT Date_Payment_Made, SUM(Amount_Payment) FROM Payments GROUP BY Date_Payment_Made ORDER BY Date_Payment_Made
nvbench
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 People_ID, Weight FROM people GROUP BY Sex
nvbench
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTask...
SELECT Posts.OwnerUserId FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id GROUP BY OwnerUserId HAVING COUNT(ParentId) = 1
sede
CREATE TABLE phone ( Company_name text, Hardware_Model_name text, Accreditation_type text, Accreditation_level text, Date text, chip_model text, screen_mode text ) CREATE TABLE chip_model ( Model_name text, Launch_year real, RAM_MiB real, ROM_MiB real, Slots text, Wi...
SELECT Company_name, COUNT(Company_name) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32 GROUP BY Company_name ORDER BY Company_name
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 SUM(QTY), SUM(AMOUNT) FROM t_kc22 WHERE SOC_SRT_DIRE_CD = '006165' AND STA_DATE BETWEEN '2007-12-29' AND '2012-08-02'
css
CREATE TABLE table_22330 ( "Serial No." real, "District" text, "Headquartered City" text, "City Population (2009)" real, "City Area(km 2 )" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest city area?
SELECT MIN("City Area(km 2 )") FROM table_22330
wikisql
CREATE TABLE table_77253 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the winning score when the tournament is safeco classic?
SELECT "Winning score" FROM table_77253 WHERE "Tournament" = 'safeco classic'
wikisql
CREATE TABLE table_203_855 ( id number, "date" text, "city" text, "venue" text, "member" text, "performance" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- were the matinee and evening performances held earlier than the 8th ann...
SELECT (SELECT "date" FROM table_203_855 WHERE "notes" = 'matinee and evening performances') > (SELECT "date" FROM table_203_855 WHERE "notes" = '8th anniversary')
squall
CREATE TABLE table_name_76 ( lost INTEGER, position VARCHAR, drawn VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Lost has a Position of 3, and a Drawn larger than 3?
SELECT SUM(lost) FROM table_name_76 WHERE position = 3 AND drawn > 3
sql_create_context
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'oth intraop mag res imag') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64292) AND STRFTIME('%...
mimic_iii
CREATE TABLE table_51099 ( "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. -- Who ha...
SELECT "High rebounds" FROM table_51099 WHERE "Date" = 'january 3'
wikisql
CREATE TABLE table_39154 ( "Game" real, "October" real, "Opponent" text, "Score" text, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many games have Points smaller than 4, and an October smaller than 5?
SELECT COUNT("Game") FROM table_39154 WHERE "Points" < '4' AND "October" < '5'
wikisql
CREATE TABLE customers ( id number, first_name text, last_name text, company text, address text, city text, state text, country text, postal_code text, phone text, fax text, email text, support_rep_id number ) CREATE TABLE playlists ( id number, name text ) ...
SELECT COUNT(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = "Steve" AND T1.last_name = "Johnson"
spider
CREATE TABLE zyb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
SELECT COUNT(*) FROM (SELECT qtb.MED_ORG_DEPT_CD FROM qtb WHERE qtb.MED_SER_ORG_NO = '5403493' GROUP BY qtb.MED_ORG_DEPT_CD HAVING MAX(qtb.IN_HOSP_DAYS) < 18 UNION SELECT gyb.MED_ORG_DEPT_CD FROM gyb WHERE gyb.MED_SER_ORG_NO = '5403493' GROUP BY gyb.MED_ORG_DEPT_CD HAVING MAX(gyb.IN_HOSP_DAYS) < 18 UNION SELECT zyb.MED...
css
CREATE TABLE table_name_32 ( entered_service VARCHAR, delivered_as VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Entered service date of the T413?
SELECT entered_service FROM table_name_32 WHERE delivered_as = "t413"
sql_create_context
CREATE TABLE table_40229 ( "Season" text, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "Podiums" real, "Points" real, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the points sum of the ser...
SELECT SUM("Points") FROM table_40229 WHERE "Poles" < '0'
wikisql
CREATE TABLE table_74126 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Decision" text, "Location/Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the december for record 14-17-4
SELECT "December" FROM table_74126 WHERE "Record" = '14-17-4'
wikisql
CREATE TABLE table_54507 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the average laps for jackie stewart?
SELECT AVG("Laps") FROM table_54507 WHERE "Driver" = 'jackie stewart'
wikisql
CREATE TABLE products ( code number, name text, price number, manufacturer number ) CREATE TABLE manufacturers ( code number, name text, headquarter text, founder text, revenue number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Select...
SELECT name, price FROM products
spider
CREATE TABLE table_31551 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what date was Patty Fendick an opponent?
SELECT "Date" FROM table_31551 WHERE "Opponent" = 'patty fendick'
wikisql
CREATE TABLE table_24516 ( "Regional" text, "Champions" text, "Runners-up" text, "Third place" text, "Fourth place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who got the first place when the Japanese Regional Leagues was in hokushinetsu?
SELECT "Champions" FROM table_24516 WHERE "Regional" = 'Hokushinetsu'
wikisql
CREATE TABLE table_10135 ( "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 away team score when Home team is fi...
SELECT "Away team score" FROM table_10135 WHERE "Home team" = 'fitzroy'
wikisql
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 Team_Name, School_ID FROM basketball_match ORDER BY Team_Name DESC
nvbench
CREATE TABLE table_57755 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Visitor with a Score with 4 3?
SELECT "Visitor" FROM table_57755 WHERE "Score" = '4 – 3'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
nvbench