instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_93 ( player VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player is from south africa?
SELECT player FROM table_name_93 WHERE country = "south africa"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, a...
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE laptimes ( raceid number, driverid number, lap number, position number, time text, milliseconds number ) CREATE TABLE results ( resultid number, raceid number, driverid number, constructorid number, number number, grid number, position number, positi...
SELECT T1.forename, T1.surname, T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 8 UNION SELECT T1.forename, T1.surname, T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 5
spider
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sc30feng' AND d_ite...
mimic_iii
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "3" AND prescriptions.drug = "Morphine Sulfate SR"
mimicsql_data
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT T1.Code, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter
nvbench
CREATE TABLE table_76792 ( "Pick" real, "Pos." text, "Nationality" text, "Team" text, "Previous team" text, "NBA years [a ]" text, "Career with the franchise [b ]" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many NBA years did the pla...
SELECT "NBA years [a ]" FROM table_76792 WHERE "Nationality" = 'united states' AND "Previous team" = 'los angeles lakers'
wikisql
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, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY procedur...
mimic_iii
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT School_ID, All_Games_Percent FROM basketball_match GROUP BY Team_Name
nvbench
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.religion = "ROMANIAN EAST. ORTH" AND diagnoses.long_title = "Accidents occurring in other specified places"
mimicsql_data
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime tim...
SELECT diagnoses_icd.charttime FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'nb obsrv suspct infect') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 62918 AND NOT admis...
mimic_iii
CREATE TABLE match ( Round real, Location text, Country text, Date text, Fastest_Qualifying text, Winning_Pilot text, Winning_Aircraft text ) CREATE TABLE aircraft ( Aircraft_ID int(11), Aircraft varchar(50), Description varchar(50), Max_Gross_Weight varchar(50), Total_d...
SELECT Aircraft, COUNT(*) FROM aircraft AS T1 JOIN match AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft
nvbench
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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...
SELECT SUM(t_kc21.MED_AMOUT) FROM t_kc21 WHERE t_kc21.PERSON_ID = '60303885' AND t_kc21.CLINIC_TYPE = '门诊'
css
CREATE TABLE table_24673 ( "State Rank by Revenue" real, "Company Name" text, "National Rank" real, "Revenue ($billions) 2012 estimate" text, "Headquarters City" text, "Known for" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where is the compa...
SELECT "Headquarters City" FROM table_24673 WHERE "Revenue ($billions) 2012 estimate" = '33.3'
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.admityear < "2203"
mimicsql_data
CREATE TABLE table_28972 ( "Species" text, "Common Name" text, "Protein Name" text, "Accession Number" text, "NT Length" text, "NT Identity" text, "AA Length" text, "AA Identity" text, "E-Value" text ) -- Using valid SQLite, answer the following questions for the tables provided ab...
SELECT COUNT("Common Name") FROM table_28972 WHERE "Accession Number" = 'XP_001843282'
wikisql
CREATE TABLE appointment ( appointmentid VARCHAR, START VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the id of the appointment with the most recent start date?
SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1
sql_create_context
CREATE TABLE table_69962 ( "Season" text, "Team" text, "Racing team" text, "Chassis" text, "Engine" text, "Tyres" text, "Drivers" text, "Wins" text, "Sprints wins" text, "Main wins" text, "Poles" text, "Fastest Laps" text, "Points" text ) -- Using valid SQLite, answ...
SELECT "Wins" FROM table_69962 WHERE "Engine" = 'zytek' AND "Racing team" = 'super nova racing'
wikisql
CREATE TABLE table_25369796_1 ( position VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many team position scored 56 points?
SELECT COUNT(position) FROM table_25369796_1 WHERE points = "56"
sql_create_context
CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paperdataset ( paperid int, datase...
SELECT DISTINCT paper.paperid FROM journal, paper WHERE journal.journalname = 'Academic radiology' AND paper.journalid = journal.journalid AND paper.year = 1995
scholar
CREATE TABLE table_26464364_1 ( us_viewers__million_ VARCHAR, production_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many million U.S. viewers watched the episode with the production code 3x6004?
SELECT us_viewers__million_ FROM table_26464364_1 WHERE production_code = "3X6004"
sql_create_context
CREATE TABLE table_2570269_3 ( episode_title VARCHAR, original_air_date__uk_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title of the episode that aired on 13 august 1981?
SELECT episode_title FROM table_2570269_3 WHERE original_air_date__uk_ = "13 August 1981"
sql_create_context
CREATE TABLE table_name_40 ( laps VARCHAR, qual VARCHAR, rank VARCHAR, time_retired VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What laps have a rank larger than 13 and the Time/Retired is accident, and a Qual smaller than 136.98?
SELECT laps FROM table_name_40 WHERE rank > 13 AND time_retired = "accident" AND qual < 136.98
sql_create_context
CREATE TABLE table_21481 ( "Year" real, "West Manila" text, "East Manila" text, "Consumer Price Index (2005=100)" text, "West Manila as a share of 1996 real tariff" text, "East Manila as a share of 1996 real tariff" text ) -- Using valid SQLite, answer the following questions for the tables pr...
SELECT "East Manila as a share of 1996 real tariff" FROM table_21481 WHERE "Consumer Price Index (2005=100)" = '119.4'
wikisql
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text...
SELECT meter_200, COUNT(meter_200) FROM swimmer GROUP BY meter_200 ORDER BY COUNT(meter_200) DESC
nvbench
CREATE TABLE table_name_86 ( score VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What score has 12/1 as the date?
SELECT score FROM table_name_86 WHERE date = "12/1"
sql_create_context
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 jobs ( JOB_ID varchar(...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(SALARY) DESC
nvbench
CREATE TABLE table_34202 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date was the visitor chicago black hawks, and a Record of 1-1?
SELECT "Date" FROM table_34202 WHERE "Visitor" = 'chicago black hawks' AND "Record" = '1-1'
wikisql
CREATE TABLE table_24301 ( "Census division" text, "Area (km\u00b2)" text, "Pop. (2011)" real, "Pop. (2006)" real, "Pop. (2001)" real, "Pop. (1996)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different results of the population coun...
SELECT COUNT("Pop. (2001)") FROM table_24301 WHERE "Pop. (1996)" = '880859'
wikisql
CREATE TABLE table_23248910_6 ( high_points VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who scored the highest points and how much against the raptors?
SELECT high_points FROM table_23248910_6 WHERE team = "Raptors"
sql_create_context
CREATE TABLE club ( Club_ID int, name text, Region text, Start_year text ) CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, Silver real, Bronze real, Total real ) CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps rea...
SELECT Position, COUNT(*) FROM player WHERE Points < 30 GROUP BY Position
nvbench
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Persistent postoperative fistula" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, ...
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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU...
atis
CREATE TABLE table_name_26 ( january VARCHAR, region VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the January climate figure for Eastman?
SELECT january FROM table_name_26 WHERE region = "eastman"
sql_create_context
CREATE TABLE table_name_89 ( points VARCHAR, engine VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many points for maserati v12 engines in 1968?
SELECT COUNT(points) FROM table_name_89 WHERE engine = "maserati v12" AND year = 1968
sql_create_context
CREATE TABLE table_name_2 ( no_result VARCHAR, wins VARCHAR, losses VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT kind of No Result has Wins smaller than 2, and Losses larger than 1?
SELECT no_result FROM table_name_2 WHERE wins < 2 AND losses > 1
sql_create_context
CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER, Customer_Policy_ID INTEGER ) CREATE TABLE Payments ( Payment_ID INTEGER, Settlement_ID INTEGER, Payment_Method_Code ...
SELECT Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY Amount_Payment DESC
nvbench
CREATE TABLE table_9404 ( "Country" text, "Date" text, "Label" text, "Format" text, "Catalog" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Country has a Label of Toshiba-emi and a Catalog of vjcp-68403?
SELECT "Country" FROM table_9404 WHERE "Label" = 'toshiba-emi' AND "Catalog" = 'vjcp-68403'
wikisql
CREATE TABLE table_42547 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Opponent in the final when the outcome was runner-up?
SELECT "Opponent in the final" FROM table_42547 WHERE "Outcome" = 'runner-up'
wikisql
CREATE TABLE table_203_663 ( id number, "country" text, "zone" text, "national federation" text, "#gm" number, "#fide" number, "national championship" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the total number of countries on th...
SELECT COUNT("country") FROM table_203_663
squall
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Coronar arteriogr-1 cath"
mimicsql_data
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE PROFESSOR ( EMP_N...
SELECT DEPT_CODE, COUNT(*) FROM PROFESSOR WHERE PROF_HIGH_DEGREE = 'Ph.D.' GROUP BY DEPT_CODE ORDER BY COUNT(*)
nvbench
CREATE TABLE table_50414 ( "City" text, "State" text, "2010 population" text, "Peak population (year)" text, "Numeric decline from peak population" text, "Percent decline from peak population" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what ...
SELECT "Peak population (year)" FROM table_50414 WHERE "City" = 'scranton'
wikisql
CREATE TABLE country ( country_id number, country_name text, capital text, official_native_language text ) CREATE TABLE team ( team_id number, name text ) CREATE TABLE match_season ( season number, player text, position text, country number, team number, draft_pick_numb...
SELECT T1.official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.country_id = T2.country WHERE T2.college = "Maryland" OR T2.college = "Duke"
spider
CREATE TABLE party ( Party VARCHAR, Party_ID VARCHAR ) CREATE TABLE election ( Party VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the name of the party that has the most delegates.
SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2139" AND lab.label = "Base Excess"
mimicsql_data
CREATE TABLE table_31061 ( "Character" text, "Original Cast, 2009" text, "Revival Cast, 2010" text, "Wales Cast, 2012" text, "New Zealand Cast, 2012" text, "Australian Cast, 2012" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In the 2012 Wales ...
SELECT "Wales Cast, 2012" FROM table_31061 WHERE "Australian Cast, 2012" = 'Clementine Mills'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE transfers ( row_id number, subject_id number, had...
SELECT chartevents.charttime 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 = 5142)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial ...
mimic_iii
CREATE TABLE table_13259034_2 ( week INTEGER, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what week was November 27, 1977?
SELECT MAX(week) FROM table_13259034_2 WHERE date = "November 27, 1977"
sql_create_context
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
SELECT JOB_TITLE, MAX_SALARY - MIN_SALARY FROM jobs WHERE MAX_SALARY BETWEEN 12000 AND 18000
nvbench
CREATE TABLE table_63171 ( "Japanese Title" text, "Romaji Title" text, "TV Station" text, "Episodes" real, "Average Ratings" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Romaji Title has 11 Episodes, and a TV Station of fuji tv, and Average ...
SELECT "Romaji Title" FROM table_63171 WHERE "Episodes" = '11' AND "TV Station" = 'fuji tv' AND "Average Ratings" = '14.9%'
wikisql
CREATE TABLE table_31262 ( "Name" text, "Number" real, "Position" text, "Height" text, "Weight" real, "Year" text, "Hometown" text, "Last School/College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what year is chris mcnamara?
SELECT "Year" FROM table_31262 WHERE "Name" = 'Chris McNamara'
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 food_service ( meal_code text, meal_number int, compartment text, meal_descriptio...
SELECT DISTINCT airline_code FROM airline WHERE airline_code IN (SELECT FLIGHTalias0.airline_code FROM flight AS FLIGHTalias0 WHERE FLIGHTalias0.to_airport IN (SELECT AIRPORT_SERVICEalias0.airport_code FROM airport_service AS AIRPORT_SERVICEalias0 WHERE AIRPORT_SERVICEalias0.city_code IN (SELECT CITYalias0.city_code FR...
atis
CREATE TABLE table_name_55 ( event VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which event had Edson Claas Vieira as an opponent?
SELECT event FROM table_name_55 WHERE opponent = "edson claas vieira"
sql_create_context
CREATE TABLE diagnoses ( 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 ) C...
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.long_title = "Osteoporosis, unspecified" AND lab.flag = "abnormal"
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 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 WHERE demographic.dob_year < "2094" AND diagnoses.short_title = "Anemia in chr kidney dis"
mimicsql_data
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 jybgb ( BBCJBW text, BBDM tex...
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND 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 mzjzj...
css
CREATE TABLE table_22052 ( "# s Dam and GNIS query Link" real, "# s Lake and GNIS query Link" real, "# s Reservoir and GNIS query Link" real, "Borough or Census area" text, "Comment" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many number of ...
SELECT MIN("# s Lake and GNIS query Link") FROM table_22052 WHERE "Borough or Census area" = 'Valdez-Cordova (CA)'
wikisql
CREATE TABLE table_name_64 ( silver INTEGER, nation VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the silver for Germany and less than 2?
SELECT AVG(silver) FROM table_name_64 WHERE nation = "germany" AND rank < 2
sql_create_context
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_co...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
mimic_iii
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 (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83182 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'phosphate') ORDER BY labevents.charttim...
mimic_iii
CREATE TABLE Payments ( Payment_ID INTEGER, Settlement_ID INTEGER, Payment_Method_Code VARCHAR(255), Date_Payment_Made DATE, Amount_Payment INTEGER ) CREATE TABLE Customer_Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATE, End_Date DAT...
SELECT T1.Customer_Details, T1.Customer_ID FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID ORDER BY T1.Customer_ID DESC
nvbench
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 cost ( costid num...
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-91239' AND patient.hospitaldischargetime IS NULL))
eicu
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE COURSE ( CRS_CODE...
SELECT PROF_OFFICE, COUNT(PROF_OFFICE) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION, PROF_OFFICE ORDER BY COUNT(PROF_OFFICE)
nvbench
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE View_Unit_Status ( apt_id INTEG...
SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
nvbench
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 jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN mzjzjlb_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 = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND mzjzjl...
css
CREATE TABLE job_history ( employee_id number, start_date time, end_date time, job_id text, department_id number ) CREATE TABLE countries ( country_id text, country_name text, region_id number ) CREATE TABLE regions ( region_id number, region_name text ) CREATE TABLE jobs ( ...
SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC
spider
CREATE TABLE table_38581 ( "Designation HD" text, "Constellation" text, "Date sent" text, "Arrival date" text, "Message" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date sent has cygnus as a constellation, and hd 190360 as a designation HD?
SELECT "Date sent" FROM table_38581 WHERE "Constellation" = 'cygnus' AND "Designation HD" = 'hd 190360'
wikisql
CREATE TABLE camera_lens ( id int, brand text, name text, focal_length_mm real, max_aperture real ) CREATE TABLE mountain ( id int, name text, Height real, Prominence real, Range text, Country text ) CREATE TABLE photos ( id int, camera_lens_id int, mountain_id ...
SELECT brand, COUNT(brand) FROM camera_lens GROUP BY brand ORDER BY COUNT(brand) 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 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 = "F" AND demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH"
mimicsql_data
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE VoteTypes ( Id number, Name text...
SELECT Id AS "post_link", OwnerUserId AS "user_link", CreationDate AS "Date Posted", Score, Body FROM Posts WHERE PostTypeId = 2 AND NOT Body LIKE '%http%' AND NOT Body LIKE '%blockquote%' ORDER BY CreationDate DESC
sede
CREATE TABLE table_name_78 ( species VARCHAR, length__bp_aa_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Species has a Length (bp/aa) of 1154bp/358aa?
SELECT species FROM table_name_78 WHERE length__bp_aa_ = "1154bp/358aa"
sql_create_context
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 microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-4987' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient....
eicu
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY All_Home
nvbench
CREATE TABLE table_name_82 ( driver VARCHAR, sponsor VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who drives for the sponsor w.h. bolin?
SELECT driver FROM table_name_82 WHERE sponsor = "w.h. bolin"
sql_create_context
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(SALARY)
nvbench
CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE files ( f_id number, artist_name text, file_size text, duration text, formats text ) CREATE TABLE artist ( artist_name text, country text, gender text, preferred_genre text ) CREATE TABL...
SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "bangla" GROUP BY T2.artist_name ORDER BY COUNT(*) DESC LIMIT 3
spider
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
advising
CREATE TABLE web_client_accelerator ( name VARCHAR, operating_system VARCHAR, CONNECTION VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the name and os of web client accelerators that do not work with only a 'Broadband' type connection?
SELECT name, operating_system FROM web_client_accelerator WHERE CONNECTION <> 'Broadband'
sql_create_context
CREATE TABLE table_16799784_12 ( year_named INTEGER, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest year named for the name Tie Fluctus?
SELECT MAX(year_named) FROM table_16799784_12 WHERE name = "Tie Fluctus"
sql_create_context
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
SELECT A.Id AS "post_link", A.Score, U.DisplayName FROM Posts AS A JOIN Posts AS Q ON A.ParentId = Q.Id JOIN Users AS U ON A.OwnerUserId = U.Id WHERE YEAR(A.CreationDate) = 2018 AND NOT Q.Tags LIKE '%tips%' AND NOT EXISTS(SELECT * FROM Posts AS A2 WHERE A2.ParentId = Q.Id AND CAST((JULIANDAY(CreationDate) - JULIANDAY(Q...
sede
CREATE TABLE table_60240 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the date of the 42 Against?
SELECT "Date" FROM table_60240 WHERE "Against" = '42'
wikisql
CREATE TABLE table_73891 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- the first episode in this season had what number in th...
SELECT MIN("No. in series") FROM table_73891
wikisql
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
SELECT mzjzjlb.JZLSH 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 hz_info.YLJGDM = '0564335' AND mzjzjlb.JZKSMC LIKE '%免疫科%'
css
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "10" AND lab.fluid = "Other Body Fluid"
mimicsql_data
CREATE TABLE table_25468 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who di...
SELECT "High points" FROM table_25468 WHERE "Date" = 'December 2'
wikisql
CREATE TABLE table_name_74 ( high_rebounds VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who had the most rebounds in the game against New York?
SELECT high_rebounds FROM table_name_74 WHERE opponent = "new york"
sql_create_context
CREATE TABLE table_name_48 ( margin_of_victory VARCHAR, runner_s__up VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the margin of victory when the runner-up was Janet Coles?
SELECT margin_of_victory FROM table_name_48 WHERE runner_s__up = "janet coles"
sql_create_context
CREATE TABLE table_48549 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the home team against the away team Norwich City?
SELECT "Home team" FROM table_48549 WHERE "Away team" = 'norwich city'
wikisql
CREATE TABLE table_204_56 ( id number, "year" number, "song" text, "us r&b" number, "us rap" number, "album" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- songs by del the funky homosapien that were within the top 30 rap singles chart -lrb- us ...
SELECT "song" FROM table_204_56 WHERE "us rap" <= 30
squall
CREATE TABLE table_43870 ( "Score" text, "Batsmen" text, "Against" text, "Location" text, "Year" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score in 1929?
SELECT "Score" FROM table_43870 WHERE "Year" = '1929'
wikisql
CREATE TABLE table_name_26 ( country VARCHAR, to_par VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Country is Player Sam Snead with a To par of less than 5 from?
SELECT country FROM table_name_26 WHERE to_par < 5 AND player = "sam snead"
sql_create_context
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 gsi ( course_offering_id int, student_id int ) CREATE TABLE instructor ( ...
SELECT DISTINCT course.department, course.name, course.number, program_course.workload FROM course, program, program_course WHERE program_course.course_id = course.course_id AND program.name LIKE 'CS-LSA' AND program.program_id = program_course.program_id
advising
CREATE TABLE table_12995531_3 ( episode_number INTEGER, total_viewers VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the episode number where the total viewers is 614000?
SELECT MIN(episode_number) FROM table_12995531_3 WHERE total_viewers = 614000
sql_create_context
CREATE TABLE table_name_32 ( total VARCHAR, nation VARCHAR, place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total of Greece, which is placed below 8?
SELECT COUNT(total) FROM table_name_32 WHERE nation = "greece" AND place > 8
sql_create_context
CREATE TABLE table_26736342_1 ( directed_by VARCHAR, us_viewers__millions_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who directed the eposide that was watched by 1.95 million US viewers?
SELECT directed_by FROM table_26736342_1 WHERE us_viewers__millions_ = "1.95"
sql_create_context
CREATE TABLE table_name_19 ( elected INTEGER, incumbent VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was Incumbent Ed Towns elected with a district smaller than 10?
SELECT AVG(elected) FROM table_name_19 WHERE incumbent = "ed towns" AND district < 10
sql_create_context
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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = j...
css
CREATE TABLE table_name_13 ( league VARCHAR, position VARCHAR, goals VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Position of 7th of 24, and a Goals smaller than 24 is what league?
SELECT league FROM table_name_13 WHERE position = "7th of 24" AND goals < 24
sql_create_context
CREATE TABLE table_204_111 ( id number, "name" text, "animal type" text, "introduced" number, "reintroduced" text, "retired" number, "beanie baby resembled" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which animal type has the most pillow...
SELECT "animal type" FROM table_204_111 GROUP BY "animal type" ORDER BY COUNT("name") DESC LIMIT 1
squall