instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, ...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'aspirin chew tab 81 mg')
eicu
CREATE TABLE table_name_85 ( team__league_ VARCHAR, player VARCHAR, reg_gp VARCHAR, pick__number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which team has a Reg GP of 0, a pick number under 136 with a player named Regan Darby?
SELECT team__league_ FROM table_name_85 WHERE reg_gp = 0 AND pick__number < 136 AND player = "regan darby"
sql_create_context
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TA...
SELECT COUNT(*) FROM Votes WHERE PostId IS NULL
sede
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 d_labitems ( row_id number, itemid number, label te...
SELECT t3.drug FROM (SELECT t2.drug, 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 = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
mimic_iii
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 OUT_DIAG_DIS_CD, OUT_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_NM = '卫若兰' AND MED_SER_ORG_NO = '6106826' AND OUT_DIAG_DOC_NM LIKE '谢%'
css
CREATE TABLE table_name_39 ( points INTEGER, chassis VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most points that the Maserati 250F chassis scored in years after 1955?
SELECT MAX(points) FROM table_name_39 WHERE chassis = "maserati 250f" AND year > 1955
sql_create_context
CREATE TABLE table_21690339_1 ( country VARCHAR, _percentage_cut VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country had a 100% cut?
SELECT country FROM table_21690339_1 WHERE _percentage_cut = "100%"
sql_create_context
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_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '19212040551' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY SUM(t_kc22.SELF_PAY_AMO) DES...
css
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, ...
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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
atis
CREATE TABLE table_name_98 ( father VARCHAR, husband VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which father had william iv as a husband?
SELECT father FROM table_name_98 WHERE husband = "william iv"
sql_create_context
CREATE TABLE table_204_476 ( id number, "name" text, "date built" number, "builder" text, "works no." number, "wheels" text, "cylinders" text, "notes" text, "withdrawn" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- was no. 1 or ve...
SELECT "name" FROM table_204_476 WHERE "name" IN ('no.1', 'veteran') AND "date built" = 1847
squall
CREATE TABLE party_events ( Event_ID int, Event_Name text, Party_ID int, Member_in_charge_ID int ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE member ( Member_ID int, Member_Name tex...
SELECT Party_name, COUNT(*) FROM member AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID ORDER BY Party_name
nvbench
CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_...
SELECT date, SUM(mean_humidity) FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
nvbench
CREATE TABLE table_name_19 ( chassis VARCHAR, entrant VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the company that made the chassis for the entrant danka arrows yamaha?
SELECT chassis FROM table_name_19 WHERE entrant = "danka arrows yamaha"
sql_create_context
CREATE TABLE table_31088 ( "Year" real, "Number of tropical storms" real, "Number of hurricanes" real, "Number of major hurricanes" real, "Deaths" text, "Strongest storm" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many deaths did the yea...
SELECT "Deaths" FROM table_31088 WHERE "Number of hurricanes" = '10' AND "Number of major hurricanes" = '1'
wikisql
CREATE TABLE party ( Party_ID int, Party_Theme text, Location text, First_year text, Last_year text, Number_of_hosts int ) CREATE TABLE party_host ( Party_ID int, Host_ID int, Is_Main_in_Charge bool ) CREATE TABLE host ( Host_ID int, Name text, Nationality text, Age...
SELECT Last_year, COUNT(Last_year) FROM party WHERE Party_Theme = "Spring" OR Party_Theme = "Teqnology" GROUP BY Last_year ORDER BY COUNT(Last_year) DESC
nvbench
CREATE TABLE table_name_92 ( category VARCHAR, year VARCHAR, award VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the category for 2012 and drama league award
SELECT category FROM table_name_92 WHERE year = 2012 AND award = "drama league award"
sql_create_context
CREATE TABLE table_23670057_4 ( year_born INTEGER, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date of birth for basket baller called ido kozikaro
SELECT MAX(year_born) FROM table_23670057_4 WHERE player = "Ido Kozikaro"
sql_create_context
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ...
SELECT p.Id FROM Posts AS p WHERE (p.PostTypeId = 1 AND NOT p.ClosedDate IS NULL AND p.Score <= '##maxscore##' AND p.ViewCount <= '##maxviews##' AND p.Tags LIKE '%##tag##%' AND DATEDIFF(day, p.ClosedDate, GETDATE()) >= '##mindays##' AND '##maxscore##' >= ALL (SELECT a.Score FROM Posts AS a WHERE (a.ParentId = p.Id)) AN...
sede
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Subarachnoid hemorrhage" AND lab.fluid = "Pleural"
mimicsql_data
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.gender = "M" AND demographic.dob_year < "2024"
mimicsql_data
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
SELECT pt.Name AS "Type", COUNT(p.Id) AS "Total", CAST(ROUND(COUNT(CASE WHEN p.Score > 0 THEN 1 ELSE NULL END) / CAST(COUNT(p.Id) AS FLOAT) * 100, 4) AS TEXT(7)) + '%' AS "+", CAST(ROUND(COUNT(CASE WHEN p.Score = 0 THEN 1 ELSE NULL END) / CAST(COUNT(p.Id) AS FLOAT) * 100, 4) AS TEXT(7)) + '%' AS "0", CAST(ROUND(COUNT(C...
sede
CREATE TABLE table_36751 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much Played has a Lost larger than 14, and ...
SELECT SUM("Played") FROM table_36751 WHERE "Lost" > '14' AND "Drawn" = '8' AND "Team" = 'ipatinga'
wikisql
CREATE TABLE constructorStandings ( constructorid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the numbers of races for each constructor id?
SELECT COUNT(*), constructorid FROM constructorStandings GROUP BY constructorid
sql_create_context
CREATE TABLE table_64466 ( "Season" real, "Level" text, "Division" text, "Administration" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Level has a Season larger than 2010?
SELECT "Level" FROM table_64466 WHERE "Season" > '2010'
wikisql
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC 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 jybgb.BGDH ...
css
CREATE TABLE table_name_19 ( district VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What district is Wyatt Aiken in?
SELECT district FROM table_name_19 WHERE incumbent = "wyatt aiken"
sql_create_context
CREATE TABLE table_59313 ( "Portland DFL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average entry in the against column with draws smaller than 0?
SELECT AVG("Against") FROM table_59313 WHERE "Draws" < '0'
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 AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-30487')) AND intakeoutput.celllabel = 'actua...
eicu
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_CLINIC_ID FROM t_kc21 WHERE PERSON_ID = '71205137' AND MED_SER_ORG_NO = '9220092' AND NOT OUT_DIAG_DIS_NM LIKE '%2%'
css
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-424' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) ORDER BY patient.unitadmittime DESC LIMIT 1
eicu
CREATE TABLE table_train_186 ( "id" int, "language" string, "diabetic" string, "regular_alcohol_intake" int, "allergy_to_drug" bool, "alcohol_abuse" bool, "age" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- history of hy...
SELECT * FROM table_train_186 WHERE allergy_to_drug = 1
criteria2sql
CREATE TABLE table_204_634 ( id number, "tour" number, "official title" text, "venue" text, "city" text, "date\nstart" text, "date\nfinish" text, "prize money\nusd" number, "report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- whic...
SELECT "official title" FROM table_204_634 WHERE "official title" <> 'french super series' AND "prize money\nusd" = (SELECT "prize money\nusd" FROM table_204_634 WHERE "official title" = 'french super series')
squall
CREATE TABLE table_24471 ( "Team" text, "Sport" text, "League" text, "Established" real, "Began in St. Louis" real, "Venue" text, "Championships in St. Louis" text, "Left St. Louis" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many...
SELECT "Championships in St. Louis" FROM table_24471 WHERE "Sport" = 'Arena Football'
wikisql
CREATE TABLE table_203_694 ( id number, "#" number, "name" text, "took office" text, "left office" text, "party" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who was the only prime minister to be in office three times ?
SELECT "name" FROM table_203_694 GROUP BY "name" HAVING COUNT(*) >= 3
squall
CREATE TABLE table_2417 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Midshipmen points" real, "Opponents" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most opponents for 8-1 record
SELECT MAX("Opponents") FROM table_2417 WHERE "Record" = '8-1'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) -- Using valid SQLite, answer the following questions for the...
SELECT Founder, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Revenue)
nvbench
CREATE TABLE table_name_70 ( date VARCHAR, score_in_final VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what Date was the Score in Final 6 3, 6 3?
SELECT date FROM table_name_70 WHERE score_in_final = "6–3, 6–3"
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
SELECT * FROM person_info JOIN hz_info JOIN zzmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE person_info.XM = '范梦竹' AND hz_info.YLJGDM = '4362119' AND zzmzjzjlb.JZZDSM LIKE '%牙髓炎%' UNION SELECT * FROM person_info JOIN ...
css
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE i...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-66442')) AND medication.drugname = '30 ml cup : alum & mag hydroxide-s...
eicu
CREATE TABLE table_name_75 ( points INTEGER, year VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Points is the lowest one that has a Year larger than 1974, and a Rank of 15th?
SELECT MIN(points) FROM table_name_75 WHERE year > 1974 AND rank = "15th"
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2125" AND diagnoses.long_title = "Abrasion or friction burn of trunk, without mention of infection"
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 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 60136 AND admissions.dischtime IS NULL
mimic_iii
CREATE TABLE table_39888 ( "Match No." text, "Home Team" text, "Score" text, "Away Team" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the home team of the game that ended with a score of 0-1?
SELECT "Home Team" FROM table_39888 WHERE "Score" = '0-1'
wikisql
CREATE TABLE table_77550 ( "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 score when the NY Islanders was the visiting team?
SELECT "Score" FROM table_77550 WHERE "Visitor" = 'ny islanders'
wikisql
CREATE TABLE products_for_hire ( product_description VARCHAR, product_id VARCHAR ) CREATE TABLE products_booked ( product_id VARCHAR, booked_amount VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the product description of the product booked ...
SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = 102.76
sql_create_context
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.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' AND semester.semester_id = course...
advising
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 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '006-195316' AND patient.wardid = 386 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
SELECT * FROM Users LIMIT 100
sede
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor ORDER BY COUNT(*)
nvbench
CREATE TABLE table_203_288 ( id number, "season" text, "premiere date" text, "the winner" text, "runner-up" text, "finalists" text, "contestants in order of elimination" text, "number of contestants" text, "number of concerts" number ) -- Using valid SQLite, answer the following qu...
SELECT MIN("number of concerts") FROM table_203_288
squall
CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions_usd number, number_deaths number ) CREATE TABLE region ( region_id number, region_code text, region_name text ) CREATE TABLE affected_region ( region_id number, storm_id nu...
SELECT COUNT(DISTINCT region_id) FROM affected_region
spider
CREATE TABLE table_45174 ( "Circuit" text, "Location / State" text, "Date" text, "Round winner" text, "Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what team did John Bowe round winner at Winton Motor Raceway belong to?
SELECT "Team" FROM table_45174 WHERE "Round winner" = 'john bowe' AND "Circuit" = 'winton motor raceway'
wikisql
CREATE TABLE table_204_592 ( id number, "#" number, "title" text, "type" text, "opening\ndate" text, "closing\ndate" text, "performances" number, "comment" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which production has the same numb...
SELECT "title" FROM table_204_592 WHERE "title" <> 'sleuth' AND "performances" = (SELECT "performances" FROM table_204_592 WHERE "title" = 'sleuth')
squall
CREATE TABLE table_44576 ( "Skip" text, "Third" text, "Second" text, "Lead" text, "City" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE CITY WITH THIRD AS LORI OLSON-JOHNS?
SELECT "City" FROM table_44576 WHERE "Third" = 'lori olson-johns'
wikisql
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 IN_DIAG_DIS_CD, IN_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_ID = '82162201'
css
CREATE TABLE table_name_75 ( away VARCHAR, club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is NK Rijeka's away score?
SELECT away FROM table_name_75 WHERE club = "nk rijeka"
sql_create_context
CREATE TABLE table_name_10 ( hard VARCHAR, record VARCHAR, carpet VARCHAR, clay VARCHAR, grass VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which hard has a Clay of 0 0, Grass of 0 0, Carpet of 0 0, and a Record of 1 0?
SELECT hard FROM table_name_10 WHERE clay = "0–0" AND grass = "0–0" AND carpet = "0–0" AND record = "1–0"
sql_create_context
CREATE TABLE artist ( name VARCHAR, year_join VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show all artist names and the year joined who are not from United States.
SELECT name, year_join FROM artist WHERE country <> 'United States'
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 diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "Cortisol"
mimicsql_data
CREATE TABLE table_39336 ( "Rank" real, "Country/Territory" text, "Miss World" real, "1st Runner-up" real, "2nd Runner-up" real, "3rd Runner-up" real, "4th Runner-up" real, "5th Runner-up" real, "6th Runner-up" real, "Semifinalists" real, "Total" real ) -- Using valid SQLit...
SELECT MIN("1st Runner-up") FROM table_39336 WHERE "Rank" > '3' AND "6th Runner-up" > '0' AND "5th Runner-up" < '1'
wikisql
CREATE TABLE table_50351 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real, "Money ( $ )" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much money for 1st place with a to par less than 1?
SELECT COUNT("Money ( $ )") FROM table_50351 WHERE "Place" = '1' AND "To par" < '1'
wikisql
CREATE TABLE table_name_93 ( tournament VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What tournament was on May 31, 1987?
SELECT tournament FROM table_name_93 WHERE date = "may 31, 1987"
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "80" AND diagnoses.long_title = "Late effects of cerebrovascular disease, hemiplegia affecting unspecified side"
mimicsql_data
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) 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,...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, date_day, days, flight, flight_stop WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'INDIA...
atis
CREATE TABLE table_name_71 ( height VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the height of the player, Larry Hughes?
SELECT height FROM table_name_71 WHERE player = "larry hughes"
sql_create_context
CREATE TABLE table_25740548_2 ( written_by VARCHAR, production_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many episodes with the production code CA106 are there?
SELECT COUNT(written_by) FROM table_25740548_2 WHERE production_code = "CA106"
sql_create_context
CREATE TABLE table_9034 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the outcome of the match on 01/07/2007?
SELECT "Outcome" FROM table_9034 WHERE "Date" = '01/07/2007'
wikisql
CREATE TABLE table_74458 ( "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. -- In how...
SELECT COUNT("Game") FROM table_74458 WHERE "High rebounds" = 'Oliver Miller (7)'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost numb...
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14467) AND NOT transfers.wardid IS NULL AND DATETIME(transfers.intime) >= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY transfers.intime DESC LIMIT 1
mimic_iii
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE compartment_class ( ...
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 = 'PHILADELPHIA' AND date_day.day_number = 23 AND date_day.month_number = 4 ...
atis
CREATE TABLE table_67604 ( "Name" text, "League" real, "Play-offs" real, "FA Cup" real, "League Cup" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the FA Cup that has a league less than 1?
SELECT SUM("FA Cup") FROM table_67604 WHERE "League" < '1'
wikisql
CREATE TABLE table_name_83 ( school VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- County of 46 laporte is what school?
SELECT school FROM table_name_83 WHERE county = "46 laporte"
sql_create_context
CREATE TABLE table_26545 ( "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 episode number in the...
SELECT MIN("No. in series") FROM table_26545 WHERE "Title" = 'Dance to the Music'
wikisql
CREATE TABLE table_name_7 ( attendance INTEGER, opponents VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the attendance when Cork City is the opponent?
SELECT AVG(attendance) FROM table_name_7 WHERE opponents = "cork city"
sql_create_context
CREATE TABLE table_name_60 ( opponents VARCHAR, partnering VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Opponents have a Partnering of alessandro motti, and a Date of 12 september 2005?
SELECT opponents FROM table_name_60 WHERE partnering = "alessandro motti" AND date = "12 september 2005"
sql_create_context
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE ReviewTaskStates ( Id number, ...
SELECT Ans.CreationDate, Qus.Tags, Qus.Title, Qus.ViewCount, Ans.Score, Ans.Id, Qus.AcceptedAnswerId FROM Posts AS Qus LEFT JOIN Posts AS Ans ON Qus.Id = Ans.ParentId WHERE Ans.OwnerUserId = 5720148 ORDER BY Ans.CreationDate DESC
sede
CREATE TABLE torrents ( groupname text, totalsnatched number, artist text, groupyear number, releasetype text, groupid number, id number ) CREATE TABLE tags ( index number, id number, tag text ) -- Using valid SQLite, answer the following questions for the tables provided abov...
SELECT COUNT(*) FROM (SELECT groupname FROM torrents GROUP BY groupname HAVING COUNT(*) > 1)
whatcdhiphop
CREATE TABLE table_203_737 ( id number, "#" number, "employer" text, "# of employees" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many employers have at least 300 employees ?
SELECT COUNT("employer") FROM table_203_737 WHERE "# of employees" >= 300
squall
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 OUT_DIAG_DIS_CD, OUT_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_NM = '邹清舒' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc24 WHERE MED_AMOUT > 1552.66)
css
CREATE TABLE table_75368 ( "Country" text, "Project Name" text, "Year startup" text, "Operator" text, "Peak" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Project Name with a Country that is kazakhstan and a Peak that is 150?
SELECT "Project Name" FROM table_75368 WHERE "Country" = 'kazakhstan' AND "Peak" = '150'
wikisql
CREATE TABLE table_name_5 ( week VARCHAR, result VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Week had a Result of w 10-0, and an Attendance smaller than 58,571?
SELECT COUNT(week) FROM table_name_5 WHERE result = "w 10-0" AND attendance < 58 OFFSET 571
sql_create_context
CREATE TABLE news_report ( journalist_id number, event_id number, work_type text ) CREATE TABLE journalist ( journalist_id number, name text, nationality text, age text, years_working number ) CREATE TABLE event ( event_id number, date text, venue text, name text, e...
SELECT nationality FROM journalist ORDER BY years_working DESC LIMIT 1
spider
CREATE TABLE table_1879 ( "Sl no" real, "Name of the prabandham" text, "Starting from" real, "Ending with" real, "Number of pasurams" real, "Sung by" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most ending with
SELECT MAX("Ending with") FROM table_1879
wikisql
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGD...
SELECT CKZFWDX, CKZFWXX, CKZFWSX FROM jyjgzbb WHERE JYZBLSH = '14290376283'
css
CREATE TABLE table_13861 ( "Competition" text, "Total" real, "Al Ahly wins" real, "Draws" real, "El Zamalek wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the fewest Al Ahly wins for El Zamalek wins of 0 and 0 draws?
SELECT MIN("Al Ahly wins") FROM table_13861 WHERE "Draws" = '0' AND "El Zamalek wins" < '0'
wikisql
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) -- Using valid SQLite, answer the following questions for the...
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name DESC
nvbench
CREATE TABLE table_name_21 ( title VARCHAR, appointed_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Title has an Appointed by of Millard Fillmore?
SELECT title FROM table_name_21 WHERE appointed_by = "millard fillmore"
sql_create_context
CREATE TABLE table_36662 ( "Season" real, "Driver" text, "Team" text, "Tyre" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the driver for team Coll Racing with more than 206 points?
SELECT "Driver" FROM table_36662 WHERE "Team" = 'collé racing' AND "Points" > '206'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) 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), ...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE d...
SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-20205')) AND lab.labname = 'ast (sgot)' AND DATETIME(lab.labresulttime, 'start of y...
eicu
CREATE TABLE table_54538 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the UEFA Euro 2008 Qualifying competition?
SELECT "Result" FROM table_54538 WHERE "Competition" = 'uefa euro 2008 qualifying'
wikisql
CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE documents_with_expenses ( document_id number, budget_type_code text, document_details text ) CREATE TABLE accounts ( account_id number, statement_id number,...
SELECT COUNT(*) FROM ref_budget_codes
spider
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE T...
SELECT EMAIL, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID DESC
nvbench
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "81201" AND prescriptions.route = "IH"
mimicsql_data
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 transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype tex...
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'coronar arteriogr-1 cath') AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-2 year')
mimic_iii
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTas...
SELECT Posts, COUNT(*) AS Qty FROM (SELECT OwnerUserId, COUNT(OwnerUserId) AS Posts FROM Posts AS P WHERE P.PostTypeId = 1 OR P.PostTypeId = 2 GROUP BY OwnerUserId) AS SUB WHERE Posts > 0 GROUP BY Posts ORDER BY Posts
sede
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 COUNT(*) FROM zyb WHERE zyb.MED_TYPE = '6176731' AND zyb.IN_HOSP_DAYS BETWEEN '2009-12-18' AND '2011-08-05'
css
CREATE TABLE table_21497 ( "Season" text, "Games" real, "GS" real, "Points" text, "Rebounds" text, "Assists" text, "Blocks" text, "Steals" text, "Turnovers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the assists for 157 game...
SELECT "Assists" FROM table_21497 WHERE "Games" = '157'
wikisql
CREATE TABLE table_name_51 ( fcc_info VARCHAR, city_of_license VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the FCC info of the translator with an Irmo, South Carolina city license?
SELECT fcc_info FROM table_name_51 WHERE city_of_license = "irmo, south carolina"
sql_create_context