instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime 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 d_icd_di...
mimic_iii
CREATE TABLE table_name_33 ( genre VARCHAR, developer_s_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What game was developed by Naughty Dog?
SELECT genre FROM table_name_33 WHERE developer_s_ = "naughty dog"
sql_create_context
CREATE TABLE table_50514 ( "Rank" real, "Name" text, "Team(s)" text, "Birth date" text, "Death date" text, "Age (as of 1 February 2014)" text, "Nationality" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is at rank 9?
SELECT "Name" FROM table_50514 WHERE "Rank" = '9'
wikisql
CREATE TABLE table_name_2 ( event VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- which Event that has an Opponent of kendall grove?
SELECT event FROM table_name_2 WHERE opponent = "kendall grove"
sql_create_context
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases IN...
SELECT Area, COUNT(Area) FROM appellations GROUP BY Area
nvbench
CREATE TABLE table_15436 ( "Week" text, "Theme" text, "Song choice" text, "Original artist" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For Vegas Verdicts week, what was the result?
SELECT "Result" FROM table_15436 WHERE "Week" = 'vegas verdicts'
wikisql
CREATE TABLE table_54003 ( "Player" text, "Pos." text, "From" real, "School/Country" text, "Rebs" real, "Asts" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the school for player who began in 1986, has fewer rebounds than 711 and plays ...
SELECT "School/Country" FROM table_54003 WHERE "From" < '1986' AND "Rebs" < '711' AND "Pos." = 'f'
wikisql
CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar ) CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city varchar, latitude varchar, longitude varchar, review_count bigint, is_open tinyint, rating...
SELECT COUNT(DISTINCT (tip.text)) FROM tip, user WHERE tip.year = 2010 AND user.name = 'Michelle' AND user.user_id = tip.user_id
yelp
CREATE TABLE table_11963601_11 ( series VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the series count at for game 5?
SELECT series FROM table_11963601_11 WHERE game = 5
sql_create_context
CREATE TABLE table_name_40 ( points INTEGER, record VARCHAR, november VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Points have a Record of 12 2 4 1, and a November larger than 22?
SELECT AVG(points) FROM table_name_40 WHERE record = "12–2–4–1" AND november > 22
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_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '41409860' AND t_kc22.STA_DATE BETWEEN '2015-07-29' AND '2017-10-29' AND t_kc22.SELF_PAY_AMO > 2206.93
css
CREATE TABLE table_name_65 ( draw VARCHAR, points VARCHAR, place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times is the points 8 and the place larger than 8?
SELECT COUNT(draw) FROM table_name_65 WHERE points = 8 AND place > 8
sql_create_context
CREATE TABLE table_78051 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which away team has a home score of 14.21 (105)?...
SELECT "Away team" FROM table_78051 WHERE "Home team score" = '14.21 (105)'
wikisql
CREATE TABLE movie ( budget_million INTEGER, YEAR INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average, maximum, and minimum budget for all movies before 2000.
SELECT AVG(budget_million), MAX(budget_million), MIN(budget_million) FROM movie WHERE YEAR < 2000
sql_create_context
CREATE TABLE table_name_61 ( label VARCHAR, catalogue_number_s_ VARCHAR, country VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Label has a Country of united kingdom, a Date of 22 september 2008, and a Catalogue number(s) of eredv...
SELECT label FROM table_name_61 WHERE country = "united kingdom" AND date = "22 september 2008" AND catalogue_number_s_ = "eredv711"
sql_create_context
CREATE TABLE table_203_675 ( id number, "match" number, "date" text, "round" text, "home/away" text, "opponent team" text, "score" text, "scorers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the score of each match in october...
SELECT "score" FROM table_203_675 WHERE "date" = 10
squall
CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, ...
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code)
nvbench
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, ...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 31243 AND admissions.admission_location = 'clinic referral/premature' AND STRFTIME('%y', admissions.admittime) >= '2105' ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE allergy_type ( allergy text, allergytype text ) CREATE TABLE has_allergy ( stuid number, allergy text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) -- Using valid SQLite...
SELECT stuid FROM student WHERE age = (SELECT MAX(age) FROM student)
spider
CREATE TABLE table_17392 ( "No. in series" text, "No. in season" text, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the season number o...
SELECT "No. in season" FROM table_17392 WHERE "Title" = 'Grad School'
wikisql
CREATE TABLE table_28815 ( "Western" text, "Central" text, "Eastern" text, "Old Galician (13th\u201315th c.)" text, "Portuguese" text, "Spanish" text, "Latin" text, "English" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Lat...
SELECT "Latin" FROM table_28815 WHERE "English" = 'you sang'
wikisql
CREATE TABLE table_name_62 ( average INTEGER, interview VARCHAR, evening_gown VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of averages with an interview of 8.75 when the evening gown number was bigger than 8.75?
SELECT SUM(average) FROM table_name_62 WHERE interview = 8.75 AND evening_gown > 8.75
sql_create_context
CREATE TABLE table_name_90 ( tournaments INTEGER, highest_rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Tournaments, when Highest Rank is 'Maegashira 1'?
SELECT AVG(tournaments) FROM table_name_90 WHERE highest_rank = "maegashira 1"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, expectorated' AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
eicu
CREATE TABLE table_66460 ( "District" text, "s Barangay" real, "Population (2010 census)" real, "Area ( has .)" real, "Pop. density (per km2)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest population density for the district of S...
SELECT MIN("Pop. density (per km2)") FROM table_66460 WHERE "District" = 'santa cruz' AND "s Barangay" > '82'
wikisql
CREATE TABLE table_5090 ( "Station Code" text, "Station Name" text, "Arrival" text, "Departure" text, "Platform" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Station Name of the Arrival Starting Station?
SELECT "Station Name" FROM table_5090 WHERE "Arrival" = 'starting station'
wikisql
CREATE TABLE table_36563 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School/Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which School/Club Team has a Round larger than 16?
SELECT "School/Club Team" FROM table_36563 WHERE "Round" > '16'
wikisql
CREATE TABLE table_27653955_1 ( ihsa_music_class VARCHAR, mascot VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the IHSA music class for the mascot that is the lancers?
SELECT ihsa_music_class FROM table_27653955_1 WHERE mascot = "Lancers"
sql_create_context
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 8773 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
mimic_iii
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 jyjgzbb.JCFF FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy...
css
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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_icd_diag...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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_...
mimic_iii
CREATE TABLE table_55984 ( "Name" text, "Current version" text, "System" text, "Platform" text, "License" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Platform has a Current Version 0.6.2?
SELECT "Platform" FROM table_55984 WHERE "Current version" = '0.6.2'
wikisql
CREATE TABLE table_name_7 ( score VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Score of the Competition with a Result of 5-0?
SELECT score FROM table_name_7 WHERE result = "5-0"
sql_create_context
CREATE TABLE employees ( first_name VARCHAR, last_name VARCHAR, salary INTEGER, department_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- display the department ID, full name (first and last name), salary for those employees who is highest salary ...
SELECT first_name, last_name, salary, department_id, MAX(salary) FROM employees GROUP BY department_id
sql_create_context
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
SELECT * FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy...
css
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 MIN(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.ethnicity = "ASIAN"
mimicsql_data
CREATE TABLE table_53257 ( "Player" text, "Car." real, "Yards" text, "Avg." text, "Long" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who has a highest Long with 26 Yards and less than 9 Car?
SELECT MAX("Long") FROM table_53257 WHERE "Yards" = '26' AND "Car." < '9'
wikisql
CREATE TABLE cinema ( LOCATION VARCHAR, capacity INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show all the locations with at least two cinemas with capacity above 300.
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) >= 2
sql_create_context
CREATE TABLE table_22875369_3 ( irish_points VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the irish points for 23-1 record
SELECT irish_points FROM table_22875369_3 WHERE record = "23-1"
sql_create_context
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-153669') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) <= '2103' GROUP BY STRFTIME('%y', patient.unitadmit...
eicu
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid 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 = 9566)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate...
mimic_iii
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversa...
SELECT Name, 'number of votes', year FROM (SELECT COUNT(*) AS "number of votes", VoteTypeId, YEAR(CreationDate) AS year FROM Votes GROUP BY VoteTypeId, YEAR(CreationDate)) AS a INNER JOIN VoteTypes ON a.VoteTypeId = Id ORDER BY VoteTypeId, year
sede
CREATE TABLE table_36183 ( "Games" real, "Drawn" real, "Lost" real, "Points difference" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the greatest points value that have draws under 2 and 2 losses?
SELECT MAX("Points") FROM table_36183 WHERE "Drawn" < '2' AND "Lost" = '2'
wikisql
CREATE TABLE table_37910 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of the game with a record of 33 25 9?
SELECT "Score" FROM table_37910 WHERE "Record" = '33–25–9'
wikisql
CREATE TABLE list ( lastname text, firstname text, grade number, classroom number ) CREATE TABLE teachers ( lastname text, firstname text, classroom number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Count the number of students the teacher L...
SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "LORIA" AND T2.lastname = "ONDERSMA"
spider
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "20" AND prescriptions.formulary_drug_cd = "IPRA2H"
mimicsql_data
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 number, charttime time, valuenum number, valueuom text ) CREATE TABLE c...
SELECT patients.gender FROM patients WHERE patients.subject_id = 43779
mimic_iii
CREATE TABLE table_name_36 ( score VARCHAR, tie_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score when there were 7 ties?
SELECT score FROM table_name_36 WHERE tie_no = "7"
sql_create_context
CREATE TABLE table_52520 ( "Ceremony" text, "Award" text, "Category" text, "Nominee" text, "Outcome" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What ceremony was leela chitnis nominated at?
SELECT "Ceremony" FROM table_52520 WHERE "Outcome" = 'nominated' AND "Nominee" = 'leela chitnis'
wikisql
CREATE TABLE table_name_2 ( week VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the week number with attendance of 44,132?
SELECT COUNT(week) FROM table_name_2 WHERE attendance = 44 OFFSET 132
sql_create_context
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code...
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9833) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '10' ORDE...
mimic_iii
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 diagnosis ( diagn...
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE STRFTIME('%y', diagnosis.diagnosistime) <= '2103' GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 4
eicu
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/HAITIAN" AND demographic.diagnosis = "COPD EXACERBATION"
mimicsql_data
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE T...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, 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.i...
mimic_iii
CREATE TABLE customer_address_history ( customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR ) CREATE TABLE customers ( customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- S...
SELECT customer_name, customer_phone FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_address_history)
sql_create_context
CREATE TABLE table_47316 ( "Title" text, "Parent magazine" text, "Magazine type" text, "Frequency" text, "First published" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the type of the magazine that was named dengeki game appli?
SELECT "Magazine type" FROM table_47316 WHERE "Title" = 'dengeki game appli'
wikisql
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAd...
WITH TotalsByTag(tagName, totalUpVotes, totalDownVotes) AS (SELECT Tags.TagName, totalUpVotes = SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), totalDownVotes = SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Votes ON Votes.PostId = PostTags.PostId W...
sede
CREATE TABLE gwyjzb ( 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 COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '55185411' AND t_kc22.STA_DATE BETWEEN '2003-04-12' AND '2008-09-25' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE f...
css
CREATE TABLE table_204_362 ( id number, "episode" number, "airdate" text, "game 1" text, "game 2" text, "game 3" text, "viewers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what are the airdates for episode 1 and 2 ?
SELECT "airdate" FROM table_204_362 WHERE "episode" IN (1, 2)
squall
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE procedures_icd ( r...
SELECT patients.dob FROM patients WHERE patients.subject_id = 45601
mimic_iii
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime t...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2957 AND admissions.dischtime IS NULL)) AND transfers....
mimic_iii
CREATE TABLE table_name_11 ( artist VARCHAR, issue_price VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Artist has an Issue Price of $8,159.95?
SELECT artist FROM table_name_11 WHERE issue_price = "$8,159.95"
sql_create_context
CREATE TABLE Attribute_Definitions ( attribute_id INTEGER, attribute_name VARCHAR(30), attribute_data_type VARCHAR(10) ) CREATE TABLE Catalog_Structure ( catalog_level_number INTEGER, catalog_id INTEGER, catalog_level_name VARCHAR(50) ) CREATE TABLE Catalog_Contents_Additional_Attributes ( ...
SELECT attribute_name, COUNT(attribute_name) FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0 GROUP BY attribute_name ORDER BY attribute_name
nvbench
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE diagnosis ( diagnosisid number...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '032-24135' AND patient.wardid = 1068 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE table_5409 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Where did the competition take place at on August 3, 2005 with a score of 5-0?
SELECT "Venue" FROM table_5409 WHERE "Score" = '5-0' AND "Date" = 'august 3, 2005'
wikisql
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) -- Using valid SQLite, answer the following questions fo...
SELECT Type, COUNT(Type) FROM ship GROUP BY Type ORDER BY Type DESC
nvbench
CREATE TABLE table_36341 ( "Wind Farm" text, "Scheduled" text, "Capacity (MW)" real, "Turbines" real, "Type" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the scheduled value for the farm having a capacity under 32.5MW,...
SELECT "Scheduled" FROM table_36341 WHERE "Capacity (MW)" < '32.5' AND "Type" = 'nordex n90 2.5mw' AND "Wind Farm" = 'glenough extension'
wikisql
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 demographic.admission_type, demographic.admission_location FROM demographic WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_27397948_2 ( title VARCHAR, no_in_series VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List all titles with a 57 series number.
SELECT title FROM table_27397948_2 WHERE no_in_series = 57
sql_create_context
CREATE TABLE table_2492 ( "Year" real, "Date" text, "Driver" text, "Team" text, "Manufacturer" text, "Laps" text, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above...
SELECT "Miles (km)" FROM table_2492 WHERE "Average Speed (mph)" = '103.145'
wikisql
CREATE TABLE table_50311 ( "Opposing Team" text, "Against" real, "Date" text, "Venue" text, "Status" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Date, when Status is Second Test?
SELECT "Date" FROM table_50311 WHERE "Status" = 'second test'
wikisql
CREATE TABLE table_name_33 ( team VARCHAR, laps VARCHAR, time_retired VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Team has Laps of 100, and a Time/Retired of +8.6 secs?
SELECT team FROM table_name_33 WHERE laps = 100 AND time_retired = "+8.6 secs"
sql_create_context
CREATE TABLE table_38395 ( "Name" text, "Years of Operation" text, "Location" text, "Historical Photos" text, "Year Clubhouse Constructed" text, "Sign-in/Bicker" text, "Year co-ed" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the S...
SELECT "Sign-in/Bicker" FROM table_38395 WHERE "Location" = 'wash50 on washington rd'
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 jyjgzbb ( BGDH text, BGRQ tim...
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJ...
css
CREATE TABLE table_name_29 ( visitor VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who visited on november 17?
SELECT visitor FROM table_name_29 WHERE date = "november 17"
sql_create_context
CREATE TABLE table_9194 ( "Member" text, "Party" text, "Electorate" text, "State" text, "Term of office" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the term of office for noel beaton?
SELECT "Term of office" FROM table_9194 WHERE "Member" = 'noel beaton'
wikisql
CREATE TABLE table_16640 ( "Rd." real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Constructor" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the rd for the canadian grand prix...
SELECT "Rd." FROM table_16640 WHERE "Grand Prix" = 'Canadian Grand Prix'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patient...
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-154299')) ORDER BY treatment.treatmenttime DESC LIMIT 1
eicu
CREATE TABLE table_11754 ( "Block A" text, "Gran Hamada" text, "Koji Kanemoto" text, "Jushin Liger" text, "Masaaki Mochizuki" text, "Super Shocker" text, "Tatsuhito Takaiwa" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Tatsuhito Taka...
SELECT "Tatsuhito Takaiwa" FROM table_11754 WHERE "Koji Kanemoto" = 'liger (20:29)'
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 (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 = 14211) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents...
mimic_iii
CREATE TABLE table_59646 ( "Golden Rivers" 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 total losses when Hay is the golden river and there are more than 2 byes...
SELECT COUNT("Losses") FROM table_59646 WHERE "Golden Rivers" = 'hay' AND "Byes" > '2'
wikisql
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 procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Central venous catheter placement with guidance" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
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_CLINIC_ID text, MED_DIRE_CD tex...
SELECT COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '55722979' AND t_kc22.STA_DATE BETWEEN '2001-09-01' AND '2015-06-25' AND gwyjzb.MED_SER_ORG_NO = '5394717' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CL...
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.MED_SER_ORG_NO = '1885024' AND t_kc22.SOC_SRT_DIRE_NM = '木丹颗粒' UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.MED_SER_ORG_NO = '1885024' AND t_kc22.SOC_SRT_DIRE_NM = '木丹颗粒' UNION ...
css
CREATE TABLE table_name_19 ( engine VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What engine was for the vehicle with a cooper t43 chassis?
SELECT engine FROM table_name_19 WHERE chassis = "cooper t43"
sql_create_context
CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM tex...
(SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGD...
css
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquep...
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195541')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.c...
eicu
CREATE TABLE Employee ( eid VARCHAR ) CREATE TABLE Certificate ( eid VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show ids for all employees who don't have a certificate.
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate
sql_create_context
CREATE TABLE table_50879 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the lowest lab for Gilera with a grid less than 12?
SELECT MIN("Laps") FROM table_50879 WHERE "Manufacturer" = 'gilera' AND "Grid" < '12'
wikisql
CREATE TABLE table_47287 ( "Tournament" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the tournament with a 2r in 2009 a...
SELECT "Tournament" FROM table_47287 WHERE "2009" = '2r' AND "2010" = '2r'
wikisql
CREATE TABLE mountain ( Range VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the range that has the most number of mountains.
SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student ( student_id int, lastname varchar, ...
SELECT DISTINCT course.department, course.name, course.number FROM program_course INNER JOIN course ON program_course.course_id = course.course_id WHERE course.department = 'PROSTHOD'
advising
CREATE TABLE table_28293 ( "Browser" text, "Operating system" text, "Latest stable release" text, "Theora" text, "H.264" text, "VP8 ( WebM )" text, "VP9 ( WebM )" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When vp8 ( webm ) is 6.0, how m...
SELECT "VP9 ( WebM )" FROM table_28293 WHERE "VP8 ( WebM )" = '6.0'
wikisql
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId...
SELECT PostId, up = SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), down = SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) FROM Votes WHERE VoteTypeId IN (2, 3) GROUP BY PostId
sede
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate ...
SELECT COUNT(*) AS TotalUsers FROM Users WHERE LOWER(Location) LIKE LOWER('%##NombrePais##%')
sede
CREATE TABLE table_37884 ( "States" text, "Fall 05" real, "Fall 06" real, "Fall 07" real, "Fall 08" real, "Fall 09" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What number is Fall 06 from the state with 34 for Fall 09?
SELECT AVG("Fall 06") FROM table_37884 WHERE "Fall 09" = '34'
wikisql
CREATE TABLE table_name_29 ( year_built VARCHAR, location_of_the_church VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what year was the church located in flor built?
SELECT year_built FROM table_name_29 WHERE location_of_the_church = "florø"
sql_create_context
CREATE TABLE table_29141354_5 ( first_broadcast VARCHAR, andrew_and_jacks_guest VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When were episodes first broadcast with jessica ennis as andrew and jacks guest?
SELECT first_broadcast FROM table_29141354_5 WHERE andrew_and_jacks_guest = "Jessica Ennis"
sql_create_context
CREATE TABLE table_name_19 ( gold VARCHAR, bronze VARCHAR, silver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many gold medals were awarded to the team with more than 2 bronze and exactly 29 silver medals?
SELECT gold FROM table_name_19 WHERE bronze > 2 AND silver = 29
sql_create_context
CREATE TABLE table_10231 ( "Date" text, "Venue" text, "Opponent" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the venue for the game on 10-09-2012?
SELECT "Venue" FROM table_10231 WHERE "Date" = '10-09-2012'
wikisql