instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar ) CREATE TABLE neighborhood ( id int, business_id varchar, neighborhood_name varchar ) CREATE TABLE user ( uid int, user_id varchar, name varchar ) CREATE TABLE category ( id int, business_id v...
SELECT checkin.day, SUM(checkin.count) FROM business, category AS CATEGORY_0, category AS CATEGORY_1, checkin WHERE business.city = 'Los Angeles' AND CATEGORY_0.business_id = business.business_id AND CATEGORY_0.category_name = 'Moroccan' AND CATEGORY_1.business_id = business.business_id AND CATEGORY_1.category_name = '...
yelp
CREATE TABLE table_name_12 ( place INTEGER, lost VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the place when losses is less than 12 and points is less than 19?
SELECT SUM(place) FROM table_name_12 WHERE lost < 12 AND points < 19
sql_create_context
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 "position" FROM table_204_159 GROUP BY "position" ORDER BY COUNT(*) LIMIT 1
squall
CREATE TABLE table_204_270 ( id number, "transmitter" text, "kw" number, "bbca" number, "bbcb" number, "d3&4" number, "sdn" number, "arqa" number, "arqb" number, "pol." text, "a.g." text ) -- Using valid SQLite, answer the following questions for the tables provided above. ...
SELECT "transmitter" FROM table_204_270 WHERE "bbcb" > 55
squall
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.insurance, demographic.discharge_location FROM demographic WHERE demographic.subject_id = "15898"
mimicsql_data
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 COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 18866 AND admissions.admission_location = 'emergency room admit' AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE table_24827 ( "Institution" text, "Location" text, "Enrollment" text, "Athletic nickname" text, "School Colors" text, "Founded" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many entries are shown for school colors for the loca...
SELECT COUNT("School Colors") FROM table_24827 WHERE "Location" = 'Naga , Camarines Sur'
wikisql
CREATE TABLE table_name_7 ( rating VARCHAR, weekly_rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Rating(s), when Weekly Rank is 76/88?
SELECT COUNT(rating) FROM table_name_7 WHERE weekly_rank = "76/88"
sql_create_context
CREATE TABLE table_52157 ( "Rank" real, "List" text, "Candidate name" text, "Gender" text, "Religion" text, "Votes" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Khalil chawka has a gender of , a religion of , and how many votes?
SELECT "Votes" FROM table_52157 WHERE "Gender" = '♂' AND "Religion" = '☪' AND "Candidate name" = 'khalil chawka'
wikisql
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT (SELECT COUNT(*) 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 person_info.XM = '韦英秀' AND mzjzjlb.JZKSRQ BETWEEN '2018-10-01' AND '2020-08-23') + (SELECT COUNT(*) FROM person_info J...
css
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT demographic.religion FROM demographic WHERE demographic.subject_id = "2560"
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 diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.icd9_code = "17"
mimicsql_data
CREATE TABLE table_79873 ( "Pick #" text, "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 player has a Position of defence, and a Pick # of 6?
SELECT "Player" FROM table_79873 WHERE "Position" = 'defence' AND "Pick #" = '6'
wikisql
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 WHERE demographic.ethnicity = "WHITE" AND demographic.dob_year < "2056"
mimicsql_data
CREATE TABLE table_23631 ( "Candidate" text, "Office" text, "Home state" text, "Popular vote" real, "States \u2013 first place" real, "States \u2013 second place" real, "States \u2013 third place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. ...
SELECT "Office" FROM table_23631 WHERE "Candidate" = 'Jon Huntsman'
wikisql
CREATE TABLE table_name_70 ( total INTEGER, silver INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the Total which has a Silver larger than 19?
SELECT MAX(total) FROM table_name_70 WHERE silver > 19
sql_create_context
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT t_kc21.FLX_MED_ORG_ID FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '43267723179'
css
CREATE TABLE Person ( age INTEGER, name VARCHAR ) CREATE TABLE PersonFriend ( name VARCHAR, friend VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which person whose friends have the oldest average age?
SELECT T2.name, AVG(T1.age) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY AVG(T1.age) DESC LIMIT 1
sql_create_context
CREATE TABLE table_22402438_7 ( position VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which position is player bernie doan?
SELECT position FROM table_22402438_7 WHERE player = "Bernie Doan"
sql_create_context
CREATE TABLE table_59880 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which incumbent was first elected in 1987?
SELECT "Incumbent" FROM table_59880 WHERE "First elected" = '1987'
wikisql
CREATE TABLE table_name_17 ( competition VARCHAR, opponents VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the competition for motherwell opponents
SELECT competition FROM table_name_17 WHERE opponents = "motherwell"
sql_create_context
CREATE TABLE table_22078972_2 ( no_in_series INTEGER, written_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the series number of the episode whose writer is David North?
SELECT MAX(no_in_series) FROM table_22078972_2 WHERE written_by = "David North"
sql_create_context
CREATE TABLE table_44390 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- From what country did someone score 71?
SELECT "Country" FROM table_44390 WHERE "Score" = '71'
wikisql
CREATE TABLE table_72033 ( "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 score of the game when the record was 18 43?
SELECT "Score" FROM table_72033 WHERE "Record" = '18–43'
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2108" AND lab.itemid = "50998"
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 jybgb.KSBM, jybgb.KSMC FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH...
css
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime t...
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26156 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label ...
mimic_iii
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2180" AND diagnoses.icd9_code = "3671"
mimicsql_data
CREATE TABLE table_6507 ( "Position" text, "Player" text, "Premiership" text, "Norwegian Cup" text, "UEFA" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Total with a Player named robbie winters?
SELECT "Total" FROM table_6507 WHERE "Player" = 'robbie winters'
wikisql
CREATE TABLE table_name_58 ( region VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which region has a date of 1970?
SELECT region FROM table_name_58 WHERE date = "1970"
sql_create_context
CREATE TABLE table_13194 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real, "Money ( $ )" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of the to par with a 76-77-74-75=302 score?
SELECT SUM("To par") FROM table_13194 WHERE "Score" = '76-77-74-75=302'
wikisql
CREATE TABLE table_name_28 ( away_team VARCHAR, tie_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which away team has a tie number of 3?
SELECT away_team FROM table_name_28 WHERE tie_no = "3"
sql_create_context
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, ...
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'cholesterol, total') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51177) AND STRFTIME('%y-%m', labevents.charttime) >= '2103-02' OR...
mimic_iii
CREATE TABLE table_26216 ( "Song 1 title" text, "Artist 1" text, "Song 2 title" text, "Artist 2" text, "Mix artist" text, "Guitar part?" text, "Level" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which level has marvin gaye as artist 1 and...
SELECT "Level" FROM table_26216 WHERE "Artist 1" = 'Marvin Gaye' AND "Artist 2" = 'David Bowie'
wikisql
CREATE TABLE table_name_50 ( album VARCHAR, label VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the name of the album from 2012 with a Hammer Music / Nail Records label?
SELECT album FROM table_name_50 WHERE label = "hammer music / nail records" AND year = 2012
sql_create_context
CREATE TABLE table_30343 ( "Character" text, "Game" text, "Platform" text, "Status" text, "Mystic Arte" text, "Character Voice" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many platforms have celsius calibur as mystic arte?
SELECT COUNT("Platform") FROM table_30343 WHERE "Mystic Arte" = 'Celsius Calibur'
wikisql
CREATE TABLE table_name_74 ( position VARCHAR, nationality VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the position of United States' player Brett Lawrence?
SELECT position FROM table_name_74 WHERE nationality = "united states" AND player = "brett lawrence"
sql_create_context
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varcha...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
atis
CREATE TABLE video_games ( gameid number, gname text, gtype text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE sportsinfo ( stuid number, sportname text, hoursperw...
SELECT stuid FROM sportsinfo GROUP BY stuid HAVING SUM(hoursperweek) > 10
spider
CREATE TABLE table_name_76 ( away_team VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When fitzroy was the home team, how much did the away team score?
SELECT away_team AS score FROM table_name_76 WHERE home_team = "fitzroy"
sql_create_context
CREATE TABLE table_15412381_5 ( date VARCHAR, wheels VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date of the 279 wheels?
SELECT date FROM table_15412381_5 WHERE wheels = 279
sql_create_context
CREATE TABLE table_6059 ( "Wicket" text, "Score" real, "Batting partners" text, "Opposition" text, "Venue" text, "City" text, "Year" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what Venue was Surrey the Opposition in the 2nd Wicket?
SELECT "Venue" FROM table_6059 WHERE "Opposition" = 'surrey' AND "Wicket" = '2nd'
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 AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "SQUAMOUS CELL CARCINOMA ORAL TONGUE/SDA" AND demographic.days_stay = "5"
mimicsql_data
CREATE TABLE table_17355408_7 ( high_points VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- @ Chicago had a high points of what?
SELECT high_points FROM table_17355408_7 WHERE team = "@ Chicago"
sql_create_context
CREATE TABLE table_name_99 ( lane INTEGER, athlete VARCHAR, time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the greatest lane that David Payne was in when he ran longer than 13.17?
SELECT MAX(lane) FROM table_name_99 WHERE athlete = "david payne" AND time > 13.17
sql_create_context
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description t...
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS Rank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInTimePeriod, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostI...
sede
CREATE TABLE table_204_577 ( id number, "name" text, "first operational" text, "numeral system" text, "computing mechanism" text, "programming" text, "turing complete" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the number of name...
SELECT COUNT("name") FROM table_204_577
squall
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 * FROM person_info JOIN hz_info JOIN wdmzjzjlb 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 WHERE person_info.XM = '施红雪' AND hz_info.YLJGDM = '9652533' AND wdmzjzjlb.JZZDSM LIKE '%壹期%' UNION SELECT * FROM person_info JOIN h...
css
CREATE TABLE table_12337 ( "Institution" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Nickname" text, "NCAA Team Championships (through July 4, 2012)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is t...
SELECT MAX("Enrollment") FROM table_12337 WHERE "Nickname" = 'golden bears' AND "NCAA Team Championships (through July 4, 2012)" < '32'
wikisql
CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255) ) CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, date_account_opened DATETIME, account_name VARCHAR(50), ...
SELECT customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY customer_last_name DESC
nvbench
CREATE TABLE table_2976 ( "French Title" text, "Date of Publication" real, "English Translation" text, "Writer" text, "Artist" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the French title of the story published in 1968?
SELECT "French Title" FROM table_2976 WHERE "Date of Publication" = '1968'
wikisql
CREATE TABLE table_68368 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which manufacturer made Shoya Tomizawa's motorcycle?
SELECT "Manufacturer" FROM table_68368 WHERE "Rider" = 'shoya tomizawa'
wikisql
CREATE TABLE table_28180 ( "Institution" text, "Seniors" text, "Juniors" text, "Women" text, "Status" text, "Founded" real, "Affiliation (Population)" text, "Color" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What...
SELECT "Status" FROM table_28180 WHERE "Juniors" = 'Baby Olympians'
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "REPLACE"
mimicsql_data
CREATE TABLE table_204_988 ( id number, "responsible minister(s)" text, "crown entities" text, "monitoring department(s)" text, "category / type" text, "empowering legislation" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the crown ent...
SELECT "crown entities" FROM table_204_988 WHERE id = (SELECT id FROM table_204_988 WHERE "crown entities" = 'takeovers panel') - 1
squall
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '云鸿光' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC
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 SUM(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 = '011-57670')) AND intakeoutput.celllabel = 'urine...
eicu
CREATE TABLE table_1305623_12 ( gold_medals INTEGER, ensemble VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many gold medals does the Choctawhatchee High School have?
SELECT MAX(gold_medals) FROM table_1305623_12 WHERE ensemble = "Choctawhatchee High School"
sql_create_context
CREATE TABLE mzjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
SELECT zyjybgb.BBDM, zyjybgb.BBMC, zyjybgb.BBZT FROM zyjybgb WHERE zyjybgb.BGDH = '13992667471' UNION SELECT mzjybgb.BBDM, mzjybgb.BBMC, mzjybgb.BBZT FROM mzjybgb WHERE mzjybgb.BGDH = '13992667471'
css
CREATE TABLE table_14850099_18 ( burmese VARCHAR, cardinal_direction VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Burmese term associated with a cardinal direction of west?
SELECT burmese FROM table_14850099_18 WHERE cardinal_direction = "West"
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title 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 labevents ( r...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', icustays.intime)) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828) AND icustays.outtime IS NULL
mimic_iii
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 AVG(t_kc21.IN_HOSP_DAYS) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1031443' AND t_kc21.IN_HOSP_DATE BETWEEN '2004-01-03' AND '2021-07-10'
css
CREATE TABLE table_name_1 ( score VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Score, when Player is 'Tom Lehman'?
SELECT score FROM table_name_1 WHERE player = "tom lehman"
sql_create_context
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid nu...
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 = 23436 AND admissions.dischtime IS NULL)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items...
mimic_iii
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT jybgb.SHSJ 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 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 qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '88686860' AND t_kc22.STA_DATE BETWEEN '2015-07-07' AND '2018-02-18' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_I...
css
CREATE TABLE table_name_44 ( points VARCHAR, performer VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many points did Nigel Connell have?
SELECT points FROM table_name_44 WHERE performer = "nigel connell"
sql_create_context
CREATE TABLE table_34867 ( "Team" text, "Average" real, "Points" real, "Played" real, "1989-90" text, "1990-91" text, "1991-1992" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of averages where the played is more th...
SELECT SUM("Average") FROM table_34867 WHERE "Played" > '38' AND "1990-91" = '39' AND "1989-90" = '34'
wikisql
CREATE TABLE table_15294880_2 ( stage VARCHAR, winner VARCHAR, points_classification VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many stages were there where the winner and the points classification were Alberto Contador?
SELECT COUNT(stage) FROM table_15294880_2 WHERE winner = "Alberto Contador" AND points_classification = "Alberto Contador"
sql_create_context
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND lab.itemid = "51249"
mimicsql_data
CREATE TABLE table_66484 ( "Rank" real, "Athlete" text, "Country" text, "Time" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What time was the race for the country of france with fb listed under notes?
SELECT "Time" FROM table_66484 WHERE "Notes" = 'fb' AND "Country" = 'france'
wikisql
CREATE TABLE table_69467 ( "Ranking" real, "Nationality" text, "Name" text, "Years" text, "Goals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the years when the ranking is less than 8 with less than 66 goals and name is Paul McGee?
SELECT "Years" FROM table_69467 WHERE "Ranking" < '8' AND "Goals" < '66' AND "Name" = 'paul mcgee'
wikisql
CREATE TABLE table_51071 ( "Date" text, "Distance" text, "Handler" text, "Event" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which event is located in Northfield, Mn?
SELECT "Event" FROM table_51071 WHERE "Location" = 'northfield, mn'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, ...
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 = 18457 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chartevent...
mimic_iii
CREATE TABLE table_name_22 ( car__number INTEGER, sponsor VARCHAR, season VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest car number sponsored by UPS before 2001?
SELECT MIN(car__number) FROM table_name_22 WHERE sponsor = "ups" AND season < 2001
sql_create_context
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, T...
SELECT U.Id, U.DisplayName, COUNT(CASE WHEN P.AcceptedAnswerId IS NULL THEN 1 ELSE NULL END) AS PreguntasSinAceptar, COUNT(CASE WHEN NOT P.AcceptedAnswerId IS NULL THEN 1 ELSE NULL END) AS PreguntasAceptadas FROM Users AS U INNER JOIN Posts AS P ON U.Id = P.OwnerUserId WHERE P.PostTypeId = 1 AND P.AnswerCount > 0 GROUP...
sede
CREATE TABLE table_1728 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name th...
SELECT COUNT("Series") FROM table_1728 WHERE "Date" = 'April 26'
wikisql
CREATE TABLE table_204_109 ( id number, "district" text, "incumbent" text, "party" text, "first\nelected" text, "result" text, "candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many districts are there in virginia ?
SELECT COUNT("district") FROM table_204_109
squall
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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.age < "47"
mimicsql_data
CREATE TABLE table_26468 ( "Confederation" text, "Teams started" text, "Teams that have secured qualification" text, "Teams that can still qualify" text, "Teams that have been eliminated" text, "Remaining places in finals" text, "Total places in finals" text, "Qualifying start date" text...
SELECT COUNT("Qualifying start date") FROM table_26468 WHERE "Confederation" = 'CONCACAF'
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 (SELECT COUNT(*) FROM person_info JOIN hz_info JOIN txmzjzjlb 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 WHERE person_info.XM = '韦英秀' AND txmzjzjlb.JZKSRQ BETWEEN '2018-10-01' AND '2020-08-23' UNION SELECT COUNT(*) FROM p...
css
CREATE TABLE table_name_98 ( game INTEGER, location_attendance VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the least game that was played in Alexander Memorial Coliseum on October 16?
SELECT MIN(game) FROM table_name_98 WHERE location_attendance = "alexander memorial coliseum" AND date = "october 16"
sql_create_context
CREATE TABLE table_name_13 ( attendance VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Attendance has a Result of l12 21?
SELECT attendance FROM table_name_13 WHERE result = "l12–21"
sql_create_context
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 = "CHEST PAIN" AND demographic.days_stay > "1"
mimicsql_data
CREATE TABLE table_name_29 ( nation VARCHAR, silver VARCHAR, total VARCHAR, bronze VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What nation has a total more than 3, with more than 5 for bronze, and less than 4 for the silver?
SELECT nation FROM table_name_29 WHERE total > 3 AND bronze > 5 AND silver < 4
sql_create_context
CREATE TABLE table_203_589 ( id number, "protein" text, "natural host" text, "normal function" text, "prion state" text, "prion phenotype" text, "year identified" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many prions have been cha...
SELECT COUNT("protein") FROM table_203_589
squall
CREATE TABLE table_1805191_34 ( party VARCHAR, first_elected VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which party was elected first in 1998?
SELECT party FROM table_1805191_34 WHERE first_elected = 1998
sql_create_context
CREATE TABLE table_10975034_5 ( position VARCHAR, pick__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of position where the pick number is 43?
SELECT COUNT(position) FROM table_10975034_5 WHERE pick__number = 43
sql_create_context
CREATE TABLE table_12275654_1 ( year INTEGER, mens_singles VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did Chetan Anand win his first men's single?
SELECT MIN(year) FROM table_12275654_1 WHERE mens_singles = "Chetan Anand"
sql_create_context
CREATE TABLE table_15127 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of points for beta team march 1975 and chassis of march 751
SELECT COUNT("Points") FROM table_15127 WHERE "Entrant" = 'beta team march' AND "Year" = '1975' AND "Chassis" = 'march 751'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, ...
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16554) AND prescriptions.drug = 'bisacodyl' AND STRFTIME('%y-%m', prescriptions.startdate) >= '2105-01'
mimic_iii
CREATE TABLE table_57752 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Score with a Home of colorado, and a Date with may 11?
SELECT "Score" FROM table_57752 WHERE "Home" = 'colorado' AND "Date" = 'may 11'
wikisql
CREATE TABLE table_71749 ( "Election" text, "1st Member" text, "1st Party" text, "2nd Member" text, "2nd Party" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which 1st Party has an election in 1847?
SELECT "1st Party" FROM table_71749 WHERE "Election" = '1847'
wikisql
CREATE TABLE table_name_27 ( nation VARCHAR, silver VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What nation has more than 0 silver medals and is ranked 1?
SELECT nation FROM table_name_27 WHERE silver > 0 AND rank = "1"
sql_create_context
CREATE TABLE table_name_42 ( to_par VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the to par when the score is 67-68-76=211?
SELECT to_par FROM table_name_42 WHERE score = 67 - 68 - 76 = 211
sql_create_context
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE author ( authorid int, authorname varchar...
SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE paper.year = 2016 AND venue.venueid = paper.venueid AND venue.venuename = 'emnlp'
scholar
CREATE TABLE table_67688 ( "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 "Club" FROM table_67688 WHERE "Lost" = '9' AND "Tries for" = '55'
wikisql
CREATE TABLE table_61983 ( "Official Name" text, "Status" text, "Area km 2" real, "Population" real, "Census Ranking" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the area of the community with a census ranking of 636 of 5,008?
SELECT AVG("Area km 2") FROM table_61983 WHERE "Census Ranking" = '636 of 5,008'
wikisql
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 hz_info ( KH text, KLX number...
SELECT * FROM hz_info JOIN mzjzjlb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE hz_info.RYBH = '92882146' AND jyjgzbb.JCZBJGDL < jyjgzbb.CKZFWXX OR jyjgzbb...
css
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 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