instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_32876 ( "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. -- Which Constructor won the Roussillon Grand Prix?
SELECT "Winning constructor" FROM table_32876 WHERE "Name" = 'roussillon grand prix'
wikisql
CREATE TABLE table_38354 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Total larger than 3, and a Rank of 4, and a Silver larger than 0 has what average gold?
SELECT AVG("Gold") FROM table_38354 WHERE "Total" > '3' AND "Rank" = '4' AND "Silver" > '0'
wikisql
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
(SELECT jybgb.SHSJ FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE person_info.XM = '陶展鹏' AND jyb...
css
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 COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '44192397' AND t_kc22.STA_DATE BETWEEN '2016-04-29' AND '2016-04-30' AND t_kc22.SOC_SRT_DIRE_CD = '130906139'
css
CREATE TABLE table_59856 ( "Year" real, "Song" text, "Artist" text, "Place" text, "Points" text, "Composer" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What artist shows 2007 and composer of Hayko?
SELECT "Artist" FROM table_59856 WHERE "Year" = '2007' AND "Composer" = 'hayko'
wikisql
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
SELECT COUNT(*) FROM zyjzjlb WHERE JZKSMC = '创伤骨科' AND RYDJSJ BETWEEN '2012-09-21' AND '2017-09-17'
css
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 patient ( uniquep...
SELECT SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-10615' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)
eicu
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, Vote...
SELECT Id AS "post_link", Score, ViewCount, CreationDate, ClosedDate FROM Posts WHERE Tags LIKE '%java%' AND Title LIKE '%IndexOutOfBound%' AND YEAR(CreationDate) = 2020 ORDER BY Score DESC
sede
CREATE TABLE table_9798 ( "Date" text, "Home captain" text, "Away captain" text, "Venue" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the home captain when the result was Aus by 229 runs?
SELECT "Home captain" FROM table_9798 WHERE "Result" = 'aus by 229 runs'
wikisql
CREATE TABLE table_29193 ( "Rank" real, "Rider" text, "Sat 21 Aug" text, "Mon 23 Aug" text, "Tues 24 Aug" text, "Wed 25 Aug" text, "Thurs 26 Aug" text, "Fri 27 Aug" text, "Sat 29 Aug" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Wh...
SELECT "Mon 23 Aug" FROM table_29193 WHERE "Rider" = 'Tom Snow 250cc Honda'
wikisql
CREATE TABLE table_name_22 ( date VARCHAR, opposing_teams VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Date, when Opposing Teams is 'South Africa', and when Venus is 'Vodacom Park , Bloemfontein'?
SELECT date FROM table_name_22 WHERE opposing_teams = "south africa" AND venue = "vodacom park , bloemfontein"
sql_create_context
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId ...
SELECT VT.Name, P.Body, P.Id, P.Tags FROM VoteTypes AS VT, Votes AS V, Posts AS P, Users AS U WHERE VT.Id = 5 AND VT.Id = V.VoteTypeId AND U.Id = '8048248' AND V.PostId = P.Id AND U.Id = V.UserId
sede
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 procedures.long_title FROM procedures WHERE procedures.icd9_code = "12"
mimicsql_data
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 MAX(demographic.age) FROM demographic WHERE demographic.days_stay = "20" AND demographic.dod_year < "2165.0"
mimicsql_data
CREATE TABLE table_name_4 ( date_and_opponent VARCHAR, position VARCHAR, career_games VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the Date and an Opponent which has a f Position and Career Games of 123 games?
SELECT date_and_opponent FROM table_name_4 WHERE position = "f" AND career_games = "123 games"
sql_create_context
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_graduation_semester int, degree varchar, minor varchar, internship varch...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr...
advising
CREATE TABLE table_52415 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Home team score for the Venue named ...
SELECT "Home team score" FROM table_52415 WHERE "Venue" = 'glenferrie oval'
wikisql
CREATE TABLE table_18861 ( "Parish" text, "Bush#" real, "Bush%" text, "Kerry#" real, "Kerry%" text, "Others#" real, "Others%" text, "Total#" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the maximum bush# with others% being 1.57...
SELECT MAX("Bush#") FROM table_18861 WHERE "Others%" = '1.57%'
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 demographic.gender, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "5027"
mimicsql_data
CREATE TABLE table_73736 ( "Pick #" real, "NFL Team" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player did the green bay packers pick?
SELECT "Player" FROM table_73736 WHERE "NFL Team" = 'Green Bay Packers'
wikisql
CREATE TABLE table_name_73 ( date VARCHAR, record VARCHAR, visitor VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date does visitor team Toronto score less than 49 points and has record of 18-17-7?
SELECT date FROM table_name_73 WHERE visitor = "toronto" AND points < 49 AND record = "18-17-7"
sql_create_context
CREATE TABLE table_40857 ( "Season" text, "Round" text, "Country" text, "Opponent" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent during the second round?
SELECT "Opponent" FROM table_40857 WHERE "Round" = 'second round'
wikisql
CREATE TABLE table_name_42 ( away_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the away team score at victoria park?
SELECT away_team AS score FROM table_name_42 WHERE venue = "victoria park"
sql_create_context
CREATE TABLE table_72778 ( "Season" text, "Air date" real, "Winner" text, "Runner-up" text, "Third place" text, "Host(s)" text, "Judges" text, "Winning mentor" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the runner-up when Moh...
SELECT "Runner-up" FROM table_72778 WHERE "Third place" = 'Mohamed Ali'
wikisql
CREATE TABLE table_name_49 ( record VARCHAR, loss VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record at the game that had a loss of Huffman (6 18)?
SELECT record FROM table_name_49 WHERE loss = "huffman (6–18)"
sql_create_context
CREATE TABLE table_10087 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the driver with 58 laps and a grid smaller than 21?
SELECT "Driver" FROM table_10087 WHERE "Laps" = '58' AND "Grid" < '21'
wikisql
CREATE TABLE table_19653 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title for the ...
SELECT "Title" FROM table_19653 WHERE "Written by" = 'Robert Carlock & Dana Klein Borkow'
wikisql
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) -- Using valid SQLite, answer the following questions fo...
SELECT Type, COUNT(*) FROM ship GROUP BY Type ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_17981 ( "Member countries" text, "Population" real, "Area (km\u00b2)" real, "GDP (billion US$)" text, "GDP per capita (US$)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the gdp of the country with a gdp per capita of $...
SELECT "GDP (billion US$)" FROM table_17981 WHERE "GDP per capita (US$)" = '18048'
wikisql
CREATE TABLE table_43169 ( "Name" text, "Position" text, "Number" text, "School/Club Team" text, "Season" text, "Acquisition via" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Acquisition via for Dennis Miranda?
SELECT "Acquisition via" FROM table_43169 WHERE "Name" = 'dennis miranda'
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 COUNT(*) FROM zyjzjlb JOIN hz_info_zyjzjlb JOIN hz_info ON 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_id = zyjzjlb.zyjzjlb_id AND hz_info_zyjzjlb.YLJGDM = hz_info.YLJGDM WHERE hz_info.YLJGDM = '03...
css
CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text ) CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE club ( Club_ID int, name te...
SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY COUNT(*)
nvbench
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT MED_ORG_DEPT_NM, OUT_DIAG_DIS_CD, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '7449354' GROUP BY MED_ORG_DEPT_NM, OUT_DIAG_DIS_CD
css
CREATE TABLE table_62417 ( "Pick #" real, "Player" text, "Nationality" text, "Position" text, "Team from" text, "League from" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Position has a League from of western hockey league, and a Team fr...
SELECT "Position" FROM table_62417 WHERE "League from" = 'western hockey league' AND "Team from" = 'everett silvertips'
wikisql
CREATE TABLE table_name_53 ( venue VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the venue when the home team was Essendon?
SELECT venue FROM table_name_53 WHERE home_team = "essendon"
sql_create_context
CREATE TABLE table_69147 ( "City/Town" text, "July av. T" text, "Rain" text, "Days with rain (year/summer)" text, "Days with frost" real, "Sunlight hours" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest number of sunlight hours...
SELECT MIN("Sunlight hours") FROM table_69147 WHERE "City/Town" = 'ourense' AND "Days with frost" > '30'
wikisql
CREATE TABLE table_name_16 ( no_7 VARCHAR, no_5 VARCHAR, no_2 VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was number 7 when Olivia was number 5 and Emma was number 2?
SELECT no_7 FROM table_name_16 WHERE no_5 = "olivia" AND no_2 = "emma"
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 lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.drug = "Cetylpyridinium Chl (Cepacol)"
mimicsql_data
CREATE TABLE table_12956 ( "Rank" real, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the least total when there are more than 2 golds and fewer than 0 silver?
SELECT MIN("Total") FROM table_12956 WHERE "Gold" > '2' AND "Silver" < '0'
wikisql
CREATE TABLE table_204_78 ( id number, "no." number, "train no." text, "origin" text, "destination" text, "train name" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many total trains were destined for new delhi ?
SELECT COUNT("train name") FROM table_204_78 WHERE "destination" = 'new delhi'
squall
CREATE TABLE table_8581 ( "DVD title" text, "Season" text, "Aspect ratio" text, "Episode count" real, "Time length" text, "Release date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the release date for Ben 10: Alien Force Volume 9 on ...
SELECT "Release date" FROM table_8581 WHERE "DVD title" = 'ben 10: alien force volume 9'
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 demographic ...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.diagnosis = "OVERDOSE"
mimicsql_data
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TAB...
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 30 AND 39) AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-2 yea...
eicu
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_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 course_offering ON COURSE_1.course_id = cour...
advising
CREATE TABLE table_57496 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the home team whose opponent...
SELECT "Home team" FROM table_57496 WHERE "Away team score" = '18.16 (124)'
wikisql
CREATE TABLE table_30008638_1 ( miss_air INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the least amount of Miss Airs any country has had?
SELECT MIN(miss_air) FROM table_30008638_1
sql_create_context
CREATE TABLE table_45525 ( "Rider" text, "Manufacturer" text, "Laps" text, "Time/Retired" text, "Grid" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which manufacturer is grid 11?
SELECT "Manufacturer" FROM table_45525 WHERE "Grid" = '11'
wikisql
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
advising
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 jybgb.BGDH FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '蒋...
css
CREATE TABLE table_61889 ( "Rank" real, "Athlete" text, "Taijijian" real, "Taijiquan" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest rank of the athlete with a taijiquan greater than 9.42 and a 19.02 total?
SELECT MIN("Rank") FROM table_61889 WHERE "Taijiquan" > '9.42' AND "Total" = '19.02'
wikisql
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "31" AND procedures.icd9_code = "17"
mimicsql_data
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.long_title = "Intravenous infusion of clofarabine"
mimicsql_data
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 person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) FROM person_info JOIN hz_info JOIN mzjzjlb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND ...
css
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
SELECT MAX(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 = '002-34744')) AND intakeoutput.celllabel = 'chest...
eicu
CREATE TABLE table_204_159 ( id number, "name" text, "nation" text, "position" text, "league apps" number, "league goals" number, "fa cup apps" number, "fa cup goals" number, "total apps" number, "total goals" number ) -- Using valid SQLite, answer the following questions for t...
SELECT "name" FROM table_204_159 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHA...
SELECT dorm_name, COUNT(*) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name ORDER BY dorm_name
nvbench
CREATE TABLE table_name_23 ( name VARCHAR, react VARCHAR, lane VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who has a react smaller than 0.149 and a lane smaller than 6?
SELECT name FROM table_name_23 WHERE react < 0.149 AND lane < 6
sql_create_context
CREATE TABLE table_53678 ( "Pick" real, "Player" text, "Country of origin*" text, "PBA team" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which United States player from Hawaii-Hilo had the lowest pick?
SELECT MIN("Pick") FROM table_53678 WHERE "Country of origin*" = 'united states' AND "College" = 'hawaii-hilo'
wikisql
CREATE TABLE table_61871 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text ) -- Using valid SQLite, answer the following questions f...
SELECT "Points against" FROM table_61871 WHERE "Try bonus" = 'try bonus'
wikisql
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 intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-49538')) AND intakeoutput.cellpath LIKE '%output%' ORDER...
eicu
CREATE TABLE Staff ( Staff_ID INTEGER, Tourist_Attraction_ID INTEGER, Name VARCHAR(40), Other_Details VARCHAR(255) ) CREATE TABLE Visitors ( Tourist_ID INTEGER, Tourist_Details VARCHAR(255) ) CREATE TABLE Visits ( Visit_ID INTEGER, Tourist_Attraction_ID INTEGER, Tourist_ID INTEGER,...
SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY COUNT(Visit_Date) DESC
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 PER_SOL FROM t_kc24 WHERE MED_CLINIC_ID = '79030741932'
css
CREATE TABLE table_name_18 ( player VARCHAR, position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Player has a Position of forward?
SELECT player FROM table_name_18 WHERE position = "forward"
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 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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.long_title = "Mechanical complication due to other implant and internal device, not elsewhere classified"
mimicsql_data
CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) )...
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Location_Code, Date_in_Locaton_To ORDER BY Date_in_Locaton_To
nvbench
CREATE TABLE table_3213 ( "Region" text, "HDI" text, "Life expectancy at birth (2001-2002)" text, "Adult literacy rate (2009)" text, "Combined gross enrollment ratio (2009)" text, "GDP (PPP) per capita (2008)" real ) -- Using valid SQLite, answer the following questions for the tables provided...
SELECT MAX("GDP (PPP) per capita (2008)") FROM table_3213 WHERE "Combined gross enrollment ratio (2009)" = '86.6'
wikisql
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate tim...
SELECT COUNT('Id') FROM Posts WHERE Posts.Tags = 'Ruby'
sede
CREATE TABLE table_203_91 ( 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. -- in which olympic games did arasay thondike not finish in the top 20...
SELECT "year" FROM table_203_91 WHERE "competition" = 'olympic games' AND "position" > 20
squall
CREATE TABLE table_30874 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which country is pick# 136 from?
SELECT "Nationality" FROM table_30874 WHERE "Pick #" = '136'
wikisql
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 WHERE demographic.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT" AND demographic.age < "51"
mimicsql_data
CREATE TABLE table_204_907 ( id number, "lift name" text, "type" text, "top\nelevation\n(ft)" number, "bottom\nelevation" number, "vertical\nrise" number, "length\n(ft)" number, "slope\n(%)" text, "capacity\n(rides/hr)" number, "speed\n(ft/min)" number, "lift\nmanufacturer" t...
SELECT COUNT("lift name") FROM table_204_907 WHERE "year\ninstalled" > 1991
squall
CREATE TABLE table_name_22 ( opponent VARCHAR, week VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent at the game attended by 62,019 before week 17?
SELECT opponent FROM table_name_22 WHERE week < 17 AND attendance = "62,019"
sql_create_context
CREATE TABLE table_name_33 ( _number_100 INTEGER, season VARCHAR, against VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which sum of # 100 has a Season of 1990, and an Against of warwickshire?
SELECT SUM(_number_100) FROM table_name_33 WHERE season = "1990" AND against = "warwickshire"
sql_create_context
CREATE TABLE table_30364 ( "Name/Name of Act" text, "Age(s)" text, "Genre" text, "Act" text, "Hometown" text, "Semifinal (Week)" real, "Position Reached" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many performers are 29 that made it ...
SELECT "Semifinal (Week)" FROM table_30364 WHERE "Age(s)" = '29'
wikisql
CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) CREATE TABLE Roles ( Role_Code CHAR(...
SELECT Calendar_Date, Day_Number FROM Ref_Calendar ORDER BY Calendar_Date
nvbench
CREATE TABLE table_7852 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For which tournament was the margin of victory 7 strokes?
SELECT "Tournament" FROM table_7852 WHERE "Margin of victory" = '7 strokes'
wikisql
CREATE TABLE table_9300 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much Bronze has a Silver larger than 2, and a Nation of mixed team, and a Rank larger tha...
SELECT COUNT("Bronze") FROM table_9300 WHERE "Silver" > '2' AND "Nation" = 'mixed team' AND "Rank" > '4'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, sy...
SELECT 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 = '004-32341')) AND medication.drugname = 'fentanyl (pf) 50 mcg/1...
eicu
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND diagnoses.icd9_code = "4710"
mimicsql_data
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE diagnoses_icd ( row_id number, ...
SELECT COUNT(*) 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 = 655 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND inputevents_cv.ite...
mimic_iii
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.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '53441764' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 4790.44)
css
CREATE TABLE table_67090 ( "Season" text, "League" text, "Rank" real, "Games" real, "Points" real, "Manager" text, "Top Scorer" text, "Goals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most games for eredivisie when jurrie k...
SELECT MAX("Games") FROM table_67090 WHERE "League" = 'eredivisie' AND "Manager" = 'jurrie koolhof' AND "Goals" < '10'
wikisql
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE compartmen...
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, days AS DAYS_0, days AS DAYS_1, flight WHERE ((DAYS_0.day_name = 'WEDNESDAY' AND DAYS_1.day_name = 'THURSDAY' AND flight.flight_days = DAYS_0.days_code AND flight.flight_days...
atis
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, ...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-52605')) AND NOT vitalperiodic.heartrate IS NUL...
eicu
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TAB...
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ORALBIOL' AND course.number = 853 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
advising
CREATE TABLE table_name_37 ( record VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the record of Game 56?
SELECT record FROM table_name_37 WHERE game = 56
sql_create_context
CREATE TABLE people ( people_id number, name text, country text, is_male text, age number ) CREATE TABLE church ( church_id number, name text, organized_by text, open_date number, continuation_of text ) CREATE TABLE wedding ( church_id number, male_id number, female...
SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30
spider
CREATE TABLE table_26232 ( "No" real, "Player" text, "Height (m)" text, "Height (f)" text, "Position" text, "Year born" real, "Current Club" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Display the serial numbers for the players who play a...
SELECT "No" FROM table_26232 WHERE "Position" = 'Center'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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...
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZ...
css
CREATE TABLE table_29901 ( "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. -- How ma...
SELECT COUNT("Date") FROM table_29901 WHERE "High assists" = 'Andre Miller (7)'
wikisql
CREATE TABLE table_12620 ( "Position" real, "Channel" text, "Analogue terrestrial channel" text, "Digital terrestrial channel" text, "Internet" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the internet when the position is more than 13?
SELECT "Internet" FROM table_12620 WHERE "Position" > '13'
wikisql
CREATE TABLE table_1616608_2 ( released_date VARCHAR, western_title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the released date for Super Mario 64 DS?
SELECT released_date FROM table_1616608_2 WHERE western_title = "Super Mario 64 DS"
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( ...
SELECT MAX(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 = '035-6788')) AND intakeoutput.celllabel = 'nutrit...
eicu
CREATE TABLE table_name_5 ( casualties INTEGER, number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average number of casualties for the convoy with a number of U-844?
SELECT AVG(casualties) FROM table_name_5 WHERE number = "u-844"
sql_create_context
CREATE TABLE table_name_9 ( record VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record when the attendance was 22,713?
SELECT record FROM table_name_9 WHERE attendance = "22,713"
sql_create_context
CREATE TABLE table_51491 ( "Games" text, "Gold" text, "Silver" text, "Bronze" text, "Total" text, "Rank" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rank of the games that had 9 gold and 9 silvers?
SELECT "Rank" FROM table_51491 WHERE "Gold" = '9' AND "Silver" = '9'
wikisql
CREATE TABLE member ( member_id number, member_name text, party_id text, in_office text ) CREATE TABLE party_events ( event_id number, event_name text, party_id number, member_in_charge_id number ) CREATE TABLE region ( region_id number, region_name text, date text, lab...
SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = "United Kingdom" AND t3.event_name = "Annaual Meeting"
spider
CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND date_day.day_number = 22 AND date_day.month_number = 3 AND d...
atis
CREATE TABLE member ( Member_ID text, Name text, Nationality text, Role text ) CREATE TABLE member_attendance ( Member_ID int, Performance_ID int, Num_of_Pieces int ) CREATE TABLE performance ( Performance_ID real, Date text, Host text, Location text, Attendance int ) ...
SELECT Date, COUNT(Date) FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin" GROUP BY Date ORDER BY COUNT(Date) DESC
nvbench
CREATE TABLE table_name_74 ( partner VARCHAR, opponents VARCHAR, outcome VARCHAR, surface VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the partner on the game which took place on a clay surface with opponents of marco chiudinelli michael la...
SELECT partner FROM table_name_74 WHERE outcome = "runner-up" AND surface = "clay" AND opponents = "marco chiudinelli michael lammer"
sql_create_context