instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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 d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'family hx-breast malig') AND DATETIME(diagnoses_icd.chartt...
mimic_iii
CREATE TABLE table_name_42 ( driver VARCHAR, car__number VARCHAR, make VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who drove the dodge with a car # less than 5?
SELECT driver FROM table_name_42 WHERE car__number < 5 AND make = "dodge"
sql_create_context
CREATE TABLE table_55994 ( "Pick" real, "Player" text, "Team" text, "Position" text, "School" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Team has a Pick of 40?
SELECT "Team" FROM table_55994 WHERE "Pick" = '40'
wikisql
CREATE TABLE table_46442 ( "Date" text, "Opponent" text, "Score" text, "Result" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result for the date of august 23?
SELECT "Result" FROM table_46442 WHERE "Date" = 'august 23'
wikisql
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewTaskResults ( Id number, Review...
SELECT Jahr, SUM(Anzahl) AS Gesamt, MIN(Anzahl) AS minimal, MAX(Anzahl) AS maximal, AVG(Anzahl) AS Schnitt FROM (SELECT YEAR(CreationDate) AS Jahr, MONTH(CreationDate) AS Monat, COUNT(*) AS Anzahl FROM Users AS U1 GROUP BY YEAR(CreationDate), MONTH(CreationDate)) AS T_TAGESANMELDUNG GROUP BY Jahr ORDER BY Jahr
sede
CREATE TABLE table_56572 ( "Particle" text, "Symbol" text, "Makeup" text, "Rest mass MeV / c 2" text, "Isospin I" text, "Spin ( Parity ) J P" text, "Commonly decays to" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Particle has a Rest...
SELECT "Particle" FROM table_56572 WHERE "Rest mass MeV / c 2" = '1192.642(24)'
wikisql
CREATE TABLE table_train_18 ( "id" int, "with_cardiac_pacemaker" bool, "neuromuscular_disease" bool, "diabetic_polyneuropathy" bool, "body_mass_index_bmi" float, "age" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- body mass ...
SELECT * FROM table_train_18 WHERE body_mass_index_bmi <= 35
criteria2sql
CREATE TABLE table_3931 ( "Round" real, "Race" text, "Pole position" text, "Fastest lap" text, "Most laps led" text, "Driver" text, "Team" text, "Manufacturer" text, "Report" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who manufac...
SELECT "Manufacturer" FROM table_3931 WHERE "Driver" = 'Will Power' AND "Most laps led" = 'Scott Dixon'
wikisql
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
SELECT jyjgzbb.JYZBLSH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON 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.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz...
css
CREATE TABLE table_12962773_10 ( position VARCHAR, current_club VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many players currently play for Barons Riga?
SELECT COUNT(position) FROM table_12962773_10 WHERE current_club = "Barons Riga"
sql_create_context
CREATE TABLE table_name_88 ( pick__number VARCHAR, name VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Pick # that has a Name of jaimie thomas, and a Round smaller than 7 is how many numbers?
SELECT COUNT(pick__number) FROM table_name_88 WHERE name = "jaimie thomas" AND round < 7
sql_create_context
CREATE TABLE table_name_15 ( race VARCHAR, group VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the race of the jockey in na group in 4th place?
SELECT race FROM table_name_15 WHERE group = "na" AND result = "4th"
sql_create_context
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE Comments ( Id number, PostId number, Score number, ...
SELECT q.Id AS "post_link", 'https://stackoverflow.com/questions/' + CAST(q.Id AS TEXT) AS "Link", a.CreationDate FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE a.OwnerUserId = 1531124 AND q.AcceptedAnswerId IS NULL
sede
CREATE TABLE table_8166 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game site" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the opponent on May 25, 2007?
SELECT "Opponent" FROM table_8166 WHERE "Date" = 'may 25, 2007'
wikisql
CREATE TABLE table_53740 ( "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. -- Who was the home team at the game where the crow...
SELECT "Home team" FROM table_53740 WHERE "Crowd" > '10,000' AND "Home team score" = '7.13 (55)'
wikisql
CREATE TABLE table_1497 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Giants points" real, "Opponents" real, "Record" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most attendance for giants po...
SELECT MAX("Attendance") FROM table_1497 WHERE "Giants points" = '10'
wikisql
CREATE TABLE table_204_968 ( id number, "squad #" number, "position" text, "player" text, "transferred to" text, "fee" text, "date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many total players were transferred to sun pegasus ?
SELECT COUNT("player") FROM table_204_968 WHERE "transferred to" = 'sun pegasus'
squall
CREATE TABLE table_21276428_21 ( athlete VARCHAR, place VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the athlete for 3
SELECT athlete FROM table_21276428_21 WHERE place = 3
sql_create_context
CREATE TABLE table_27988408_1 ( original_air_date VARCHAR, written_by VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the original air date for bryan moore & chris peterson
SELECT original_air_date FROM table_27988408_1 WHERE written_by = "Bryan Moore & Chris Peterson"
sql_create_context
CREATE TABLE table_29487 ( "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. -- Who was the writer...
SELECT "Written by" FROM table_29487 WHERE "No. in Season" = '7'
wikisql
CREATE TABLE table_52653 ( "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. -- What is the size of the crowd for the home team ...
SELECT "Crowd" FROM table_52653 WHERE "Home team" = 'footscray'
wikisql
CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance int ) CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type ...
SELECT Nationality, COUNT(*) FROM journalist GROUP BY Nationality
nvbench
CREATE TABLE table_23292220_3 ( episode VARCHAR, seans_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In which episode is Sean's team made up of Krishnan Guru-Murthy and Vic Reeves?
SELECT episode FROM table_23292220_3 WHERE seans_team = "Krishnan Guru-Murthy and Vic Reeves"
sql_create_context
CREATE TABLE table_11677691_11 ( hometown VARCHAR, school VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the hometown of the player who attended American Heritage School?
SELECT hometown FROM table_11677691_11 WHERE school = "American Heritage school"
sql_create_context
CREATE TABLE table_203_282 ( id number, "date" text, "racecourse" text, "distance" text, "race status" text, "race" text, "position" text, "winning distance (lengths)" number, "jockey" text, "rating" number, "going" text, "odds" text, "prize money" text ) -- Using v...
SELECT COUNT(*) FROM table_203_282
squall
CREATE TABLE table_53700 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name t...
SELECT "Series" FROM table_53700 WHERE "Date" = 'april 30'
wikisql
CREATE TABLE table_76597 ( "Finish Position" text, "Lengths Behind" text, "Post Position" real, "Horse name" text, "Trainer" text, "Jockey" text, "Owner" text, "Post Time Odds" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the l...
SELECT "Lengths Behind" FROM table_76597 WHERE "Jockey" = 'jeremy rose'
wikisql
CREATE TABLE table_6134 ( "Year" real, "Winner" text, "Jockey" text, "Trainer" text, "Owner" text, "Time" text, "Purse" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the purse for the year earlier than 2013 and muhannak was the winn...
SELECT "Purse" FROM table_6134 WHERE "Year" < '2013' AND "Winner" = 'muhannak'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44495')) AND microlab.culturesite = 'sputum, expectorated' AND STRFTIME('%...
eicu
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "62" AND diagnoses.short_title = "Esophageal reflux"
mimicsql_data
CREATE TABLE table_name_41 ( date VARCHAR, tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When is the tournament of konica san jose classic?
SELECT date FROM table_name_41 WHERE tournament = "konica san jose classic"
sql_create_context
CREATE TABLE table_51841 ( "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. -- Who was the home team when Fitzroy was the away ...
SELECT "Home team" FROM table_51841 WHERE "Away team" = 'fitzroy'
wikisql
CREATE TABLE player ( Residence VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the residences that have at least two players.
SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*) >= 2
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( ...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '013-33898' AND patient.unitdischargetime IS NULL
eicu
CREATE TABLE table_46118 ( "School" text, "Location" text, "Founded" real, "Affiliation" text, "Nickname" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is affiliated with the Dukes?
SELECT "Affiliation" FROM table_46118 WHERE "Nickname" = 'dukes'
wikisql
CREATE TABLE Clients ( Client_ID INTEGER, Address_ID INTEGER, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER, Invoice_ID INTEGER, Order_ID INTEGER, Or...
SELECT Service_Type_Code, COUNT(*) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY Service_Type_Description
nvbench
CREATE TABLE table_name_11 ( origin_of_programming VARCHAR, network VARCHAR, genre VARCHAR, service VARCHAR, language VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the origin of the Malayalam Dish Service that shows general programming o...
SELECT origin_of_programming FROM table_name_11 WHERE service = "dish" AND language = "malayalam" AND genre = "general" AND network = "asianet plus"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "45829" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city v...
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%The Southern Novel%' OR name LIKE '%The Southern Novel%') AND credits = 1
advising
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "67" AND prescriptions.formulary_drug_cd = "NS451000"
mimicsql_data
CREATE TABLE table_60558 ( "Rank" real, "Name" text, "Season" text, "Club" text, "Goals" real, "Apps" real, "Goals per Match" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many apps for the rank of 8 in the 2012/13 season?
SELECT MAX("Apps") FROM table_60558 WHERE "Rank" = '8' AND "Season" = '2012/13'
wikisql
CREATE TABLE table_3836 ( "Season" text, "Overall Record" text, "SEC Record" text, "Overall Attendance" real, "Average Attendance" real, "Rank Nationally" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many times was the overall attendance 1...
SELECT COUNT("Overall Attendance") FROM table_3836 WHERE "Average Attendance" = '17807'
wikisql
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT * FROM hz_info JOIN mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB AND zyjybgb.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb.BGDH = jyjgzbb.BGDH WHERE hz_inf...
css
CREATE TABLE table_26169 ( "Week" real, "Date" text, "Opponent" text, "Location" text, "Final Score" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score on the October 28 game?
SELECT "Final Score" FROM table_26169 WHERE "Date" = 'October 28'
wikisql
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 lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44842' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'rdw' ORDER BY...
eicu
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, ...
SELECT RZBQDM, RZBQMC, RYCWH FROM zyjzjlb WHERE JZLSH = '71075266432'
css
CREATE TABLE table_203_90 ( id number, "religious\ngroup" text, "population\n%" text, "growth\n(1991-2001)" text, "sex ratio\n(total)" number, "literacy\n(%)" text, "work participation\n(%)" text, "sex ratio\n(rural)" number, "sex ratio\n(urban)" number, "sex ratio\n(child)" numb...
SELECT "religious\ngroup" FROM table_203_90 ORDER BY "population\n%" LIMIT 1
squall
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
SELECT JOB_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID DESC
nvbench
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.admityear < "2103"
mimicsql_data
CREATE TABLE table_name_56 ( week VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Week has a Date of december 3, 2001?
SELECT week FROM table_name_56 WHERE date = "december 3, 2001"
sql_create_context
CREATE TABLE table_name_2 ( position INTEGER, points VARCHAR, wins VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the minimum position when points are 32 and wins are greater than 13?
SELECT MIN(position) FROM table_name_2 WHERE points = 32 AND wins > 13
sql_create_context
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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.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 = admi...
mimic_iii
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TA...
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS OctRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInOct, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AN...
sede
CREATE TABLE table_26036389_1 ( sr_no INTEGER, name_of_road VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Sr. number of Banikhet Dalhouse Khajiar?
SELECT MAX(sr_no) FROM table_26036389_1 WHERE name_of_road = "Banikhet Dalhouse Khajiar"
sql_create_context
CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) -- Using valid SQLite, answer the following questions for the tables provide...
SELECT Class, AVG(age) FROM captain GROUP BY Class
nvbench
CREATE TABLE table_67378 ( "Position" real, "Club" text, "Played" real, "Points" text, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT COUNT("Wins") FROM table_67378 WHERE "Goals against" < '32'
wikisql
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 microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3507')) ORDER BY microlab.culturetakentime DESC LIMIT 1
eicu
CREATE TABLE table_66910 ( "Stage" text, "Winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Intergiro classification" text, "Trofeo Fast Team" text ) -- Using valid SQLite, answer the following questions for the tables provided abo...
SELECT "Intergiro classification" FROM table_66910 WHERE "Trofeo Fast Team" = 'asics-c.g.a.' AND "Stage" = '13'
wikisql
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
SELECT (SELECT SUM(STA_FLG) FROM t_kc22 WHERE MED_CLINIC_ID = '45039080737') = (SELECT COUNT(*) FROM t_kc22 WHERE MED_CLINIC_ID = '45039080737')
css
CREATE TABLE table_204_89 ( id number, "team" text, "truck(s)" text, "#" number, "driver(s)" text, "primary sponsor(s)" text, "listed owner(s)" text, "crew chief" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the total number of...
SELECT COUNT("driver(s)") FROM table_204_89 WHERE "truck(s)" = 'dodge ram'
squall
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Po...
SELECT p.Id AS "post_id", p.Id AS "post_link", a.Id AS "answer_id" FROM Posts AS p INNER JOIN Posts AS a ON p.Id = a.ParentId WHERE (p.Tags LIKE '%<##TagName##>%' AND p.AcceptedAnswerId IS NULL AND p.ClosedDate IS NULL AND p.Score >= 0 AND a.Score = 0 AND a.Score >= ALL (SELECT aa.Score FROM Posts AS aa WHERE (aa.Paren...
sede
CREATE TABLE table_28871 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What candidate(s) ran for election when nathaniel h. claiborne was the i...
SELECT "Candidates" FROM table_28871 WHERE "Incumbent" = 'Nathaniel H. Claiborne'
wikisql
CREATE TABLE table_2612 ( "#" text, "Spacecraft" text, "Spacewalkers" text, "Start ( UTC )" text, "End (UTC)" text, "Duration" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the start date and time of the walk that ends March 28, 2005, 1...
SELECT "Start ( UTC )" FROM table_2612 WHERE "End (UTC)" = 'March 28, 2005, 11:31'
wikisql
CREATE TABLE table_203_839 ( id number, "station" text, "type" text, "latitude" text, "longitude" text, "el. (m)" number, "opened" number, "closed" number, "coordinates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many station...
SELECT COUNT("station") FROM table_203_839 WHERE "opened" > 1917
squall
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT jybgb.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 people ( people_id number, sex text, name text, date_of_birth text, height number, weight number ) CREATE TABLE candidate ( candidate_id number, people_id number, poll_source text, date text, support_rate number, consider_rate number, oppose_rate number,...
SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3
spider
CREATE TABLE table_name_79 ( home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the home team score when the home team is Collingwood?
SELECT home_team AS score FROM table_name_79 WHERE home_team = "collingwood"
sql_create_context
CREATE TABLE table_3196 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the party for 1998 first elected
SELECT "Party" FROM table_3196 WHERE "First elected" = '1998'
wikisql
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEP...
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID DESC
nvbench
CREATE TABLE Customer_Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATE, End_Date DATE ) CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settl...
SELECT Date_Payment_Made, COUNT(Date_Payment_Made) FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY COUNT(Date_Payment_Made)
nvbench
CREATE TABLE table_name_61 ( result VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result when the score was 5-1?
SELECT result FROM table_name_61 WHERE score = "5-1"
sql_create_context
CREATE TABLE table_11920 ( "Tallangatta DFL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest draw that has 5 losses and byes greater than 0?
SELECT MIN("Draws") FROM table_11920 WHERE "Losses" = '5' AND "Byes" > '0'
wikisql
CREATE TABLE table_73733 ( "Pick #" real, "NFL Team" text, "Player" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What pick number did the buffalo bills get?
SELECT "Pick #" FROM table_73733 WHERE "NFL Team" = 'Buffalo Bills'
wikisql
CREATE TABLE table_59848 ( "Date" text, "Ship" text, "Nationality" text, "Tonnage" real, "Fate" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the tonnage on 12 september 1942?
SELECT "Tonnage" FROM table_59848 WHERE "Date" = '12 september 1942'
wikisql
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 d_icd_diagnoses.long_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'open wound axilla-compl' UNION SELECT d_icd_procedures.long_title FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'open wound axilla-compl'
mimic_iii
CREATE TABLE table_38086 ( "Rank" real, "Club" text, "Seasons" real, "Played" real, "Drew" real, "Lost" real, "Points" real, "Avg. Points" real, "Goals for" real, "Goals against" real, "Goal diff" real ) -- Using valid SQLite, answer the following questions for the tables p...
SELECT SUM("Drew") FROM table_38086 WHERE "Lost" > '14'
wikisql
CREATE TABLE table_name_53 ( attendance VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Attendance on September 28, 1997?
SELECT attendance FROM table_name_53 WHERE date = "september 28, 1997"
sql_create_context
CREATE TABLE county ( county_id number, county_name text, population number, zip_code text ) CREATE TABLE party ( party_id number, year number, party text, governor text, lieutenant_governor text, comptroller text, attorney_general text, us_senate text ) CREATE TABLE el...
SELECT COUNT(DISTINCT T2.delegate) FROM county AS T1 JOIN election AS T2 ON T1.county_id = T2.district WHERE T1.population > 50000
spider
CREATE TABLE table_30627 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. No." real, "Viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- W...
SELECT "Title" FROM table_30627 WHERE "Written by" = 'Frank Military'
wikisql
CREATE TABLE invoiceline ( invoicelineid number, invoiceid number, trackid number, unitprice number, quantity number ) CREATE TABLE artist ( artistid number, name text ) CREATE TABLE playlisttrack ( playlistid number, trackid number ) CREATE TABLE mediatype ( mediatypeid numbe...
SELECT T2.name FROM album AS T1 JOIN artist AS T2 ON T1.artistid = T2.artistid GROUP BY T2.name ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_name_85 ( home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When fitzroy what was the home team score?
SELECT home_team AS score FROM table_name_85 WHERE home_team = "fitzroy"
sql_create_context
CREATE TABLE table_75270 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many grids correspond to more than 24 laps?
SELECT MAX("Grid") FROM table_75270 WHERE "Laps" > '24'
wikisql
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 person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) FROM person_info JOIN hz_info JOIN txmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE txmzjzjlb.JZZDBM = 'T69.925' GROUP BY person_info.JGDM UNION SELECT...
css
CREATE TABLE stadium ( id number, name text, capacity number, city text, country text, opening_year number ) CREATE TABLE record ( id number, result text, swimmer_id number, event_id number ) CREATE TABLE swimmer ( id number, name text, nationality text, meter_1...
SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000
spider
CREATE TABLE table_name_95 ( gold INTEGER, rank VARCHAR, silver VARCHAR, bronze VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Gold, when Silver is less than 107, when Bronze is greater than 42, and when Rank is 3?
SELECT AVG(gold) FROM table_name_95 WHERE silver < 107 AND bronze > 42 AND rank = "3"
sql_create_context
CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_c...
SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1
spider
CREATE TABLE zyjzjlb_jybgb ( YLJGDM_ZYJZJLB text, BGDH number, YLJGDM number ) 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, ...
SELECT zyjzjlb.ZYBMLX, zyjzjlb.ZYZDBM, zyjzjlb.ZYZDMC FROM zyjzjlb WHERE zyjzjlb.JZLSH = '99580652501'
css
CREATE TABLE table_492 ( "Celebrity" text, "Background" text, "Original Team" text, "Age" real, "Hometown" text, "Charity" text, "Result" text, "Raised" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the background of the celebri...
SELECT "Background" FROM table_492 WHERE "Result" = '13 The Celebrity Apprentice (2008-03-27)'
wikisql
CREATE TABLE table_54777 ( "NGC number" real, "Object type" text, "Constellation" text, "Right ascension ( J2000 )" text, "Declination ( J2000 )" text, "Apparent magnitude" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average NGC n...
SELECT AVG("NGC number") FROM table_54777 WHERE "Apparent magnitude" > '14.2'
wikisql
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Pericardiocentesis"
mimicsql_data
CREATE TABLE table_name_23 ( opponent VARCHAR, record VARCHAR, res VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the opponent when there is a win in round greater than 1 and the record is 42-27-10?
SELECT opponent FROM table_name_23 WHERE res = "win" AND round > 1 AND record = "42-27-10"
sql_create_context
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDSM = '继发龋' AND jyjgzbb.JCZBMC = '妊娠相关性血浆蛋白-A'
css
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 d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )...
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, 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 = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
mimic_iii
CREATE TABLE apartments ( apt_id number, building_id number, apt_type_code text, apt_number text, bathroom_count number, bedroom_count number, room_count text ) CREATE TABLE view_unit_status ( apt_id number, apt_booking_id number, status_date time, available_yn others ) CRE...
SELECT apt_number, room_count FROM apartments
spider
CREATE TABLE table_name_84 ( other VARCHAR, joe_sestak__d_ VARCHAR, margin_of_error VARCHAR, pat_toomey__r_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT CANDIDATE HAD A MARGIN OF ERROR OF 4.5%, WHEN PAT TOOMEY WAS 45% AND JOE SESTAK WAS 38%?
SELECT other FROM table_name_84 WHERE margin_of_error = "± 4.5%" AND pat_toomey__r_ = "45%" AND joe_sestak__d_ = "38%"
sql_create_context
CREATE TABLE table_18161217_2 ( launch_date VARCHAR, cospar_id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the launch date the satellite with cospar ID is 2008-033A?
SELECT launch_date FROM table_18161217_2 WHERE cospar_id = "2008-033A"
sql_create_context
CREATE TABLE table_name_66 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest value for 1960, when the value for 2000 is less than 8.4, when the value for 1950 is greater than 3.5, and when the value for 1990 is less than 3.3?
SELECT MIN(1960) FROM table_name_66 WHERE 2000 < 8.4 AND 1950 > 3.5 AND 1990 < 3.3
sql_create_context
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal bool...
SELECT COUNT(*) AS AnsweredVolume, TIME_TO_STR(P.CreationDate, '%Y') AS "year", TIME_TO_STR(P.CreationDate, '%m') AS Month FROM Posts AS P WHERE (Tags LIKE '%<ios%' AND NOT Tags LIKE '%<iostream>%') AND PostTypeId = 1 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND AcceptedAnswerId > 0 GROUP BY TIME_TO_STR(P....
sede
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
SELECT COUNT(*) 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_info_mzjzjlb....
css
CREATE TABLE table_name_47 ( race_winner VARCHAR, circuit VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who won the race circuit of sachsenring?
SELECT race_winner FROM table_name_47 WHERE circuit = "sachsenring"
sql_create_context