instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE church ( Church_ID int, Name text, Organized_by text, Open_Date int, Continuation_of text ) CREATE TABLE wedding ( Church_ID int, Male_ID int, Female_ID int, Year int ) CREATE TABLE people ( People_ID int, Name text, Country text, Is_Male text, Age ...
SELECT Country, COUNT(*) FROM people GROUP BY Country
nvbench
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 SUM(t_kc22.AMOUNT) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '葛岚霏' AND t_kc22.t_kc21_CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2001-02-07' AND '2020-08-03' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE table_name_99 ( school VARCHAR, pick VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the School with a Pick that is 24?
SELECT school FROM table_name_99 WHERE pick = 24
sql_create_context
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 qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_NM = '喻茂学' AND qtb.MED_SER_ORG_NO = '8314168' AND NOT qtb.OUT_DIAG_DIS_NM LIKE '%包括%' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_NM = '喻茂学' AND gyb.MED_SER_ORG_NO = '8314168' AND NOT gyb.OUT_DIAG_DIS_NM LIKE '%包括%' UNION SELECT zyb.MED_CLINIC_ID FROM zyb ...
css
CREATE TABLE table_204_633 ( id number, "launch date" text, "operator" text, "name" text, "sample origin" text, "samples returned" text, "recovery date" text, "mission result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many missi...
SELECT COUNT(*) FROM table_204_633 WHERE "name" = 'cosmos 305'
squall
CREATE TABLE table_10718525_2 ( title VARCHAR, us_viewers__millions_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many titles got a viewership of 26.53 million?
SELECT COUNT(title) FROM table_10718525_2 WHERE us_viewers__millions_ = "26.53"
sql_create_context
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_ID = '03719303' AND t_kc22.STA_DATE BETWEEN '2000-12-03' AND '2020-11-15' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_203_283 ( id number, "#" number, "name" text, "strike tone\n(st-1/16)" text, "weight\n(kg)" number, "diameter\n(mm)" number, "inscription" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many bells have weights above 20...
SELECT COUNT("name") FROM table_203_283 WHERE "weight\n(kg)" > 2000
squall
CREATE TABLE table_name_18 ( sponsor VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who sponsors driver neil bonnett?
SELECT sponsor FROM table_name_18 WHERE driver = "neil bonnett"
sql_create_context
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, student_record WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'JUDAIC' AND COURSE_1.number ...
advising
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), ...
SELECT DEPT_CODE, COUNT(*) FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_19508635_1 ( result VARCHAR, theme VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the result for 1980s
SELECT result FROM table_19508635_1 WHERE theme = "1980s"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-50213' AND patient.hospitaldischargetime IS NULL)) AND diagnosis.diagnos...
eicu
CREATE TABLE table_59426 ( "Classification" text, "% of all" text, "John Kerry" text, "John Edwards" text, "Dennis Kucinich" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Dennis Kucinich, when % of All is '53%'?
SELECT "Dennis Kucinich" FROM table_59426 WHERE "% of all" = '53%'
wikisql
CREATE TABLE table_name_57 ( MIN VARCHAR, $10___1_10_oz VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT IS THE LOWEST $25-1/4 OZ COIN WITH A $10-1/10 OZ OF $70,250?
SELECT MIN AS $25___1_4_oz FROM table_name_57 WHERE $10___1_10_oz = "70,250"
sql_create_context
CREATE TABLE table_name_70 ( event VARCHAR, record VARCHAR, round VARCHAR, res VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which event was in round 1, resulted in a win, and a record of 15-4?
SELECT event FROM table_name_70 WHERE round = 1 AND res = "win" AND record = "15-4"
sql_create_context
CREATE TABLE table_38271 ( "NTFA Div 2" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many Losses have an NTFA Div 2 of perth, and Wins smaller than 10?
SELECT COUNT("Losses") FROM table_38271 WHERE "NTFA Div 2" = 'perth' AND "Wins" < '10'
wikisql
CREATE TABLE table_name_36 ( name VARCHAR, transfer_window VARCHAR, moving_to VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the player with a transfer window of summer and was moving to Kortrijk?
SELECT name FROM table_name_36 WHERE transfer_window = "summer" AND moving_to = "kortrijk"
sql_create_context
CREATE TABLE table_39228 ( "Year" real, "Dates" text, "Champion" text, "Country" text, "Score" text, "To par" text, "Margin of victory" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Year is the lowest one that has a To par of 1?
SELECT MIN("Year") FROM table_39228 WHERE "To par" = '–1'
wikisql
CREATE TABLE table_11074 ( "City district (Stadtteil)" text, "Area in km\u00b2" text, "Population" real, "Foreign nationals" real, "Foreign nationals in %" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want to know the total number of population ...
SELECT COUNT("Population") FROM table_11074 WHERE "Foreign nationals in %" = '23,3%'
wikisql
CREATE TABLE table_name_74 ( attendance VARCHAR, home VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Attendance, when Home is Cleveland, and when Date is January 30?
SELECT attendance FROM table_name_74 WHERE home = "cleveland" AND date = "january 30"
sql_create_context
CREATE TABLE table_name_49 ( save VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the save of the game that 23,394 people attended?
SELECT save FROM table_name_49 WHERE attendance = "23,394"
sql_create_context
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE countries ( COUNT...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
nvbench
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 All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY Team_ID
nvbench
CREATE TABLE table_name_30 ( week INTEGER, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Attendance of 48,510 had what highest week?
SELECT MAX(week) FROM table_name_30 WHERE attendance = 48 OFFSET 510
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number...
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-3496')) AND intakeoutput.cellpath LIKE '%intake%' AND DA...
eicu
CREATE TABLE table_name_86 ( labour INTEGER, lib_dem INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the highest Labour with Lib Dem larger than 21?
SELECT MAX(labour) FROM table_name_86 WHERE lib_dem > 21
sql_create_context
CREATE TABLE table_10335_1 ( estimated_deaths VARCHAR, operational VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the estimated deaths with operational period of 17 march 1942 end of june 1943
SELECT estimated_deaths FROM table_10335_1 WHERE operational = "17 March 1942 – end of June 1943"
sql_create_context
CREATE TABLE table_107 ( "Track #" real, "Song" text, "Singers" text, "Picturization" text, "Length" text, "Lyricist" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the lyricist for the song with a length of 3:05?
SELECT "Lyricist" FROM table_107 WHERE "Length" = '3:05'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) 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 diagnoses_icd ( ...
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 = 3097)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial b...
mimic_iii
CREATE TABLE table_3452 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (million)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the original air date of the episode ...
SELECT "Original air date" FROM table_3452 WHERE "Written by" = 'Amanda Segel'
wikisql
CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions_usd number, number_deaths number ) CREATE TABLE affected_region ( region_id number, storm_id number, number_city_affected number ) CREATE TABLE region ( region_id number, r...
SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING COUNT(*) >= 2
spider
CREATE TABLE film_text ( film_id number, title text, description text ) CREATE TABLE staff ( staff_id number, first_name text, last_name text, address_id number, picture others, email text, store_id number, active boolean, username text, password text, last_updat...
SELECT COUNT(*) FROM store
spider
CREATE TABLE table_20860739_1 ( round VARCHAR, height VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many rounds were there a height of 6'5?
SELECT round FROM table_20860739_1 WHERE height = "6'5"
sql_create_context
CREATE TABLE table_name_51 ( school_club_team VARCHAR, nationality VARCHAR, years_for_grizzlies VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the United States team that played for the Grizzlies in 1995-1996?
SELECT school_club_team FROM table_name_51 WHERE nationality = "united states" AND years_for_grizzlies = "1995-1996"
sql_create_context
CREATE TABLE table_45750 ( "SCHOOL" text, "LOCATION" text, "PUBS. 2010" real, "TOTALS 06-10" real, "RANK 06-10" real, "PUBS 2011" real, "TOTALS 07-11" real, "RANK 07-11" real, "WORLD RANKING" text ) -- Using valid SQLite, answer the following questions for the tables provided above...
SELECT AVG("PUBS 2011") FROM table_45750 WHERE "LOCATION" = 'mumbai' AND "TOTALS 07-11" < '1025'
wikisql
CREATE TABLE table_name_78 ( engine VARCHAR, displacement VARCHAR, model VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which of the engines has a displacement of 1,585 cc, with a model number of 90i?
SELECT engine FROM table_name_78 WHERE displacement = "1,585 cc" AND model = "90i"
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.JCRGH, jyjgzbb.JCRXM 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_MZJZJLB W...
css
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org...
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 11732 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE Customers ( Customer_ID INTEGER, Customer_Details VARCHAR(255) ) CREATE TABLE Claims_Documents ( Claim_ID INTEGER, Document_Type_Code CHAR(15), Created_by_Staff_ID INTEGER, Created_Date INTEGER ) CREATE TABLE Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Ty...
SELECT Policy_Type_Code, COUNT(*) FROM Policies GROUP BY Policy_Type_Code ORDER BY Policy_Type_Code DESC
nvbench
CREATE TABLE table_11680175_1 ( year VARCHAR, Neu VARCHAR, vehlefanz VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many years where Neu-Vehlefanz had a number of 365?
SELECT COUNT(year) FROM table_11680175_1 WHERE Neu - vehlefanz = 365
sql_create_context
CREATE TABLE table_1618358_1 ( stamp_duty_reserve_tax VARCHAR, over_total_tax_revenue__in__percentage_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the stamp duty reserve tax when the percentage over total tax revenue is 0.79?
SELECT stamp_duty_reserve_tax FROM table_1618358_1 WHERE over_total_tax_revenue__in__percentage_ = "0.79"
sql_create_context
CREATE TABLE table_80281 ( "Year" real, "Competition" text, "Wins" real, "Draws" real, "Loses" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What sum of Losses has Year greater than 1972, and Competition of nswrfl, and Draws 0, and Wins 16?
SELECT SUM("Loses") FROM table_80281 WHERE "Year" > '1972' AND "Competition" = 'nswrfl' AND "Draws" = '0' AND "Wins" = '16'
wikisql
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 gwyjzb.PERSON_NM, gwyjzb.PERSON_SEX, gwyjzb.PERSON_AGE, gwyjzb.IDENTITY_CARD FROM gwyjzb WHERE gwyjzb.MED_CLINIC_ID = '24731815249' UNION SELECT fgwyjzb.PERSON_NM, fgwyjzb.PERSON_SEX, fgwyjzb.PERSON_AGE, fgwyjzb.IDENTITY_CARD FROM fgwyjzb WHERE fgwyjzb.MED_CLINIC_ID = '24731815249'
css
CREATE TABLE table_23020 ( "Country" text, "Total Drivers" real, "Champions" real, "Championships" real, "Current March 20, 2010" real, "First driver(s)" text, "Last/Current driver(s) March 20, 2010" text ) -- Using valid SQLite, answer the following questions for the tables provided above...
SELECT COUNT("Championships") FROM table_23020 WHERE "Country" = 'Pakistan'
wikisql
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(*) FROM Posts WHERE NOT AcceptedAnswerId IS NULL
sede
CREATE TABLE table_1342149_43 ( result VARCHAR, district VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the election in the Texas 3 district?
SELECT result FROM table_1342149_43 WHERE district = "Texas 3"
sql_create_context
CREATE TABLE table_name_81 ( college_junior_club_team VARCHAR, position VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What college, junior, or club team did defence player Rory Fitzpatrick play for?
SELECT college_junior_club_team FROM table_name_81 WHERE position = "defence" AND player = "rory fitzpatrick"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "1846" AND procedures.short_title = "Bone marrow biopsy"
mimicsql_data
CREATE TABLE table_5462 ( "Season" text, "Races" real, "Wins" real, "Podiums" real, "Poles" real, "Fastest Laps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Poles has a Wins larger than 0, and a Podiums smaller than 17?
SELECT "Poles" FROM table_5462 WHERE "Wins" > '0' AND "Podiums" < '17' AND "Fastest Laps" = '0'
wikisql
CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar ) CREATE TABLE geographic ( city_name varchar, county varchar, reg...
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'mountain view' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
restaurants
CREATE TABLE table_204_883 ( id number, "pos." text, "name" text, "place of birth" text, "date of birth" text, "previous club" text, "date joined" text, "fee" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- name the player whose fee was n...
SELECT "name" FROM table_204_883 WHERE "fee" <> 'free'
squall
CREATE TABLE table_name_24 ( opponent VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which opponent has a Date of july 27?
SELECT opponent FROM table_name_24 WHERE date = "july 27"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Hemochromatosis due to repeated red blood cell transfusions"
mimicsql_data
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CR...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 50480) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-1 year')
mimic_iii
CREATE TABLE table_20824 ( "Gun" text, "m/v ft/s" real, "Shell (lb)" text, "Time to ft (m) at 25\u00b0 (seconds)" text, "Time to ft (m) at 40\u00b0 (seconds)" text, "Time to ft (m) at 55\u00b0 (seconds)" text, "Max. height (ft)" real ) -- Using valid SQLite, answer the following questions ...
SELECT MAX("m/v ft/s") FROM table_20824 WHERE "Time to ft (m) at 55\u00b0 (seconds)" = '22.1'
wikisql
CREATE TABLE table_name_86 ( speed VARCHAR, rank VARCHAR, time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the speed with a time of 1:03.41.86 and a rank smaller than 3?
SELECT speed FROM table_name_86 WHERE rank < 3 AND time = "1:03.41.86"
sql_create_context
CREATE TABLE table_name_7 ( home_team VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the home team score when they played at Victoria Park?
SELECT home_team AS score FROM table_name_7 WHERE venue = "victoria park"
sql_create_context
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
SELECT Id AS "post_link", Score FROM Posts WHERE PostTypeId IN (1, 2) AND Score = 99
sede
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE fare ( fare_id int, from_...
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, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CI...
atis
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 Posts.Id AS "post_link", Body, Score, Tags, Reputation, PostLinks.RelatedPostId AS "post_link" FROM Posts JOIN PostTags ON Posts.Id = PostTags.PostId JOIN Users ON Posts.OwnerUserId = Users.Id LEFT JOIN PostLinks ON Posts.Id = PostLinks.PostId WHERE PostTags.TagId = @tag_id AND AnswerCount = 0 AND PostLinks.Post...
sede
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number...
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 40059) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY labevents.charttime LIMIT 1
mimic_iii
CREATE TABLE Student_Addresses ( student_id INTEGER, address_id INTEGER, date_address_from DATETIME, date_address_to DATETIME, monthly_rental DECIMAL(19,4), other_details VARCHAR(255) ) CREATE TABLE Students ( student_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middl...
SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details, date_address_to ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_52219 ( "Year" text, "Builder" text, "Motors" text, "Trailers" text, "Control Trailers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- I want the control trailers for 1931 with builder of grcw
SELECT "Control Trailers" FROM table_52219 WHERE "Year" = '1931' AND "Builder" = 'grcw'
wikisql
CREATE TABLE table_name_42 ( points INTEGER, chassis VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most points when the chassis was Jaguar R3 later than 2002?
SELECT MAX(points) FROM table_name_42 WHERE chassis = "jaguar r3" AND year > 2002
sql_create_context
CREATE TABLE table_54397 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team did the Red Sox play against on June 3?
SELECT "Opponent" FROM table_54397 WHERE "Date" = 'june 3'
wikisql
CREATE TABLE table_44019 ( "Team" text, "Driver" text, "Class" text, "Chassis" text, "Rounds" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many rounds did germ n s nchez drive in where the chassis was dallara f308?
SELECT "Rounds" FROM table_44019 WHERE "Chassis" = 'dallara f308' AND "Driver" = 'germán sánchez'
wikisql
CREATE TABLE table_204_860 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- did they play at lionel roberts park or andre kampe...
SELECT "venue" FROM table_204_860 WHERE "venue" IN ('lionel roberts park', 'andre kamperveen stadion') GROUP BY "venue" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_name_14 ( date VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what Date was the Opponent Panathinaikos?
SELECT date FROM table_name_14 WHERE opponent = "panathinaikos"
sql_create_context
CREATE TABLE table_24765 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the series ...
SELECT MAX("No. in series") FROM table_24765 WHERE "U.S. viewers (millions)" = '17.04'
wikisql
CREATE TABLE table_name_8 ( losses INTEGER, points VARCHAR, draws VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average number of losses for teams with under 16 points and under 3 draws?
SELECT AVG(losses) FROM table_name_8 WHERE points < 16 AND draws < 3
sql_create_context
CREATE TABLE table_name_2 ( year VARCHAR, chassis VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number of years for chassis of ensign n175
SELECT COUNT(year) FROM table_name_2 WHERE chassis = "ensign n175"
sql_create_context
CREATE TABLE table_24769 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original airdate" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the title o...
SELECT "Title" FROM table_24769 WHERE "Directed by" = 'William Webb'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE c...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE STRFTIME('%y', admissions.admittime) = '2100'
mimic_iii
CREATE TABLE table_73300 ( "Team name" text, "Races" real, "Won" real, "RR1 Pts." real, "RR2 Pts." real, "RR3 Pts." real, "Total Pts." real, "Ranking" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the ranking for rr2 pts being 8
SELECT "Ranking" FROM table_73300 WHERE "RR2 Pts." = '8'
wikisql
CREATE TABLE table_71108 ( "Date" text, "Time" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Total" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which set 3 has a Time of 10:00, and a Score of 3 2, and a...
SELECT "Set 3" FROM table_71108 WHERE "Time" = '10:00' AND "Score" = '3–2' AND "Total" = '113–102'
wikisql
CREATE TABLE table_68301 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's Chick Harbert's To par?
SELECT "To par" FROM table_68301 WHERE "Player" = 'chick harbert'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, d...
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 = 14987 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartev...
mimic_iii
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "ABDOMINAL ABSCESS" AND procedures.icd9_code = "4591"
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 mzjzjlb ( HXPLC number, HZXM ...
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB AND zyjybgb.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDSM = '急性支气管炎' AND jyjgzbb.JCZBMC = '触珠蛋白' UNION SELECT jyjgzbb.CKZFWXX...
css
CREATE TABLE table_name_32 ( name VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Name was in the Year 2001?
SELECT name FROM table_name_32 WHERE year = "2001"
sql_create_context
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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 ...
SELECT COUNT(mzjzjlb.ZZYSGH) FROM hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_...
css
CREATE TABLE hz_info_zyjzjlb ( JZLSH number, YLJGDM number, zyjzjlb_id number ) 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 ...
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 NOT mzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2006-11-17')
css
CREATE TABLE member_of_club ( clubid VARCHAR, stuid VARCHAR, position VARCHAR ) CREATE TABLE student ( fname VARCHAR, lname VARCHAR, stuid VARCHAR ) CREATE TABLE club ( clubid VARCHAR, clubname VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided ab...
SELECT t3.fname, t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" AND t2.position = "CTO"
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 COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '021-250695' AND patient.hospitaladmitsource = 'emergency department' AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-6 year')
eicu
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserD...
SELECT * FROM Tags ORDER BY Count DESC
sede
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
nvbench
CREATE TABLE table_9465 ( "Rank" real, "Airport" text, "Location" text, "IATA" text, "1985\u201386" real, "1990\u201391" real, "1995\u201396" real, "2000\u201301" real, "2005\u201306" real, "2007\u201308" real, "2009\u201310" real, "2010-11" real ) -- Using valid SQLite...
SELECT COUNT("2010-11") FROM table_9465 WHERE "Rank" > '11'
wikisql
CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE...
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 = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER'...
atis
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 demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CATHOLIC" AND lab.label = "pH"
mimicsql_data
CREATE TABLE table_name_33 ( social_democratic VARCHAR, democratic_and_social_centre VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Social Democratic has a Democratic and Social Centre of 10.0% 22 seats?
SELECT social_democratic FROM table_name_33 WHERE democratic_and_social_centre = "10.0% 22 seats"
sql_create_context
CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAUKEE' AND flight.departure_time = 720 AND flight.to_airport = AIRPORT_SERVICE_1.air...
atis
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE date_day ( month_number int, d...
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, fare_basis, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND ...
atis
CREATE TABLE media_types ( id INTEGER, name VARCHAR(120) ) CREATE TABLE playlists ( id INTEGER, name VARCHAR(120) ) CREATE TABLE playlist_tracks ( playlist_id INTEGER, track_id INTEGER ) CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20), first_name VARCHAR(20), title ...
SELECT name, COUNT(name) FROM playlists GROUP BY name ORDER BY name
nvbench
CREATE TABLE table_77688 ( "Production no." real, "Episode no." real, "Original Airdate" text, "Episode Title" text, "Host" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the episode number of the episode that originally aired on January 26,...
SELECT COUNT("Episode no.") FROM table_77688 WHERE "Original Airdate" = 'january 26, 2009' AND "Production no." < '38'
wikisql
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 MAX(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.admission_type = "ELECTIVE"
mimicsql_data
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '7265817' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY SUM(t_kc22.AMOUNT) DESC LIMIT 24 UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.ME...
css
CREATE TABLE table_name_6 ( attendance INTEGER, visitor VARCHAR, leading_scorer VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people attended the game when Larry Hughes(33) was the leading scorer and cleveland was visiting?
SELECT SUM(attendance) FROM table_name_6 WHERE visitor = "cleveland" AND leading_scorer = "larry hughes(33)"
sql_create_context
CREATE TABLE table_2660 ( "Performance comparison" text, "78 Fury" text, "78 Monaco" text, "79 St. Regis" text, "80 St. Regis" text, "81 St. Regis" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is every performance comparison if the value ...
SELECT "Performance comparison" FROM table_2660 WHERE "81 St. Regis" = '114.7'
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 WHERE demographic.admission_type = "ELECTIVE" AND procedures.short_title = "Incision of aorta"
mimicsql_data