instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 zyjzjlb.ZYZDBM, zyjzjlb.ZYZDMC 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 = '尤慧捷'
css
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-32248') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) = '2105' GROUP BY STRFTIME('%y-%m', patient.unitadmi...
eicu
CREATE TABLE table_53990 ( "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the air date for the episode with production code ad1c13?
SELECT "Original air date" FROM table_53990 WHERE "Production code" = 'ad1c13'
wikisql
CREATE TABLE table_42702 ( "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many golds have a silver greater than 1, vietnam as the nation, with a bronze less than 3?
SELECT COUNT("Gold") FROM table_42702 WHERE "Silver" > '1' AND "Nation" = 'vietnam' AND "Bronze" < '3'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2125" AND lab.itemid = "51265"
mimicsql_data
CREATE TABLE table_75699 ( "Ballarat FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Losses have a Ballarat FL of melton south, and an Against larger than 1468?
SELECT COUNT("Losses") FROM table_75699 WHERE "Ballarat FL" = 'melton south' AND "Against" > '1468'
wikisql
CREATE TABLE table_582 ( "No" real, "Player" text, "Height" text, "Position" text, "Year born" real, "Current Club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player number is 2.10 meters tall?
SELECT "No" FROM table_582 WHERE "Height" = '2.10'
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 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 = "Excision or destruction of other lesion or tissue of heart, endovascular approach" AND lab."CATEGORY" = "Hem...
mimicsql_data
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE...
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 (((flight.departure_time BETWEEN 1200 AND 1800) AND (flight.stops = 0)) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND fl...
atis
CREATE TABLE table_name_25 ( republican_ticket VARCHAR, democratic_ticket VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which republican ticket has stanley h. fuld as the Democratic ticket?
SELECT republican_ticket FROM table_name_25 WHERE democratic_ticket = "stanley h. fuld"
sql_create_context
CREATE TABLE table_61629 ( "Fin. Pos" real, "Car No." real, "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Laps Led" real, "Points" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average grid ...
SELECT AVG("Grid") FROM table_61629 WHERE "Driver" = 'marco andretti' AND "Fin. Pos" > '19'
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 HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(DEPARTMENT_ID)
nvbench
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM jyjgzbb WHERE jyjgzbb.jybgb_JZLSH = '18545084468' AND jyjgzbb.JCRXM LIKE '曹%'
css
CREATE TABLE table_name_4 ( opponent_in_the_final VARCHAR, surface VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Opponent of the match played on a Clay Surface with a Score of 6 0, 6 2?
SELECT opponent_in_the_final FROM table_name_4 WHERE surface = "clay" AND score = "6–0, 6–2"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
SELECT t4.diagnosisname FROM (SELECT t3.diagnosisname, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.diagnosisname, 100 - SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 10...
eicu
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number...
SELECT PostId AS "post_link", Score, 'text', CreationDate FROM Comments WHERE LOWER('text') LIKE LOWER('%http:%') ORDER BY Score DESC, CreationDate DESC LIMIT 100
sede
CREATE TABLE table_name_77 ( country VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country does Rocco Mediate play for?
SELECT country FROM table_name_77 WHERE player = "rocco mediate"
sql_create_context
CREATE TABLE table_29471472_1 ( season VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many seasons are there for the 3rd position?
SELECT COUNT(season) FROM table_29471472_1 WHERE position = "3rd"
sql_create_context
CREATE TABLE table_name_57 ( rank VARCHAR, highest_floor INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Rank of the building that has a Highest floor larger than 50?
SELECT rank FROM table_name_57 WHERE highest_floor > 50
sql_create_context
CREATE TABLE table_79389 ( "Model" text, "Years" text, "Engine code" text, "Power" text, "Torque" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What years did the sdrive16d model have a Torque of n m (lb ft)@1750-3000?
SELECT "Years" FROM table_79389 WHERE "Torque" = 'n·m (lb·ft)@1750-3000' AND "Model" = 'sdrive16d'
wikisql
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, ...
SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY AVG(meter_100)
nvbench
CREATE TABLE table_25016824_2 ( vote VARCHAR, air_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many entries are there for vote when the air date was 15 november 1997?
SELECT COUNT(vote) FROM table_25016824_2 WHERE air_date = "15 November 1997"
sql_create_context
CREATE TABLE table_name_46 ( authority VARCHAR, area VARCHAR, gender VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the authority for the coed Eastbourne school?
SELECT authority FROM table_name_46 WHERE area = "eastbourne" AND gender = "coed"
sql_create_context
CREATE TABLE gymnast ( gymnast_id number, floor_exercise_points number, pommel_horse_points number, rings_points number, vault_points number, parallel_bars_points number, horizontal_bar_points number, total_points number ) CREATE TABLE people ( people_id number, name text, a...
SELECT T2.name FROM gymnast AS T1 JOIN people AS T2 ON T1.gymnast_id = T2.people_id
spider
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimme...
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY SUM(meter_100) DESC
nvbench
CREATE TABLE table_name_86 ( date VARCHAR, number_ VARCHAR, _name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date with identifying number of No. 37817?
SELECT date FROM table_name_86 WHERE number_ & _name = "no. 37817"
sql_create_context
CREATE TABLE table_52435 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest number of silvers a team with more than 95 total medals has?
SELECT MAX("Silver") FROM table_52435 WHERE "Total" > '95'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15447) AND icustays.outtime IS NULL)...
mimic_iii
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT COUNT(t_kc21.PERSON_ID) FROM t_kc21 WHERE t_kc21.IN_DIAG_DIS_CD = 'T47.X50'
css
CREATE TABLE table_26250145_1 ( order__number VARCHAR, original_artist VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the order # for the original artist sarah mclachlan?
SELECT order__number FROM table_26250145_1 WHERE original_artist = "Sarah McLachlan"
sql_create_context
CREATE TABLE table_65733 ( "Attendance" real, "Round" text, "Date" text, "Home" text, "Score" text, "Away" text, "Venue" text, "Weekday" text, "Time of Day" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the visiting team th...
SELECT "Away" FROM table_65733 WHERE "Round" = 'round 16'
wikisql
CREATE TABLE table_13026799_3 ( starts VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of starts for 1987?
SELECT COUNT(starts) FROM table_13026799_3 WHERE year = 1987
sql_create_context
CREATE TABLE table_48325 ( "Name" text, "Party" text, "Tenure" text, "Head(s) of Government" text, "Ministerial title" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the head of government for Don Stephen Senanayake?
SELECT "Head(s) of Government" FROM table_48325 WHERE "Name" = 'don stephen senanayake'
wikisql
CREATE TABLE Products ( Product_ID VARCHAR(100), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255) ) CREATE TABLE Clients ( Client_ID INTEGER, Address_ID INTEGER, Customer_Email_Address VARCHAR(255), ...
SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description
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 MED_SER_ORG_NO FROM t_kc21 WHERE PERSON_NM = '魏星辰' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE SOC_SRT_DIRE_NM = '硫酸氢氯吡格雷片')
css
CREATE TABLE table_204_59 ( id number, "rank" number, "athlete" text, "nationality" text, "time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which country had the most finishers in the top 8 ?
SELECT "nationality" FROM table_204_59 GROUP BY "nationality" ORDER BY COUNT("athlete") DESC LIMIT 1
squall
CREATE TABLE table_16185956_1 ( incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many groups of candidates are there in there in the district where the incumbent is Doc Hastings?
SELECT COUNT(2008 AS _candidates) FROM table_16185956_1 WHERE incumbent = "Doc Hastings"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication (...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-38131...
eicu
CREATE TABLE table_name_1 ( wins INTEGER, class VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Count the average Wins which has a Class of 250cc, and a Year of 1972?
SELECT AVG(wins) FROM table_name_1 WHERE class = "250cc" AND year = 1972
sql_create_context
CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), ...
SELECT title, COUNT(title) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY title ORDER BY COUNT(title)
nvbench
CREATE TABLE table_name_37 ( fcc_info VARCHAR, frequency_mhz VARCHAR, call_sign VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the FCC info for frequency Mhz less than 97.3 and call sign of w237br
SELECT fcc_info FROM table_name_37 WHERE frequency_mhz < 97.3 AND call_sign = "w237br"
sql_create_context
CREATE TABLE table_42318 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Set 4" text, "Set 5" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Set 1 with a Set 2 that is 25-19?
SELECT "Set 1" FROM table_42318 WHERE "Set 2" = '25-19'
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 prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2175" AND lab.itemid = "50896"
mimicsql_data
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT demographic.dod FROM demographic WHERE demographic.name = "Stephanie Suchan"
mimicsql_data
CREATE TABLE table_28490 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the choice of song where the original artist was Stevie Wonder?
SELECT "Song choice" FROM table_28490 WHERE "Original artist" = 'Stevie Wonder'
wikisql
CREATE TABLE table_74663 ( "Player" text, "Tries" text, "Conv" text, "Pens" text, "Venue" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date did Josh Taumalolo play at Nuku'alofa?
SELECT "Date" FROM table_74663 WHERE "Venue" = 'nuku''alofa' AND "Player" = 'josh taumalolo'
wikisql
CREATE TABLE table_name_30 ( us_country VARCHAR, album VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What US Country released an album of singles only in 1967?
SELECT us_country FROM table_name_30 WHERE album = "singles only" AND year = 1967
sql_create_context
CREATE TABLE table_test_28 ( "id" int, "positive_shock_index" bool, "anemia" bool, "serum_potassium" float, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "malignant_hypertension" bool, "severe_hypertension" bool, "hemoglobin_a1c_hba1c" float, "...
SELECT * FROM table_test_28 WHERE renal_disease = 1 OR creatinine_clearance_cl > 2.5
criteria2sql
CREATE TABLE table_name_77 ( player VARCHAR, nationality VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the player from Sweden from a round after 3?
SELECT player FROM table_name_77 WHERE nationality = "sweden" AND round > 3
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE v...
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-15494' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
eicu
CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text ) CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, ...
SELECT County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id
nvbench
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname ...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 10 AND program_course.category LIKE 'ULCS'
advising
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.age < "20"
mimicsql_data
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 SUM(t_kc22.AMOUNT) 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_ID = '74833853' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2010-01-28' AND '2018-12-30' AND t_kc22.MED_I...
css
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 intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-52327') AND patient.unitdischargetime IS NULL) AN...
eicu
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id numb...
SELECT Id AS "post_link", LENGTH(Body) AS Length, Score, (Score / CAST(LENGTH(Body) AS FLOAT(9, 2))) AS Economy FROM Posts AS p WHERE p.OwnerUserId = '##UserId##' ORDER BY Economy DESC LIMIT 100
sede
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_DIRE_CD text, MED_DIRE_NM text,...
SELECT t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '7434409' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM
css
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_kc21.MED_ORG_DEPT_CD, t_kc21.MED_ORG_DEPT_NM FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '5802131' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2012-07-23' AND '2015-10-30' GROUP...
css
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 lab ( subject_id text, hadm_id text, ...
SELECT diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "41512"
mimicsql_data
CREATE TABLE table_55724 ( "Yard Name" text, "Location (City, State)" text, "1st Ship Delivery Date" text, "Ship Types Delivered" text, "Total Number of Ways" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What ship types were first delivered in Dec...
SELECT "Ship Types Delivered" FROM table_55724 WHERE "1st Ship Delivery Date" = 'december 1942'
wikisql
CREATE TABLE county_public_safety ( County_ID int, Name text, Population int, Police_officers int, Residents_per_officer int, Case_burden int, Crime_rate real, Police_force text, Location text ) CREATE TABLE city ( City_ID int, County_ID int, Name text, White real, ...
SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force ORDER BY Police_force DESC
nvbench
CREATE TABLE table_1337525_1 ( region_4 VARCHAR, complete_series VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the region 4 for the complete fifth series
SELECT region_4 FROM table_1337525_1 WHERE complete_series = "The Complete Fifth Series"
sql_create_context
CREATE TABLE table_45571 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent on October 28, 2001?
SELECT "Opponent" FROM table_45571 WHERE "Date" = 'october 28, 2001'
wikisql
CREATE TABLE table_6202 ( "Date" real, "Opponent" text, "Venue" text, "Result" text, "Attendance" real, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result when the attendance is 960?
SELECT "Result" FROM table_6202 WHERE "Attendance" = '960'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT mzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN mzjzjlb 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.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND ...
css
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT jyjgzbb.JCFF FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_in...
css
CREATE TABLE table_41953 ( "Tournament" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text...
SELECT "1998" FROM table_41953 WHERE "1994" = 'grand slam tournaments'
wikisql
CREATE TABLE table_name_22 ( rank INTEGER, name VARCHAR, lane VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many ranks have chen yin as the name, with a lane greater than 8?
SELECT SUM(rank) FROM table_name_22 WHERE name = "chen yin" AND lane > 8
sql_create_context
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPriv...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Age, Location, WebsiteUrl AS Wesbite, LastAccessDate AS Seen, CreationDate FROM Users WHERE Reputation >= '##MinimalReputation:int?200##' AND (UPPER(Location) LIKE UPPER('%Algeria%') OR UPPER(Location) LIKE UPPER('%Algerie%') OR ...
sede
CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE allergy_type ( allergy text, allergytype text ) CREATE TABLE has_allergy ( stuid number, allergy text ) -- Using valid SQLite...
SELECT major FROM student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE cost ( costid num...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 5
eicu
CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar ) CREATE TABLE geographic ( city_name varchar, county varchar, region varchar ) CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rati...
SELECT location.house_number, restaurant.name FROM geographic, location, restaurant WHERE geographic.region = 'bay area' AND restaurant.city_name = geographic.city_name AND restaurant.food_type = 'american' AND restaurant.id = location.restaurant_id AND restaurant.rating = (SELECT MAX(RESTAURANTalias1.rating) FROM geog...
restaurants
CREATE TABLE table_24459 ( "Country" text, "Area (km\u00b2)" text, "Population (millions, 2011)" text, "GDP (PPP) (USD, per capita)" real, "GDP (nominal) (billions USD)" text, "HDI (2011)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is t...
SELECT "HDI (2011)" FROM table_24459 WHERE "Country" = 'Tunisia'
wikisql
CREATE TABLE table_203_618 ( id number, "pick" number, "player" text, "team" text, "position" text, "school" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who is previous in the table to austin kearns ?
SELECT "player" FROM table_203_618 WHERE id = (SELECT id FROM table_203_618 WHERE "player" = 'austin kearns') - 1
squall
CREATE TABLE table_name_21 ( plant_patent_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the patent number of Fukuda?
SELECT plant_patent_number FROM table_name_21 WHERE "inventor" = "fukuda"
sql_create_context
CREATE TABLE table_23696862_6 ( name VARCHAR, wsop_cashes VARCHAR, final_place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who had 2 WSOP cashes and was 6th in final place?
SELECT name FROM table_23696862_6 WHERE wsop_cashes = 2 AND final_place = "6th"
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 jybgb.BGRGH, jybgb.BGRXM FROM jybgb WHERE jybgb.JZLSH = '46775344496' GROUP BY jybgb.BGRGH HAVING COUNT(*) > 10
css
CREATE TABLE table_9486 ( "Scientific name" text, "Common name" text, "Length (male)" text, "Length (female)" text, "Color" text, "Lifespan (years)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the length of the Panther Chameleon?
SELECT "Length (female)" FROM table_9486 WHERE "Common name" = 'panther chameleon'
wikisql
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, ...
SELECT DisplayName, COUNT(DisplayName) FROM Users GROUP BY DisplayName ORDER BY COUNT(DisplayName) DESC LIMIT 100
sede
CREATE TABLE voting_record ( stuid number, registration_date text, election_cycle text, president_vote number, vice_president_vote number, secretary_vote number, treasurer_vote number, class_president_vote number, class_senator_vote number ) CREATE TABLE student ( stuid number, ...
SELECT fname FROM student WHERE age > 22
spider
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8...
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY SCHOOL_CODE
nvbench
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8773) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 yea...
mimic_iii
CREATE TABLE table_78558 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What place did player mark brooks take?
SELECT "Place" FROM table_78558 WHERE "Player" = 'mark brooks'
wikisql
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Marta Kondratyuk%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_i...
advising
CREATE TABLE table_9358 ( "Name" text, "Pinnacle height planned" text, "Year completion expected" real, "Structure type" text, "Country" text, "Town" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the year that China will have a buildin...
SELECT "Year completion expected" FROM table_9358 WHERE "Country" = 'china'
wikisql
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 p...
SELECT COUNT(*) FROM treatment WHERE treatment.treatmentname = 'cpap/peep therapy - 10-15 cm h2o' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-6 year')
eicu
CREATE TABLE table_name_31 ( points VARCHAR, wins VARCHAR, year VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of points with year less than 1955 and rank of 5th with wins less than 0
SELECT COUNT(points) FROM table_name_31 WHERE year < 1955 AND rank = "5th" AND wins < 0
sql_create_context
CREATE TABLE table_203_28 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the last year that they received first ?
SELECT MAX("year") FROM table_203_28 WHERE "position" = 1
squall
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT demographic.diagnosis FROM demographic WHERE demographic.subject_id = "6983"
mimicsql_data
CREATE TABLE table_58530 ( "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 was the away team when the home team was Ca...
SELECT "Away team" FROM table_58530 WHERE "Home team" = 'carlton'
wikisql
CREATE TABLE table_30757 ( "No in. series" real, "No in. season" real, "Title" 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. -- What was the airdate of the episode o...
SELECT "Original air date" FROM table_30757 WHERE "Production Code" = '214'
wikisql
CREATE TABLE table_25364 ( "R" real, "Player" text, "Scottish Premier League" real, "Scottish Cup" real, "Scottish League Cup" real, "Champions League (qualifying)" real, "Europa League" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided ...
SELECT COUNT("R") FROM table_25364 WHERE "Player" = 'Josh Thompson'
wikisql
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0 INNER JOIN course_prerequisite ON COURSE_0.course_id = course_prerequisite.pre_course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.course_id INNER JOIN area ON COURSE_0.course_id = area.course_id ...
advising
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskSt...
SELECT p.Id AS "post_link", pht.Name, ph.*, pf.* FROM Posts AS p INNER JOIN PostHistory AS ph ON ph.PostId = p.Id INNER JOIN PostHistoryTypes AS pht ON ph.PostHistoryTypeId = pht.Id INNER JOIN PendingFlags AS pf ON pf.PostId = p.Id AND ph.Comment = 102
sede
CREATE TABLE table_54107 ( "End of Fiscal Year" real, "Gross Debt in $Billions undeflated Treas." real, "as % of GDP Low-High" text, "Debt Held By Public ($Billions)" real, "as % of GDP (Treas/MW, OMB or OMB/MW)" real, "GDP $Billions OMB/BEA est.=MW.com" text ) -- Using valid SQLite, answer th...
SELECT COUNT("Gross Debt in $Billions undeflated Treas.") FROM table_54107 WHERE "Debt Held By Public ($Billions)" > '236.8' AND "as % of GDP Low-High" = '33.4'
wikisql
CREATE TABLE table_name_86 ( status VARCHAR, against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Status of the 44 Against?
SELECT status FROM table_name_86 WHERE against = 44
sql_create_context
CREATE TABLE table_36846 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When is the earliest year associated with team norton and 0 wins?
SELECT MIN("Year") FROM table_36846 WHERE "Team" = 'norton' AND "Wins" < '0'
wikisql
CREATE TABLE country ( Official_native_language VARCHAR, Country_id VARCHAR ) CREATE TABLE match_season ( Country VARCHAR, College VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the official languages of the countries of players from Maryla...
SELECT T1.Official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = "Maryland" OR T2.College = "Duke"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2186.0" AND diagnoses.icd9_code = "78321"
mimicsql_data
CREATE TABLE table_35070 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Venue" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Week of 7 had what average attendance?
SELECT AVG("Attendance") FROM table_35070 WHERE "Week" = '7'
wikisql