instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_22727 ( "Name" text, "Population (2011)" real, "Population (2006)" real, "Change (%)" text, "Land area (km\u00b2)" text, "Population density (per km\u00b2)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When beauval is the na...
SELECT MIN("Population (2011)") FROM table_22727 WHERE "Name" = 'Beauval'
wikisql
CREATE TABLE roller_coaster ( roller_coaster_id number, name text, park text, country_id number, length number, height number, speed text, opened text, status text ) CREATE TABLE country ( country_id number, name text, population number, area number, languages te...
SELECT park FROM roller_coaster ORDER BY speed DESC LIMIT 1
spider
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) ...
SELECT MIN(vitalperiodic.heartrate) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-34108')) AND NOT vitalperiodic.heartrate IS NULL...
eicu
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
SELECT COUNT(*) FROM medication WHERE medication.drugname = 'metoprolol tartrate 25 mg tab' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-4 year')
eicu
CREATE TABLE table_16572 ( "Character" text, "Portrayed by" text, "First appearance" text, "Last appearance" text, "Duration" text, "Episodes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which actors first appeared in episode 'Blink' 1, 2, 3?...
SELECT "Portrayed by" FROM table_16572 WHERE "First appearance" = 'Blink" 1, 2, 3'
wikisql
CREATE TABLE table_name_3 ( date VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Date has a Venue of bucharest?
SELECT date FROM table_name_3 WHERE venue = "bucharest"
sql_create_context
CREATE TABLE authorship ( authid VARCHAR, paperid VARCHAR ) CREATE TABLE papers ( paperid VARCHAR ) CREATE TABLE authors ( lname VARCHAR, fname VARCHAR, authid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the last name of the auth...
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname, t1.lname ORDER BY COUNT(*) DESC LIMIT 1
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DEAD/EXPIRED" AND procedures.short_title = "Contrast aortogram"
mimicsql_data
CREATE TABLE table_75461 ( "Date" text, "Venue" text, "Opponents" text, "Score" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Venue has a Competition of pl group b, and a Score of 2-2?
SELECT "Venue" FROM table_75461 WHERE "Competition" = 'pl group b' AND "Score" = '2-2'
wikisql
CREATE TABLE table_name_83 ( grid VARCHAR, time VARCHAR, laps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many grids were there races with more than 10 laps and a time of +34.121?
SELECT COUNT(grid) FROM table_name_83 WHERE time = "+34.121" AND laps > 10
sql_create_context
CREATE TABLE table_34026 ( "Site" text, "Bebo" real, "Facebook" real, "Friendster" real, "LinkedIn" real, "MySpace" real, "Ning" real, "Orkut" real, "Plaxo" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many linkedin have Facebo...
SELECT COUNT("LinkedIn") FROM table_34026 WHERE "Site" = 'facebook' AND "MySpace" < '64'
wikisql
CREATE TABLE table_name_22 ( attendance INTEGER, date VARCHAR, report VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total attendance with a Report of sd.hr, and a Score of 3 1, and a Date of 14 apr 2001?
SELECT SUM(attendance) FROM table_name_22 WHERE report = "sd.hr" AND score = "3–1" AND date = "14 apr 2001"
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_CD, qtb.IN_DIAG_DIS_CD, MIN(t_kc24.ILL_PAY) FROM qtb JOIN t_kc24 ON qtb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '5569109' GROUP BY qtb.MED_ORG_DEPT_CD, qtb.IN_DIAG_DIS_CD UNION SELECT gyb.MED_ORG_DEPT_CD, gyb.IN_DIAG_DIS_CD, MIN(t_kc24.ILL_PAY) FROM gyb JOIN t_kc24 ON gyb...
css
CREATE TABLE table_50492 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When Hawthorn is the away team, what is their s...
SELECT "Away team score" FROM table_50492 WHERE "Away team" = 'hawthorn'
wikisql
CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, active text ) CREATE TABLE airports ( apid number, name text, city text, country text, x number, y number, elevation number, iata text, icao text ) CREATE ...
SELECT name FROM airports WHERE city = 'Goroka'
spider
CREATE TABLE staff ( staff_id number, staff_details text ) CREATE TABLE claim_headers ( claim_header_id number, claim_status_code text, claim_type_code text, policy_id number, date_of_claim time, date_of_settlement time, amount_claimed number, amount_piad number ) CREATE TABLE ...
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING COUNT(*) > 2
spider
CREATE TABLE table_name_84 ( disposals VARCHAR, marks VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of disposals when marks is 134?
SELECT disposals FROM table_name_84 WHERE marks = "134"
sql_create_context
CREATE TABLE table_60242 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest to par for Bob Charles?
SELECT MIN("To par") FROM table_60242 WHERE "Player" = 'bob charles'
wikisql
CREATE TABLE table_37353 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" real, "Class" text, "FCC info" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Call sign for the ERP W 19?
SELECT "Call sign" FROM table_37353 WHERE "ERP W" = '19'
wikisql
CREATE TABLE broadcast_share ( Channel_ID int, Program_ID int, Date text, Share_in_percent real ) CREATE TABLE broadcast ( Channel_ID int, Program_ID int, Time_of_day text ) CREATE TABLE program ( Program_ID int, Name text, Origin text, Launch real, Owner text ) CREATE...
SELECT Time_of_day, COUNT(*) FROM broadcast GROUP BY Time_of_day
nvbench
CREATE TABLE table_175442_1 ( common_name VARCHAR, scientific_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the common name for rhampholeon spectrum
SELECT common_name FROM table_175442_1 WHERE scientific_name = "Rhampholeon spectrum"
sql_create_context
CREATE TABLE table_name_10 ( date VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the date of the game when North Melbourne was the away team?
SELECT date FROM table_name_10 WHERE away_team = "north melbourne"
sql_create_context
CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CR...
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time > 1200 AND flight.to_airport = AIRPORT_SERVICE_...
atis
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, d...
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mcv') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SE...
mimic_iii
CREATE TABLE table_6263 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most top-5 for wins less than 0 and events less than 16
SELECT MAX("Top-5") FROM table_6263 WHERE "Events" < '16' AND "Wins" < '0'
wikisql
CREATE TABLE table_name_22 ( laps INTEGER, time_retired VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want the lowest Laps for time/retired of engine and driver of charles de tornaco
SELECT MIN(laps) FROM table_name_22 WHERE time_retired = "engine" AND driver = "charles de tornaco"
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.BGDH 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_MZJZJLB WHERE person_info...
css
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) 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 ...
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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS...
atis
CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE T...
SELECT DISTINCT FLIGHT_0.arrival_time, FLIGHT_0.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight AS FLIGHT_0, flight AS FLIGHT_1, flight_leg WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CIT...
atis
CREATE TABLE table_23030 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the viewers f...
SELECT "U.S. viewers (millions)" FROM table_23030 WHERE "Directed by" = 'Tony Phelan'
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 Team_Name, ACC_Percent FROM basketball_match ORDER BY Team_Name
nvbench
CREATE TABLE table_name_50 ( area VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What area is named Mackenzie college?
SELECT area FROM table_name_50 WHERE name = "mackenzie college"
sql_create_context
CREATE TABLE table_2886617_6 ( nationality VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What nationality was peter slamiar?
SELECT nationality FROM table_2886617_6 WHERE player = "Peter Slamiar"
sql_create_context
CREATE TABLE table_30975 ( "Season no." real, "Series no." 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. ...
SELECT MIN("Season no.") FROM table_30975 WHERE "U.S. viewers (millions)" = '3.91'
wikisql
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 WHERE demographic.insurance = "Medicare" AND demographic.dob_year < "2182"
mimicsql_data
CREATE TABLE table_24231638_3 ( team VARCHAR, position_in_table VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the team for the position in table 19th?
SELECT team FROM table_24231638_3 WHERE position_in_table = "19th"
sql_create_context
CREATE TABLE climber ( Points INTEGER, Country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the maximum point for climbers whose country is United Kingdom?
SELECT MAX(Points) FROM climber WHERE Country = "United Kingdom"
sql_create_context
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 sqlite_sequence ( name text, seq tex...
SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5
spider
CREATE TABLE table_6741 ( "Buechel & Manhart spelling (pronunciation)" text, "Ullrich" text, "Brandon University" text, "Deloria & Boas" text, "Dakota Mission" text, "Rood & Taylor" text, "Riggs" text, "Williamson" text, "University of Minnesota" text, "White Hat" text ) -- Usi...
SELECT "University of Minnesota" FROM table_6741 WHERE "Rood & Taylor" = 'o' AND "Buechel & Manhart spelling (pronunciation)" = 'o'
wikisql
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 jyjgzbb.BGDH FROM hz_info JOIN mzjzjlb JOIN jyjgzbb ON 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_MZJZJLB WHERE hz_info.RYBH = '10580420' AND NOT jyjgzbb.BGDH IN (SELECT jyjgzb...
css
CREATE TABLE table_74489 ( "Conference" text, "# of Bids" real, "Record" text, "Win %" real, "Regional Finals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For the Hockey East conference, what is the total number of win percentages when there are ...
SELECT COUNT("Win %") FROM table_74489 WHERE "Conference" = 'hockey east' AND "# of Bids" < '4'
wikisql
CREATE TABLE table_31374 ( "Country with flag" text, "Area (km\u00b2)" real, "Population (1 July 2005 est.)" real, "Population density (per km\u00b2)" text, "Capital" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is every entry for area if cap...
SELECT "Area (km\u00b2)" FROM table_31374 WHERE "Capital" = 'Port-au-Prince'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT demographic.diagnosis FROM demographic WHERE demographic.name = "Kelly Gallardo"
mimicsql_data
CREATE TABLE table_26268 ( "Local Government Area" text, "Type" text, "Major Town" text, "Land Area (km\u00b2)" text, "Pop. 2006" real, "Density km \u22122" real, "Towns" real, "Est." real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What t...
SELECT "Type" FROM table_26268 WHERE "Local Government Area" = 'Yalata'
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 CIVIL_SUBSIDY FROM t_kc24 WHERE MED_CLINIC_ID = '05137841004'
css
CREATE TABLE table_name_41 ( game_4 VARCHAR, game_3 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For which Game 4, did David Boyle play in Game 3?
SELECT game_4 FROM table_name_41 WHERE game_3 = "david boyle"
sql_create_context
CREATE TABLE tracks ( id INTEGER, name VARCHAR(200), album_id INTEGER, media_type_id INTEGER, genre_id INTEGER, composer VARCHAR(220), milliseconds INTEGER, bytes INTEGER, unit_price NUMERIC(10,2) ) CREATE TABLE artists ( id INTEGER, name VARCHAR(120) ) CREATE TABLE genres ...
SELECT name, COUNT(name) FROM playlists GROUP BY name ORDER BY name DESC
nvbench
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId n...
SELECT DATEADD(week, DATEDIFF(day, '20000109', CreationDate) / 7, '20000109') AS "week", Tags.TagName, COUNT(DISTINCT Posts.Id) AS Posts, SUM(Posts.AnswerCount) AS Answers, SUM(Posts.CommentCount) AS Comments FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE ...
sede
CREATE TABLE musical ( musical_id number, name text, year number, award text, category text, nominee text, result text ) CREATE TABLE actor ( actor_id number, name text, musical_id number, character text, duration text, age number ) -- Using valid SQLite, answer th...
SELECT duration FROM actor ORDER BY age DESC LIMIT 1
spider
CREATE TABLE claims_processing_stages ( claim_stage_id number, next_claim_stage_id number, claim_status_name text, claim_status_description text ) CREATE TABLE claims_documents ( claim_id number, document_type_code text, created_by_staff_id number, created_date number ) CREATE TABLE po...
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT MIN(amount_piad) FROM claim_headers)
spider
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '73598639069'
css
CREATE TABLE table_name_62 ( commander VARCHAR, ship VARCHAR, complement VARCHAR, guns VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which commander received complement larger than 240 , guns of 66 and ship of revolutie?
SELECT commander FROM table_name_62 WHERE complement > 240 AND guns = "66" AND ship = "revolutie"
sql_create_context
CREATE TABLE table_204_277 ( id number, "region" text, "country" text, "location" text, "size (m)" text, "payload (metric tonnes)" text, "degrees of freedom" number, "x horiz disp (mm)" number, "y horiz disp (mm)" number, "z vert disp (mm)" number, "x horiz vel (mm/s)" number...
SELECT "region" FROM table_204_277 GROUP BY "region" ORDER BY COUNT(*) LIMIT 1
squall
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-199074' AND patient.hos...
eicu
CREATE TABLE table_name_39 ( constructor VARCHAR, time_retired VARCHAR, grid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want the constructor for brakes and grid less than 14
SELECT constructor FROM table_name_39 WHERE time_retired = "brakes" AND grid < 14
sql_create_context
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 COUNT(*) FROM t_kc22 WHERE MED_ORG_DEPT_NM = '泌尿外科' AND STA_DATE BETWEEN '2001-06-06' AND '2021-04-09' AND SOC_SRT_DIRE_NM = '甜梦口服液'
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 city, COUNT(*) FROM station GROUP BY city
nvbench
CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar ) CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE geographic ( city_name varchar, county varchar, reg...
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'san francisco' AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating = (SELECT MAX(RESTAURANTalias1.rating) FROM location AS LOCATIONalias1, restaurant AS RESTAURANTalias1 W...
restaurants
CREATE TABLE table_29604 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "First Star" text, "Decision" text, "Location" text, "Attendance" real, "Record" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Wh...
SELECT "Decision" FROM table_29604 WHERE "First Star" = 'V. Lecavalier'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE patients ( ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.dischtime IS NULL AND admissions.age BETWEEN 50 AND 59
mimic_iii
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-38992')) AND vitalperiodic.respiration > 19.0 AND NOT vitalperio...
eicu
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 mzjzjlb.JZZDBM, mzjzjlb.JZZDSM FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.person_info_XM = '韩嘉容'
css
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Subjects ( subject_id INTEGER, subje...
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion) DESC
nvbench
CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) 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 Lives_in ( stuid INTEGER, ...
SELECT Sex, COUNT(*) FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_name_72 ( venue VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where did South Melbourne play as the home team?
SELECT venue FROM table_name_72 WHERE home_team = "south melbourne"
sql_create_context
CREATE TABLE table_58136 ( "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 smallest crowd when the away team sc...
SELECT MIN("Crowd") FROM table_58136 WHERE "Away team score" = '10.18 (78)'
wikisql
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) DESC
nvbench
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, 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 = 'OAKLAND...
atis
CREATE TABLE table_32624 ( "Stage" text, "Date" text, "Route" text, "Terrain" text, "Length" text, "Winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the winner of stage 12?
SELECT "Winner" FROM table_32624 WHERE "Stage" = '12'
wikisql
CREATE TABLE table_26565917_2 ( title VARCHAR, no_in_season VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the name of episode 5?
SELECT title FROM table_26565917_2 WHERE no_in_season = 5
sql_create_context
CREATE TABLE table_7948 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponents in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Score, when Date is May 7, 2006?
SELECT "Score" FROM table_7948 WHERE "Date" = 'may 7, 2006'
wikisql
CREATE TABLE table_1140080_2 ( report VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the report with location sterreichring
SELECT report FROM table_1140080_2 WHERE location = "Österreichring"
sql_create_context
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABL...
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'glucose') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age =...
mimic_iii
CREATE TABLE table_204_604 ( id number, "year" number, "date" text, "driver" text, "team" text, "manufacturer" text, "race distance\nlaps" number, "race distance\nmiles (km)" text, "race time" text, "average speed\n(mph)" number, "report" text ) -- Using valid SQLite, answe...
SELECT "race distance\nlaps" FROM table_204_604 WHERE "driver" = 'tony stewart'
squall
CREATE TABLE table_77058 ( "Name" text, "Gain" real, "Loss" real, "Long" real, "Avg/G" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Avg/G has a Name of david allen, and a Gain larger than 371?
SELECT AVG("Avg/G") FROM table_77058 WHERE "Name" = 'david allen' AND "Gain" > '371'
wikisql
CREATE TABLE table_2234 ( "Pos" text, "No" text, "Driver" text, "Constructor" text, "Part 1" text, "Part 2" text, "Part 3" text, "Grid" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the time in part 3 when Nick Heidfeld was the...
SELECT "Part 3" FROM table_2234 WHERE "Driver" = 'Nick Heidfeld'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, val...
SELECT chartevents.charttime 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 = 5142)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial ...
mimic_iii
CREATE TABLE table_name_24 ( opponent VARCHAR, round VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Opponent with a Round with 3, and a Venue of home?
SELECT opponent FROM table_name_24 WHERE round = "3" AND venue = "home"
sql_create_context
CREATE TABLE table_26745426_2 ( Ends VARCHAR, stolen_ends VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the number of ends lost for 6 stolen ends
SELECT COUNT(Ends) AS lost FROM table_26745426_2 WHERE stolen_ends = 6
sql_create_context
CREATE TABLE table_44397 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date was Bury the home team?
SELECT "Date" FROM table_44397 WHERE "Away team" = 'bury'
wikisql
CREATE TABLE table_name_75 ( flattening_ratio VARCHAR, equatorial_diameter VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Flattening ratio associated with the Equatorial diameter of 120,536km?
SELECT flattening_ratio FROM table_name_75 WHERE equatorial_diameter = "120,536km"
sql_create_context
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 MED_CLINIC_ID FROM t_kc21 WHERE PERSON_ID = '83841154' AND MED_SER_ORG_NO = '4429415' AND NOT IN_DIAG_DIS_NM LIKE '%鼻炎%'
css
CREATE TABLE Organisation_Types ( organisation_type VARCHAR(10), organisation_type_description VARCHAR(255) ) CREATE TABLE Project_Staff ( staff_id DOUBLE, project_id INTEGER, role_code VARCHAR(10), date_from DATETIME, date_to DATETIME, other_details VARCHAR(255) ) CREATE TABLE Researc...
SELECT outcome_description, COUNT(outcome_description) FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code GROUP BY outcome_description ORDER BY outcome_description
nvbench
CREATE TABLE table_name_65 ( season INTEGER, wins VARCHAR, podiums VARCHAR, races VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the newest Season in which had 0 Podiums, and having 1 total of Races, as well as total wins larger than 0?
SELECT MAX(season) FROM table_name_65 WHERE podiums = 0 AND races = 1 AND wins > 0
sql_create_context
CREATE TABLE table_203_854 ( id number, "position" number, "driver" text, "no." text, "car" text, "entrant" text, "rd 1" number, "rd 2" number, "rd 3" number, "rd 4" number, "rd 5" number, "rd 6" number, "rd 7" number, "rd 8" number, "total" number ) -- Usin...
SELECT "driver" FROM table_203_854 WHERE "total" < (SELECT "total" FROM table_203_854 WHERE "driver" = 'max twigg') ORDER BY "total" DESC LIMIT 1
squall
CREATE TABLE table_name_40 ( elevation__ft_ INTEGER, elevation__m_ VARCHAR, type VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Type of stratovolcano, and a Name of goat rocks, and a Elevation (m) larger than 2,494 has what highest elev...
SELECT MAX(elevation__ft_) FROM table_name_40 WHERE type = "stratovolcano" AND name = "goat rocks" AND elevation__m_ > 2 OFFSET 494
sql_create_context
CREATE TABLE table_12298 ( "Main contestant" text, "Co-contestant (Yaar vs. Pyaar)" text, "Date performed" text, "Scores by each individual judge" text, "Total score/week" text, "Position" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided a...
SELECT "Scores by each individual judge" FROM table_12298 WHERE "Status" = 'current' AND "Co-contestant (Yaar vs. Pyaar)" = 'krushna abhishek'
wikisql
CREATE TABLE table_18015 ( "Name" text, "GP" real, "Solo" real, "Ast" real, "Total" real, "TFL-Yds" text, "No-Yds" text, "BrUp" real, "QBH" real, "No.-Yds" text, "Avg" text, "TD" real, "Long" real, "Rcv-Yds" text, "FF" real, "Blkd Kick" real ) -- Using v...
SELECT "No-Yds" FROM table_18015 WHERE "Ast" = '8'
wikisql
CREATE TABLE festival_detail ( Festival_ID int, Festival_Name text, Chair_Name text, Location text, Year int, Num_of_Audience int ) CREATE TABLE artwork ( Artwork_ID int, Type text, Name text ) CREATE TABLE nomination ( Artwork_ID int, Festival_ID int, Result text ) -...
SELECT Type, COUNT(*) FROM artwork GROUP BY Type ORDER BY COUNT(*)
nvbench
CREATE TABLE table_1918 ( "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 "Land ( sqmi )" FROM table_1918 WHERE "GEO ID" = '3807717980'
wikisql
CREATE TABLE table_35342 ( "Designation" text, "Bore" text, "Weight" text, "Service Charge" text, "Range (yards)" text, "Number Made" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the service chage of the boat howitzers with a 12-pdr li...
SELECT "Service Charge" FROM table_35342 WHERE "Designation" = '12-pdr light'
wikisql
CREATE TABLE table_name_17 ( assists INTEGER, name VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest number of assists for Ben Duggan with less than 7 points?
SELECT MIN(assists) FROM table_name_17 WHERE name = "ben duggan" AND points < 7
sql_create_context
CREATE TABLE table_28719193_19 ( city VARCHAR, stadium VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the city whose stadium is Gerald J. Ford Stadium?
SELECT city FROM table_28719193_19 WHERE stadium = "Gerald J. Ford stadium"
sql_create_context
CREATE TABLE table_26702204_1 ( production_code VARCHAR, us_viewers__million_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the production code when the u.s. viewers (million) is 11.76?
SELECT production_code FROM table_26702204_1 WHERE us_viewers__million_ = "11.76"
sql_create_context
CREATE TABLE table_39233 ( "Nation" text, "T Score" real, "A Score" real, "E Score" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total of the team with a T score greater than 8 and an E score less than 8.4?
SELECT SUM("Total") FROM table_39233 WHERE "T Score" > '8' AND "E Score" < '8.4'
wikisql
CREATE TABLE route ( train_id int, station_id int ) CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TA...
SELECT name, COUNT(name) FROM train GROUP BY name
nvbench
CREATE TABLE table_train_142 ( "id" int, "allergy_to_monoclonal_antibodies" bool, "allergic_reactions" bool, "allergy_to_methylprednisolone" bool, "mini_mental_state_examination_mmse" int, "depressed_mood" bool, "urea_cycle_disorder" bool, "clinical_contraindication_use_valproate" bool, ...
SELECT * FROM table_train_142 WHERE alzheimer_disease_ad = 1 AND (mini_mental_state_examination_mmse >= 18 AND mini_mental_state_examination_mmse <= 26)
criteria2sql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ...
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19352) AND STRFTIME('%y', diagnoses_icd.charttime) >= '2102'
mimic_iii
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZ...
css
CREATE TABLE table_13998897_1 ( height_m___ft__ VARCHAR, notes VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many height m ( ft ) with notes being via wccv; formerly w236aj
SELECT COUNT(height_m___ft__) FROM table_13998897_1 WHERE notes = "via WCCV; formerly W236AJ"
sql_create_context