instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT jybgb.JYXMDM, jybgb.JYXMMC FROM jybgb WHERE jybgb.BGDH = '23522676937'
css
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetake...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'wound care' AND STRFTIME('%y', treatment.treatmenttime) >= '2105') AS t1 ...
eicu
CREATE TABLE table_32358 ( "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 home team has the Brunswick Street Oval ve...
SELECT "Home team score" FROM table_32358 WHERE "Venue" = 'brunswick street oval'
wikisql
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 lab ( la...
SELECT AVG(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 = '027-185580' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospita...
eicu
CREATE TABLE table_61936 ( "Summoned" text, "Elected" text, "Assembled" text, "Dissolved" text, "1st member" text, "2nd member" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the dissolved date of the parliament assembled on 4 November 1...
SELECT "Dissolved" FROM table_61936 WHERE "2nd member" = 'unknown' AND "Assembled" = '4 november 1461'
wikisql
CREATE TABLE table_name_57 ( distance VARCHAR, athlete VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Distance, when Athlete is 'Irving Saladino'?
SELECT distance FROM table_name_57 WHERE athlete = "irving saladino"
sql_create_context
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopi...
WITH diffs AS (SELECT CAST(a.CreationDate - q.CreationDate AS FLOAT) AS d FROM Posts AS q JOIN Posts AS a ON a.Id = q.AcceptedAnswerId) SELECT ((SELECT MAX(d) FROM (SELECT PERCENT AS d FROM diffs ORDER BY d LIMIT 50) AS BottomHalf) + (SELECT MIN(d) FROM (SELECT PERCENT AS d FROM diffs ORDER BY d DESC LIMIT 50) AS TopHa...
sede
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 t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'metoprolol (lopressor) tab 25 mg' AND patient.uniquepid = '010-32430' AND STRFTIME('%y-%m', medication.drugstarttime) <= ...
eicu
CREATE TABLE table_name_64 ( place VARCHAR, money___$__ VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which ranking has money of $82 and Al Watrous as the player?
SELECT place FROM table_name_64 WHERE money___$__ = 82 AND player = "al watrous"
sql_create_context
CREATE TABLE table_name_49 ( last_issue VARCHAR, title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the last issue entry for Aron's Absurd Armada?
SELECT last_issue FROM table_name_49 WHERE title = "aron's absurd armada"
sql_create_context
CREATE TABLE table_21689 ( "Athlete" text, "Event" text, "Round of 32" text, "Round of 16" text, "Quarterfinals" text, "Semifinals" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who did Abdelhafid Benchebla face in the quarterfinals?
SELECT "Quarterfinals" FROM table_21689 WHERE "Athlete" = 'Abdelhafid Benchebla'
wikisql
CREATE TABLE table_name_16 ( attendance INTEGER, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the average attendance of a team with a 38 31 8 record?
SELECT AVG(attendance) FROM table_name_16 WHERE record = "38–31–8"
sql_create_context
CREATE TABLE table_name_72 ( home_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What home team plays at Arden Street Oval?
SELECT home_team FROM table_name_72 WHERE venue = "arden street oval"
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE mzjzjlb ( HXPLC number, HZXM ...
SELECT jybgb.JYKSBM, jybgb.JYKSMC FROM jybgb WHERE jybgb.BGDH = '58304822879'
css
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "COPD EXACERBATION"
mimicsql_data
CREATE TABLE table_7551 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Points with an against of 20 ...
SELECT MIN("Points") FROM table_7551 WHERE "Against" = '20' AND "Lost" < '1'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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,...
SELECT * FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.zyjzjlb...
css
CREATE TABLE table_71653 ( "Island" text, "Location" text, "Area ( ha )" real, "Population" real, "Height (m)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest population of Trondra Island in the Scalloway Islands?
SELECT MAX("Population") FROM table_71653 WHERE "Location" = 'scalloway islands' AND "Island" = 'trondra'
wikisql
CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_las...
SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rdw') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5395) AND STRFTIME('%y-%m', labevents.charttime) <= '2105-09'
mimic_iii
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 microbiolo...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 80555) AND prescriptions.drug IN ('magnesium sulfate', 'hydralazine', 'ns') AND STRFTIME('%y-%m', prescriptions.startdate) = '2105-12'
mimic_iii
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text,...
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 59275) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) <= '2102' ORDER BY transfers.intime LIMIT 1
mimic_iii
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTy...
WITH questions AS (SELECT p1.OwnerUserId AS question_userid, p2.OwnerUserId AS answer_userid, p1.Id FROM Posts AS p1 INNER JOIN Posts AS p2 ON p1.AcceptedAnswerId = p2.Id) SELECT q1.question_userid AS userid1, q1.answer_userid AS userid2, q1.Id, q2.Id FROM questions AS q1 INNER JOIN questions AS q2 ON q1.question_useri...
sede
CREATE TABLE table_33032 ( "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. -- In which venue did the away team score 9.11 (65)...
SELECT "Venue" FROM table_33032 WHERE "Away team score" = '9.11 (65)'
wikisql
CREATE TABLE table_203_531 ( id number, "date" text, "tournament" text, "location" text, "winner" text, "score" text, "1st prize ($)" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which tournament had a prize no less than $ 1,100,000 ?
SELECT "tournament" FROM table_203_531 WHERE "1st prize ($)" >= 1100000
squall
CREATE TABLE invoices ( invoice_number number, invoice_date time, invoice_details text ) CREATE TABLE orders ( order_id number, customer_id number, order_status text, date_order_placed time, order_details text ) CREATE TABLE order_items ( order_item_id number, product_id number...
SELECT order_id FROM shipments WHERE shipment_tracking_number = "3452"
spider
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'insulin-regular (human) *unit* inj')
eicu
CREATE TABLE table_name_28 ( crowd VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the listed crowd at junction oval?
SELECT crowd FROM table_name_28 WHERE venue = "junction oval"
sql_create_context
CREATE TABLE table_test_17 ( "id" int, "anemia" bool, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "active_infection" bool, "fever" bool, "bradycardia" int, "renal_disease" bool, "oliguria" bool, "creatinine_clearance_cl" float, "left_vent...
SELECT * FROM table_test_17 WHERE oxygen_saturation < 91
criteria2sql
CREATE TABLE table_33797 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who did the Browns play on October 13, 1968?
SELECT "Opponent" FROM table_33797 WHERE "Date" = 'october 13, 1968'
wikisql
CREATE TABLE table_name_64 ( constructor VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the constructor for zolder
SELECT constructor FROM table_name_64 WHERE location = "zolder"
sql_create_context
CREATE TABLE table_204_275 ( id number, "date" text, "city" text, "opponent" text, "results" text, "scorers" text, "type of game" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the total number of friendly 's played ?
SELECT COUNT(*) FROM table_204_275 WHERE "type of game" = 'friendly'
squall
CREATE TABLE table_23288 ( "Draw" real, "Artist" text, "Song" text, "Jury votes" real, "Televotes" real, "Total votes" real, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many televotes are there for 'Lujuria'?
SELECT "Televotes" FROM table_23288 WHERE "Song" = 'Lujuria'
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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "LONG TERM CARE HOSPITAL" AND diagnoses.short_title = "Neuropathy in diabetes"
mimicsql_data
CREATE TABLE table_name_68 ( region VARCHAR, format VARCHAR, catalog VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the region for Catalog amlh 66078 in stereo lp format?
SELECT region FROM table_name_68 WHERE format = "stereo lp" AND catalog = "amlh 66078"
sql_create_context
CREATE TABLE table_name_47 ( runs VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the Runs which has Venue of adelaide oval , adelaide?
SELECT runs FROM table_name_47 WHERE venue = "adelaide oval , adelaide"
sql_create_context
CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Plays_Games ( S...
SELECT AVG(Age), MIN(Age) FROM Student GROUP BY Major
nvbench
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19428)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht'...
mimic_iii
CREATE TABLE table_204_455 ( id number, "rd." number, "grand prix" text, "date" text, "location" text, "pole position" text, "fastest lap" text, "winning driver" text, "constructor" text, "report" text ) -- Using valid SQLite, answer the following questions for the tables provi...
SELECT COUNT(*) FROM table_204_455 WHERE "fastest lap" = 'alain prost'
squall
CREATE TABLE table_101336_1 ( crystal_structure VARCHAR, formula VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the crystal structure for the formula yba 2 cu 3 o 7?
SELECT crystal_structure FROM table_101336_1 WHERE formula = "YBa 2 Cu 3 O 7"
sql_create_context
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 AVG(demographic.age) FROM demographic WHERE demographic.age >= "79" AND demographic.admityear >= "2111"
mimicsql_data
CREATE TABLE table_name_94 ( round INTEGER, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the lowest round for a tight end position?
SELECT MIN(round) FROM table_name_94 WHERE position = "tight end"
sql_create_context
CREATE TABLE table_38451 ( "Game" real, "March" real, "Opponent" text, "Score" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of March that has 25-10-9 record and a Game more than 44?
SELECT COUNT("March") FROM table_38451 WHERE "Record" = '25-10-9' AND "Game" > '44'
wikisql
CREATE TABLE table_204_843 ( id number, "volume" number, "year" text, "names" text, "articles" number, "pages" number, "images" number, "maps" number, "number of copies" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many artic...
SELECT "articles" FROM table_204_843 WHERE "volume" = 6
squall
CREATE TABLE table_28107 ( "Company" text, "Name" text, "County" text, "Militia Regiment" text, "Commander" text, "Organization Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the company for desha county
SELECT "Company" FROM table_28107 WHERE "County" = 'Desha'
wikisql
CREATE TABLE table_10021158_3 ( best_finish VARCHAR, scoring_rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the scoring rank was 117, what was the best finish?
SELECT best_finish FROM table_10021158_3 WHERE scoring_rank = "117"
sql_create_context
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 MIN(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 = '027-81062')) AND lab.labname = 'pt - inr' AND STRFTIME('%y-%m', lab.labresulttime)...
eicu
CREATE TABLE table_20278716_2 ( mccain__percentage VARCHAR, others__percentage VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What percentage of voters chose McCain in the county where 1.1% of voters voted third party?
SELECT mccain__percentage FROM table_20278716_2 WHERE others__percentage = "1.1%"
sql_create_context
CREATE TABLE table_name_24 ( home_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In the game that took place at junction oval, how much did the home team score?
SELECT home_team AS score FROM table_name_24 WHERE venue = "junction oval"
sql_create_context
CREATE TABLE table_49883 ( "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Winning team" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT "Report" FROM table_49883 WHERE "Winning driver" = 'emerson fittipaldi'
wikisql
CREATE TABLE table_22164 ( "Title" text, "Developer" text, "Category" text, "Function" text, "Release date" text, "Version" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What functions were released on 2011-06-23?
SELECT "Function" FROM table_22164 WHERE "Release date" = '2011-06-23'
wikisql
CREATE TABLE table_27378582_1 ( current_womens_lacrosse_conference VARCHAR, nickname VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the current womens lacrosse conference for bison
SELECT current_womens_lacrosse_conference FROM table_27378582_1 WHERE nickname = "Bison"
sql_create_context
CREATE TABLE table_23248910_11 ( score VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score in game 6?
SELECT score FROM table_23248910_11 WHERE game = 6
sql_create_context
CREATE TABLE table_name_36 ( draw VARCHAR, lost VARCHAR, match VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many draws correspond to more than 11 losses in a match less than 14?
SELECT COUNT(draw) FROM table_name_36 WHERE lost > 11 AND match < 14
sql_create_context
CREATE TABLE bank ( branch_id number, bname text, no_of_customers number, city text, state text ) CREATE TABLE loan ( loan_id text, loan_type text, cust_id text, branch_id text, amount number ) CREATE TABLE customer ( cust_id text, cust_name text, acc_type text, ...
SELECT COUNT(DISTINCT state) FROM bank
spider
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationD...
SELECT (CAST(COUNT(q.Id) AS FLOAT) / (SELECT COUNT(*) FROM Posts WHERE Posts.CreationDate < @until AND PostTypeId = 1) * 100) AS AcceptedPercentage FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE a.PostTypeId = 2 AND q.CreationDate < @until
sede
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-18714')) AND diagnosis.diagnosisname = 'coronary artery disea...
eicu
CREATE TABLE table_name_41 ( home_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What did the home team score when playing at Western Oval?
SELECT home_team AS score FROM table_name_41 WHERE venue = "western oval"
sql_create_context
CREATE TABLE table_name_8 ( szdsz VARCHAR, mszp VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the SZDSZ percentage with an MSZP of 25% on 25/2/2009?
SELECT szdsz FROM table_name_8 WHERE mszp = "25%" AND date = "25/2/2009"
sql_create_context
CREATE TABLE table_2528382_2 ( co_stars VARCHAR, music_director VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which co-stars did Kalyanji-anandji direct in 1963?
SELECT co_stars FROM table_2528382_2 WHERE music_director = "Kalyanji-Anandji" AND year = "1963"
sql_create_context
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 program ( program_id int, name varchar, college varchar...
SELECT COUNT(instructor.name), instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'PHRMACOL' AND course.number = 611 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id ...
advising
CREATE TABLE table_21561 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who left a position on 24 January?
SELECT "Outgoing manager" FROM table_21561 WHERE "Date of vacancy" = '24 January'
wikisql
CREATE TABLE table_name_8 ( rider VARCHAR, rank VARCHAR, time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Rank smaller than 5, and a Time of 31 03.093 is what rider?
SELECT rider FROM table_name_8 WHERE rank < 5 AND time = "31’ 03.093"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid ...
SELECT MAX(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 = '022-44805')) AND NOT vitalperiodic.heartrate IS NULL...
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 jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb....
css
CREATE TABLE table_name_85 ( tournament VARCHAR, finalist VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which tournament had Richard Krajicek as a finalist?
SELECT tournament FROM table_name_85 WHERE finalist = "richard krajicek"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.dob_year > "2087"
mimicsql_data
CREATE TABLE table_69897 ( "Rank" real, "Player" text, "County" text, "Tally" text, "Total" real, "Opposition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Player in Opposition of Kilkenny has a Total of 10?
SELECT "Player" FROM table_69897 WHERE "Total" = '10' AND "Opposition" = 'kilkenny'
wikisql
CREATE TABLE table_59454 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the Report of tourist trophy?
SELECT "Report" FROM table_59454 WHERE "Name" = 'tourist trophy'
wikisql
CREATE TABLE table_3002894_4 ( sonnet VARCHAR, model VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When included ram (mib) is the model what is the sonnet?
SELECT sonnet FROM table_3002894_4 WHERE model = "Included RAM (MiB)"
sql_create_context
CREATE TABLE table_46758 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the position of the player who was picked in round 22?
SELECT "Position" FROM table_46758 WHERE "Round" = '22'
wikisql
CREATE TABLE table_13609 ( "Year" real, "Finish position" text, "1st day" text, "2nd day" text, "3rd day" text, "4th Day" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Finish position has a 4th Day of bumped robinson?
SELECT "Finish position" FROM table_13609 WHERE "4th Day" = 'bumped robinson'
wikisql
CREATE TABLE table_name_38 ( score VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Score, when Opponent is 'Daniel Gimeno-Traver'?
SELECT score FROM table_name_38 WHERE opponent = "daniel gimeno-traver"
sql_create_context
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time,...
SELECT (SELECT SUM(inputevents_cv.amount) 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 = 15794)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_...
mimic_iii
CREATE TABLE table_name_60 ( city VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What 2007-08 season has marcianise as the city?
SELECT 2007 AS _08_season FROM table_name_60 WHERE city = "marcianise"
sql_create_context
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester i...
SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE course.department LIKE '%MEMS%' AND program_course.category LIKE 'PreMajor' AND program_course.course_id = course.course_id
advising
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time,...
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20166 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartevents.ite...
mimic_iii
CREATE TABLE faculty ( campus VARCHAR, faculty VARCHAR ) CREATE TABLE campuses ( id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List the campus that have between 600 and 1000 faculty lines in year 2004.
SELECT T1.campus FROM campuses AS t1 JOIN faculty AS t2 ON t1.id = t2.campus WHERE t2.faculty >= 600 AND t2.faculty <= 1000 AND T1.year = 2004
sql_create_context
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_tit...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'prescriptions' AND cost.event_id IN (SELECT prescriptions.row_id FROM prescriptions WHERE prescriptions.drug = 'oxycodone-acetaminophen elixir')
mimic_iii
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Descr...
SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS StartOfMonth, COUNT(DISTINCT Posts.Id) AS Questions, COUNT(*) AS UpVotes, ROUND(COUNT(*) / CAST(COUNT(DISTINCT Posts.Id) AS DECIMAL), 2) AS UpVotesPerQuestion, ROUND(SUM(CASE WHEN Votes.PostId IS NULL THEN 1 ELSE 0 END) / CAST(COUNT(DISTINCT Posts.Id) AS DEC...
sede
CREATE TABLE table_train_202 ( "id" int, "systolic_blood_pressure_sbp" int, "body_weight" float, "diabetic" string, "qtc" int, "diastolic_blood_pressure_dbp" int, "body_mass_index_bmi" float, "clinical_diagnosis" bool, "NOUSE" float ) -- Using valid SQLite, answer the following que...
SELECT * FROM table_train_202 WHERE systolic_blood_pressure_sbp >= 160 OR diastolic_blood_pressure_dbp >= 105
criteria2sql
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 demographic.admission_type, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "12220"
mimicsql_data
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other,...
SELECT Questions.Id AS "post_link", Questions.Title, Questions.AnswerCount, Questions.ViewCount, Questions.FavoriteCount, Questions.Score, Questions.LastActivityDate FROM Posts AS Answers INNER JOIN Posts AS Questions ON Questions.Id = Answers.ParentId INNER JOIN Users AS Users ON Answers.OwnerUserId = Users.Id INNER J...
sede
CREATE TABLE table_204_129 ( id number, "place" number, "team" text, "titles" number, "runners-up" number, "winning years" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the last team ?
SELECT "team" FROM table_204_129 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_name_80 ( result VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the game versus Tulsa?
SELECT result FROM table_name_80 WHERE opponent = "tulsa"
sql_create_context
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissi...
mimic_iii
CREATE TABLE phone ( Hardware_Model_name VARCHAR, chip_model VARCHAR, screen_mode VARCHAR ) CREATE TABLE screen_mode ( Graphics_mode VARCHAR, Type VARCHAR ) CREATE TABLE chip_model ( Model_name VARCHAR, RAM_MiB VARCHAR ) -- Using valid SQLite, answer the following questions for the table...
SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T3.Type = "Text" OR T1.RAM_MiB > 32
sql_create_context
CREATE TABLE table_name_59 ( date VARCHAR, catalogue__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date with the catalogue number ptcd-1015-6?
SELECT date FROM table_name_59 WHERE catalogue__number = "ptcd-1015-6"
sql_create_context
CREATE TABLE table_61520 ( "Score" text, "Pos." real, "Inn." real, "Venue" text, "H/A/N" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which H/A/N has a score of 105* ?
SELECT "H/A/N" FROM table_61520 WHERE "Score" = '105*♠'
wikisql
CREATE TABLE table_204_311 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many nations have a total of 1 medal won ?
SELECT COUNT("nation") FROM table_204_311 WHERE "total" = 1
squall
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, d...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '016-22566' AND patient.hospitaladmitsource = 'direct admit' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-2 year') ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE table_name_84 ( player VARCHAR, pos VARCHAR, college VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player had a position of QB for Texas Tech?
SELECT player FROM table_name_84 WHERE pos = "qb" AND college = "texas tech"
sql_create_context
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 COUNT(DISTINCT hz_info.RYBH) FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE zyjzjlb.YLJGDM = '1966400' AND DATEDIFF(zyjzjlb.CYSJ, zyjzjlb.RYSJ) > 11
css
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text,...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
mimic_iii
CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE field ( fieldid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREA...
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM cite, paper, venue WHERE paper.paperid = cite.citedpaperid AND paper.year = 2010 AND venue.venueid = paper.venueid AND venue.venuename = 'EMNLP' GROUP BY cite.citedpaperid ORDER BY COUNT(cite.citedpaperid) DESC
scholar
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.JZLSH 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.RYBH = '35864254' AND hz_info.YLJGDM = '9397980' AND NOT mzjzjlb.JZKSMC LIKE '%激光%'
css
CREATE TABLE table_39524 ( "Ethnic group" text, "Totora Municipality (%)" real, "Pojo Municipality (%)" real, "Pocona Municipality (%)" real, "Chimor\u00e9 Municipality (%)" real, "Puerto Villarroel Municipality (%)" real, "Entre R\u00edos Municipality (%)" real ) -- Using valid SQLite, an...
SELECT MIN("Pocona Municipality (%)") FROM table_39524 WHERE "Puerto Villarroel Municipality (%)" < '14.6' AND "Chimor\u00e9 Municipality (%)" = '5.1' AND "Entre R\u00edos Municipality (%)" < '0.9'
wikisql
CREATE TABLE table_name_95 ( gold INTEGER, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of gold medals for a rank of 14?
SELECT SUM(gold) FROM table_name_95 WHERE rank = "14"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( ...
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-91239') AND patient.unitdischargetime IS NUL...
eicu
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name te...
WITH tmp AS (SELECT AnswerCount AS ACount, Period = TIME_TO_STR(CreationDate, '%W') FROM Posts WHERE PostTypeId = 1) SELECT Period, AVG(CAST(ACount AS FLOAT)) FROM tmp GROUP BY Period ORDER BY Period
sede