instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE member ( Member_ID int, Member_Name text, Party_ID text, In_office text ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE party_events ( Event_ID int, Event_Name text, P...
SELECT Minister, COUNT(Minister) FROM party WHERE Party_name <> 'Progress Party' GROUP BY Minister ORDER BY Minister DESC
nvbench
CREATE TABLE table_name_16 ( opponents VARCHAR, raiders_points VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Opponents, when Raiders Points is '42', when Attendance is less than 52,505?
SELECT COUNT(opponents) FROM table_name_16 WHERE raiders_points = 42 AND attendance < 52 OFFSET 505
sql_create_context
CREATE TABLE table_62699 ( "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "FLT Apps" text, "FLT Goals" real, "Total Apps" text, "Total Goals" real ) -- Usin...
SELECT MAX("FLT Goals") FROM table_62699 WHERE "League Cup Goals" = '0' AND "Position" = 'gk' AND "League Cup Apps" = '2'
wikisql
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_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_NM = '云学博' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_CD = '315832')
css
CREATE TABLE department ( dname VARCHAR, mgr_start_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List all department names ordered by their starting date.
SELECT dname FROM department ORDER BY mgr_start_date
sql_create_context
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_gradu...
SELECT DISTINCT COURSE_1.department, COURSE_1.name, COURSE_1.number FROM course AS COURSE_0 INNER JOIN course_prerequisite ON COURSE_0.course_id = course_prerequisite.course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.pre_course_id WHERE COURSE_0.department = 'EEB' AND COURSE_0.number =...
advising
CREATE TABLE table_12662 ( "Club" text, "League" text, "Sport" text, "Established" text, "Championships" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Championships have a League of ontario australian football league?
SELECT "Championships" FROM table_12662 WHERE "League" = 'ontario australian football league'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtim...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'blood, venipuncture' AND STRFTIME('%y', microlab.culturetakentime) = '2104')
eicu
CREATE TABLE table_204_77 ( id number, "number" text, "builder" text, "type" text, "date" text, "works number" number, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many total trains were build in 1949 ?
SELECT COUNT("number") FROM table_204_77 WHERE "date" = 1949
squall
CREATE TABLE table_30887 ( "Code" text, "Subdivision name ( be ) (BGN/PCGN)" text, "Subdivision name ( be ) (GOST)" text, "Subdivision name ( ru ) (BGN/PCGN)" text, "Subdivision name ( ru ) (GOST)" text, "Subdivision category" text ) -- Using valid SQLite, answer the following questions for th...
SELECT "Subdivision name ( be ) (BGN/PCGN)" FROM table_30887 WHERE "Subdivision name ( ru ) (BGN/PCGN)" = 'Grodnenskaya oblast'
wikisql
CREATE TABLE table_32813 ( "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 that played Fitzroy?
SELECT "Away team" FROM table_32813 WHERE "Home team" = 'fitzroy'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM, MAX(t_kc24.CIVIL_SUBSIDY) 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 = '1789276' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_D...
css
CREATE TABLE table_32135 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the number of bronze for silver of 0 and total less than 1
SELECT COUNT("Bronze") FROM table_32135 WHERE "Silver" = '0' AND "Total" < '1'
wikisql
CREATE TABLE table_35680 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the date of the game where the indians record was 37-44?
SELECT "Date" FROM table_35680 WHERE "Record" = '37-44'
wikisql
CREATE TABLE table_name_93 ( attendance_g INTEGER, pos VARCHAR, season VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average attendance for seasons before 1999 with pos of 8?
SELECT AVG(attendance_g) FROM table_name_93 WHERE pos = 8 AND season < 1999
sql_create_context
CREATE TABLE table_name_44 ( attendance INTEGER, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What game that had a record of 39-44 had the lowest attendance?
SELECT MIN(attendance) FROM table_name_44 WHERE record = "39-44"
sql_create_context
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 t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'bronchitis - acute' AND DATETIME(diagnosis.diagnos...
eicu
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate re...
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex ORDER BY AVG(Weight)
nvbench
CREATE TABLE table_27537518_6 ( record VARCHAR, first_star VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record in the game whose first star was J. Oduya?
SELECT record FROM table_27537518_6 WHERE first_star = "J. Oduya"
sql_create_context
CREATE TABLE table_11658094_3 ( nickname VARCHAR, institution VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the nickname of the newberry college?
SELECT nickname FROM table_11658094_3 WHERE institution = "Newberry College"
sql_create_context
CREATE TABLE table_16545 ( "Season" real, "Grand FinalDate" text, "WinningTeam" text, "Score" text, "LosingTeam" text, "Location" text, "GF Attendance" real, "Clive Churchill Medal" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which lo...
SELECT "LosingTeam" FROM table_16545 WHERE "Score" = '24-12'
wikisql
CREATE TABLE table_name_54 ( state__class_ VARCHAR, successor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which State (class) has a Successor of harry f. byrd, jr. (d)? Question
SELECT state__class_ FROM table_name_54 WHERE successor = "harry f. byrd, jr. (d)"
sql_create_context
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerU...
SELECT p.Id, p.OwnerUserId, SUM(CASE WHEN v.VoteTypeId = 2 THEN 1 ELSE 0 END) AS upvotes, SUM(CASE WHEN v.VoteTypeId = 3 THEN 1 ELSE 0 END) AS downvotes FROM Posts AS p INNER JOIN Votes AS v ON v.PostId = p.Id WHERE v.VoteTypeId IN (2, 3) AND p.OwnerUserId = 2157772 GROUP BY p.Id, p.OwnerUserId
sede
CREATE TABLE table_name_53 ( top_10s INTEGER, starts VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which of the top-10s has a starts value of 14?
SELECT MAX(top_10s) FROM table_name_53 WHERE starts = 14
sql_create_context
CREATE TABLE table_23368 ( "N\u00ba" real, "Ep" real, "Huckleberry Hound" text, "Pixie and Dixie" text, "Yogi Bear" text, "Air date" text, "Credited animators" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What episode includes 'Cop and Sau...
SELECT MIN("Ep") FROM table_23368 WHERE "Huckleberry Hound" = 'Cop and Saucer'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.diagnosis = "LEFT FEMUR FRACTURE"
mimicsql_data
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, ...
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 = 12927)) AND DATETIME(inputevents_cv....
mimic_iii
CREATE TABLE table_58763 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is team 1 if Renova is team 2?
SELECT "Team 1" FROM table_58763 WHERE "Team 2" = 'renova'
wikisql
CREATE TABLE table_name_17 ( republican_ticket VARCHAR, socialist_ticket VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name on the Republican ticket when the Socialist ticket was louis waldman?
SELECT republican_ticket FROM table_name_17 WHERE socialist_ticket = "louis waldman"
sql_create_context
CREATE TABLE table_63745 ( "School" text, "Location" text, "Mascot" text, "Enrollment" real, "IHSAA Football Class" text, "Primary Conference" text, "County" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Location with a county o...
SELECT "Location" FROM table_63745 WHERE "County" = '30 hancock'
wikisql
CREATE TABLE table_26493520_3 ( title VARCHAR, total_viewers_on_fx VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the title for total viewers on fx+ being 483,000
SELECT title FROM table_26493520_3 WHERE total_viewers_on_fx = "483,000"
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 prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2166" AND diagnoses.long_title = "Pneumococcal pneumonia [Streptococcus pneumoniae pneumonia]"
mimicsql_data
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student ( student_id int, lastname varchar, ...
SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'PSYCH' AND course.number = 464 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
advising
CREATE TABLE table_name_70 ( name VARCHAR, authority VARCHAR, local_board VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What name shows as private authority and hibiscus and bays local board ?
SELECT name FROM table_name_70 WHERE authority = "private" AND local_board = "hibiscus and bays"
sql_create_context
CREATE TABLE table_62631 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT MAX("Goals for") FROM table_62631 WHERE "Losses" < '16' AND "Wins" < '11' AND "Goal Difference" > '-9'
wikisql
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) 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 person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE mzjzjlb.JZZDSM = '阿尔茨海默病' GROUP BY person_info.JGDM
css
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jyb...
css
CREATE TABLE table_203_839 ( id number, "station" text, "type" text, "latitude" text, "longitude" text, "el. (m)" number, "opened" number, "closed" number, "coordinates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- the top elevatio...
SELECT "station" FROM table_203_839 WHERE "el. (m)" = 2591
squall
CREATE TABLE table_29945 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who sc...
SELECT "High points" FROM table_29945 WHERE "Team" = 'Houston'
wikisql
CREATE TABLE table_name_71 ( year INTEGER, australian_open VARCHAR, french_open VARCHAR, wimbledon VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the latest year rafael nadal was in the French Open, Roger Federer was in Wimbledon, and Roger F...
SELECT MAX(year) FROM table_name_71 WHERE french_open = "rafael nadal" AND wimbledon = "roger federer" AND australian_open = "roger federer"
sql_create_context
CREATE TABLE table_204_808 ( id number, "team" text, "no" number, "driver" text, "class" text, "chassis" text, "engine" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many teams had at least two drivers this season ?
SELECT COUNT(*) FROM (SELECT "team" FROM table_204_808 GROUP BY "team" HAVING COUNT("driver") >= 2)
squall
CREATE TABLE table_31467 ( "Rank" real, "Rider" text, "Sat 20 Aug" text, "Mon 22 Aug" text, "Tues 23 Aug" text, "Wed 24 Aug" text, "Thurs 25 Aug" text, "Fri 26 Aug" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the thurs 25 aug ...
SELECT "Thurs 25 Aug" FROM table_31467 WHERE "Wed 24 Aug" = '19'' 59.73 113.216mph'
wikisql
CREATE TABLE table_11240028_1 ( last_appearance VARCHAR, portrayed_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which episode did actor A. J. Buckley last appear in?
SELECT last_appearance FROM table_11240028_1 WHERE portrayed_by = "A. J. Buckley"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Non-invasive mechanical ventilation"
mimicsql_data
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT T2.Name, AVG(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC
nvbench
CREATE TABLE table_name_44 ( week_8_oct_26 VARCHAR, week_7_oct_19 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Week 8 result of the team that lost to syarcuse (4-2) in Week 7?
SELECT week_8_oct_26 FROM table_name_44 WHERE week_7_oct_19 = "syarcuse (4-2)"
sql_create_context
CREATE TABLE table_name_20 ( rank VARCHAR, player VARCHAR, bb_so VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the rank of tris speaker when BB/SO was 7?
SELECT rank FROM table_name_20 WHERE player = "tris speaker" AND bb_so = 7
sql_create_context
CREATE TABLE table_65987 ( "Rank" real, "Rowers" text, "Country" text, "Time" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the notes for the rowers from denmark?
SELECT "Notes" FROM table_65987 WHERE "Country" = 'denmark'
wikisql
CREATE TABLE table_5161 ( "Round" text, "Pick" real, "Overall" real, "Name" text, "Position" text, "Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Overall number for pick 17?
SELECT "Overall" FROM table_5161 WHERE "Pick" = '17'
wikisql
CREATE TABLE table_name_26 ( length VARCHAR, bullet VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which length has a Bullet of 6.5 (.257)?
SELECT length FROM table_name_26 WHERE bullet = "6.5 (.257)"
sql_create_context
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 DISTINCT cost.cost FROM cost WHERE cost.event_type = 'prescriptions' AND cost.event_id IN (SELECT prescriptions.row_id FROM prescriptions WHERE prescriptions.drug = 'heparin flush (10 units/ml)')
mimic_iii
CREATE TABLE table_13614 ( "Model number" text, "sSpec number" text, "Frequency" text, "Turbo" text, "GPU frequency" text, "Cores" text, "L2 cache" text, "L3 cache" text, "I/O bus" text, "Mult." text, "Memory" text, "Voltage" text, "Socket" text, "Release date" te...
SELECT "Frequency" FROM table_13614 WHERE "I/O bus" = 'dmi' AND "Voltage" = '0.725–1.4v' AND "Part number(s)" = 'cn80617004458ab'
wikisql
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 COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-65662')) AND STRFTIME('%y', lab.labresulttime) >= '2103'
eicu
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Aztreonam"
mimicsql_data
CREATE TABLE table_name_38 ( population VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Population of Sargent County?
SELECT population FROM table_name_38 WHERE county = "sargent"
sql_create_context
CREATE TABLE table_57987 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the decision on october 5?
SELECT "Decision" FROM table_57987 WHERE "Date" = 'october 5'
wikisql
CREATE TABLE table_name_14 ( record VARCHAR, event VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is his record at ufc 115?
SELECT record FROM table_name_14 WHERE event = "ufc 115"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "STERNAL WOUND INFECTION"
mimicsql_data
CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test_taken DATETIME, test_result VARCHAR(255) ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Course_Authors_and_...
SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" ORDER BY COUNT(date_of_enrolment) DESC
nvbench
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 PostTags ( PostId number, TagId number ) CREATE TABLE P...
SELECT Text, LENGTH(Text) - LENGTH(REPLACE(Text, ' ', '')) + 1 FROM Comments WHERE Score = 6 AND Text LIKE '%?%' AND LENGTH(Text) - LENGTH(REPLACE(Text, ' ', '')) + 1 > 20
sede
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 bdmzjzjlb ( HXPLC number, HZX...
SELECT wdmzjzjlb.SG, wdmzjzjlb.TZ, wdmzjzjlb.TW, wdmzjzjlb.SSY, wdmzjzjlb.SZY, wdmzjzjlb.XL, wdmzjzjlb.HXPLC, wdmzjzjlb.ML FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '28831691932' UNION SELECT bdmzjzjlb.SG, bdmzjzjlb.TZ, bdmzjzjlb.TW, bdmzjzjlb.SSY, bdmzjzjlb.SZY, bdmzjzjlb.XL, bdmzjzjlb.HXPLC, bdmzjzjlb.ML FROM bdmzjzjlb ...
css
CREATE TABLE table_42515 ( "Year" text, "Title" text, "Genre" text, "Label" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which result's genre was jazz when its label was columbia and its title was requiem?
SELECT "Result" FROM table_42515 WHERE "Genre" = 'jazz' AND "Label" = 'columbia' AND "Title" = 'requiem'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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 te...
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM...
css
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAc...
SELECT MONTH(DATE(Posts.CreationDate)), YEAR(DATE(Posts.CreationDate)), COUNT(Posts.Id) FROM Tags, PostTags, Posts WHERE Tags.TagName = 'cassandra' AND Tags.Id = PostTags.TagId AND PostTags.PostId = Posts.Id AND Posts.CreationDate > '2013-10-01' AND Posts.CreationDate < '2017-01-01' GROUP BY MONTH(DATE(Posts.CreationDa...
sede
CREATE TABLE table_16836 ( "Player" text, "No." real, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which country is Jim Les from?
SELECT "Nationality" FROM table_16836 WHERE "Player" = 'Jim Les'
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 demographic.insurance FROM demographic WHERE demographic.subject_id = "6983"
mimicsql_data
CREATE TABLE election ( Election_ID int, Representative_ID int, Date text, Votes real, Vote_Percent real, Seats real, Place real ) CREATE TABLE representative ( Representative_ID int, Name text, State text, Party text, Lifespan text ) -- Using valid SQLite, answer the ...
SELECT Party, COUNT(Party) FROM representative GROUP BY Party ORDER BY COUNT(Party)
nvbench
CREATE TABLE table_10068 ( "Team" text, "Location" text, "Venue" text, "Capacity" real, "Position in 2006" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Team Dnepr's position in 2006?
SELECT "Position in 2006" FROM table_10068 WHERE "Team" = 'dnepr'
wikisql
CREATE TABLE table_43367 ( "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. -- For the teams that had fewer than 1 Byes, what was the lowest number of Draws?
SELECT MIN("Draws") FROM table_43367 WHERE "Byes" < '1'
wikisql
CREATE TABLE table_57742 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the location attendance ...
SELECT "Location Attendance" FROM table_57742 WHERE "Team" = 'golden state'
wikisql
CREATE TABLE table_62123 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the to par for england when the score is less than 71?
SELECT "To par" FROM table_62123 WHERE "Country" = 'england' AND "Score" < '71'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND procedures.short_title = "Opn rt hemicolectomy NEC"
mimicsql_data
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 procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "MORBID OBESITY/SDA" AND demographic.dod_year <= "2183.0"
mimicsql_data
CREATE TABLE table_1463332_2 ( most_recent_final VARCHAR, years__won_in_bold_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most recent final result for the years (won in bold) 1979?
SELECT most_recent_final FROM table_1463332_2 WHERE years__won_in_bold_ = "1979"
sql_create_context
CREATE TABLE classroom ( building VARCHAR, room_number VARCHAR, capacity INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the room number of the rooms which can sit 50 to 100 students and their buildings.
SELECT building, room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
sql_create_context
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 ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
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 table_52143 ( "Year" real, "Single" text, "U.S. Country" text, "U.S." text, "U.S. AC" text, "Album" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the best album in 1965?
SELECT "U.S. AC" FROM table_52143 WHERE "Album" = 'the best' AND "Year" = '1965'
wikisql
CREATE TABLE table_name_72 ( to_par VARCHAR, total VARCHAR, player VARCHAR, country VARCHAR, year_won VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the to par for Paul Azinger from the United States after 1986 for a total bigger than 145...
SELECT COUNT(to_par) FROM table_name_72 WHERE country = "united states" AND year_won > 1986 AND player = "paul azinger" AND total > 145
sql_create_context
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose...
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 81461) AND STRFTIME('%y', diagnoses_icd.charttime) = '2105'
mimic_iii
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, ...
SELECT Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%New Delhi%' ORDER BY Reputation DESC LIMIT 100
sede
CREATE TABLE table_name_30 ( regional_county_municipality VARCHAR, area__km_2__ VARCHAR, population VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What municipality has 719 people and is larger than 108.46 km2?
SELECT regional_county_municipality FROM table_name_30 WHERE area__km_2__ > 108.46 AND population = 719
sql_create_context
CREATE TABLE table_4723 ( "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 home team score when the score for t...
SELECT "Home team score" FROM table_4723 WHERE "Away team score" = '7.9 (51)'
wikisql
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE treatment ( treat...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-662...
eicu
CREATE TABLE table_55013 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score for set 2 when set 3 was 15 6?
SELECT "Set 2" FROM table_55013 WHERE "Set 3" = '15–6'
wikisql
CREATE TABLE table_41116 ( "Round" real, "Race name" text, "Circuit" text, "City/State" text, "Date" text, "Winner(s)" text, "Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which circuit had a round larger than 5?
SELECT "Circuit" FROM table_41116 WHERE "Round" > '5'
wikisql
CREATE TABLE table_name_79 ( abbreviation VARCHAR, inception VARCHAR, assets_us$billion VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the abbreviation for the country with an inception of 1999 and US$Billion assets of 7.1?
SELECT abbreviation FROM table_name_79 WHERE inception = "1999" AND assets_us$billion = "7.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 WHERE demographic.admission_type = "EMERGENCY" AND demographic.ethnicity = "WHITE"
mimicsql_data
CREATE TABLE table_name_46 ( type VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What type of bridge is Colton's Crossing Bridge?
SELECT type FROM table_name_46 WHERE name = "colton's crossing bridge"
sql_create_context
CREATE TABLE table_11231 ( "Season" real, "Season Premiere" text, "Season Finale" text, "TV Season" text, "Rank" text, "Viewers (in millions)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the rank of the 2009-2010 TV season?
SELECT "Rank" FROM table_11231 WHERE "TV Season" = '2009-2010'
wikisql
CREATE TABLE table_53243 ( "Rank" real, "Rider" text, "Team" text, "Speed" text, "Time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the time of the rider with a speed of 102.962mph?
SELECT "Time" FROM table_53243 WHERE "Speed" = '102.962mph'
wikisql
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE cour...
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offe...
advising
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 EMPLOYEE_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
nvbench
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE keyphr...
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM cite, keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = cite.citedpaperid AND paper.paperid = paperkeyphrase.paperid GROUP BY cite.citedpaperid ORDER BY CO...
scholar
CREATE TABLE table_18224 ( "District" text, "Incumbent" text, "Party" text, "Elected" text, "Status" text, "Opponent" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many incumbents represent district California 34?
SELECT COUNT("Incumbent") FROM table_18224 WHERE "District" = 'California 34'
wikisql
CREATE TABLE table_25353861_5 ( steals INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the fewest steals any player had?
SELECT MIN(steals) FROM table_25353861_5
sql_create_context
CREATE TABLE table_65678 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result for the game before week 7 against BYE?
SELECT "Result" FROM table_65678 WHERE "Week" < '7' AND "Opponent" = 'bye'
wikisql
CREATE TABLE mzb ( 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 SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.MED_SER_ORG_NO = '3006208' AND qtb.MED_ORG_DEPT_NM = '小儿肛肠外科' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.MED_SER_ORG_NO = '3006208' AND gyb.MED_ORG_DEPT_NM = '小儿肛肠外科' UNION SELECT zyb.MED_CLINIC_ID...
css
CREATE TABLE table_55037 ( "Outcome" text, "Date" text, "Surface" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which surface has a Date of 5 november 2011?
SELECT "Surface" FROM table_55037 WHERE "Date" = '5 november 2011'
wikisql
CREATE TABLE table_name_1 ( year VARCHAR, uk_peak_position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many years had a film that peaked at #10 in the UK?
SELECT COUNT(year) FROM table_name_1 WHERE uk_peak_position = "10"
sql_create_context
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
SELECT BGDH FROM jyjgzbb WHERE JYZBLSH = '02569386743'
css