instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'eye' AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-2 year'))
mimic_iii
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, h...
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-227759')) AND STRFTIME('%y-%m', lab.labresulttime) <= '2101-10' ORDER BY lab.la...
eicu
CREATE TABLE table_55646 ( "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 low rebound total for players from Oklahoma before 1975?
SELECT MIN("Rebs") FROM table_55646 WHERE "School/Country" = 'oklahoma' AND "From" < '1975'
wikisql
CREATE TABLE suppliers ( supplier_id number, supplier_name text, supplier_phone text ) CREATE TABLE supplier_addresses ( supplier_id number, address_id number, date_from time, date_to time ) CREATE TABLE customer_orders ( order_id number, customer_id number, order_status_code t...
SELECT staff_id FROM staff_department_assignments WHERE date_assigned_to < (SELECT MAX(date_assigned_to) FROM staff_department_assignments WHERE job_title_code = 'Clerical Staff')
spider
CREATE TABLE table_name_24 ( overall INTEGER, pick VARCHAR, college VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many overalls have a pick greater than 19, with florida as the college?
SELECT SUM(overall) FROM table_name_24 WHERE pick > 19 AND college = "florida"
sql_create_context
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18677 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND prescriptions.drug = 'etomidate' ORDER BY prescriptions.startdate DESC LIMIT 1
mimic_iii
CREATE TABLE table_name_80 ( year VARCHAR, actor VARCHAR, film VARCHAR, category VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year was Jennifer Tilly's Film of Bullets Over Broadway up in the best supporting actress category?
SELECT year FROM table_name_80 WHERE film = "bullets over broadway" AND category = "best supporting actress" AND actor = "jennifer tilly"
sql_create_context
CREATE TABLE table_204_292 ( id number, "no." number, "name" text, "class" number, "games" number, "minutes" number, "points" number, "2 points\n(made/attempts)" text, "2 points\n(%)" number, "3 points\n(made/attempts)" text, "3 points\n(%)" number, "free throws\n(made/at...
SELECT "name" FROM table_204_292 WHERE "name" <> 'amber merritt' ORDER BY "points" DESC LIMIT 1
squall
CREATE TABLE table_204_612 ( id number, "draft order\nround" number, "draft order\nchoice" number, "player" text, "position" text, "height" text, "weight" text, "college" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who was the tallest...
SELECT "player" FROM table_204_612 ORDER BY "height" DESC LIMIT 1
squall
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConce...
SELECT CreationDate, Name, COUNT(Votes.Id) FROM Votes INNER JOIN VoteTypes ON VoteTypes.Id = Votes.VoteTypeId WHERE PostId = '##postid:int##' GROUP BY CreationDate, Name ORDER BY CreationDate, Name
sede
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE requirement ( ...
SELECT DISTINCT semester.semester, semester.year FROM semester INNER JOIN course_offering ON semester.semester_id = course_offering.semester INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.name LIKE '%Pharmacotherapeutics%' AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FRO...
advising
CREATE TABLE table_name_55 ( pick VARCHAR, college VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Far Eastern College Johnny Abarrientos' Pick number?
SELECT pick FROM table_name_55 WHERE college = "far eastern" AND player = "johnny abarrientos"
sql_create_context
CREATE TABLE bdmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGD...
css
CREATE TABLE table_2668416_18 ( party VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In how many different parts was the incumbent Abraham B. Venable?
SELECT COUNT(party) FROM table_2668416_18 WHERE incumbent = "Abraham B. Venable"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Adv eff benzodiaz tranq" AND lab.fluid = "Pleural"
mimicsql_data
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT All_Neutral, School_ID FROM basketball_match ORDER BY All_Neutral
nvbench
CREATE TABLE table_19468 ( "Team" text, "# appearances" real, "years (won in bold)" text, "# wins" real, "# runner-up" real, "Most recent final" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the number of appearances where the most rece...
SELECT COUNT("# appearances") FROM table_19468 WHERE "Most recent final" = '1999, beat Genk 3-1'
wikisql
CREATE TABLE table_name_27 ( visitor VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the visiting team on April 6?
SELECT visitor FROM table_name_27 WHERE date = "april 6"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, ...
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'pregnancy')) AND STRFTIME('%y', cost.charget...
eicu
CREATE TABLE Visits ( Visit_ID INTEGER, Tourist_Attraction_ID INTEGER, Tourist_ID INTEGER, Visit_Date DATETIME, Visit_Details VARCHAR(40) ) CREATE TABLE Tourist_Attraction_Features ( Tourist_Attraction_ID INTEGER, Feature_ID INTEGER ) CREATE TABLE Royal_Family ( Royal_Family_ID INTEGER...
SELECT How_to_Get_There, COUNT(*) FROM Tourist_Attractions GROUP BY How_to_Get_There
nvbench
CREATE TABLE table_17680 ( "Character" text, "Portrayed by" text, "Main cast seasons" text, "Recurring cast seasons" text, "# of episodes" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What seasons does Nick Lucas appear in?
SELECT "Recurring cast seasons" FROM table_17680 WHERE "Character" = 'Nick Lucas'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND lab.label = "Potassium, Whole Blood"
mimicsql_data
CREATE TABLE table_train_61 ( "id" int, "white_blood_cell_count_wbc" int, "in_another_study" bool, "systolic_blood_pressure_sbp" int, "trauma" bool, "temperature" float, "anc" int, "hypotension" bool, "heart_rate" int, "paco2" float, "gastrointestinal_disease" bool, "burn...
SELECT * FROM table_train_61 WHERE gastrointestinal_disease = 1 OR seizure_disorder = 1 OR drug_abuse = 1 OR burn_injury > 0 OR trauma = 1
criteria2sql
CREATE TABLE table_train_138 ( "id" int, "mini_mental_state_examination_mmse" int, "stroke" bool, "body_weight" float, "cranial_neurosurgery" bool, "first_degree_relative" bool, "seizure_disorder" bool, "alcohol_abuse" bool, "body_mass_index_bmi" float, "aneurysm" bool, "NOUS...
SELECT * FROM table_train_138 WHERE alcohol_abuse = 1
criteria2sql
CREATE TABLE table_67700 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What would be the lowest Attendance that also showed a loss of Obermueller (1-2)?
SELECT MIN("Attendance") FROM table_67700 WHERE "Loss" = 'obermueller (1-2)'
wikisql
CREATE TABLE table_19508635_1 ( order__number VARCHAR, theme VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the order number for 1960s
SELECT order__number FROM table_19508635_1 WHERE theme = "1960s"
sql_create_context
CREATE TABLE voting_record ( stuid number, registration_date text, election_cycle text, president_vote number, vice_president_vote number, secretary_vote number, treasurer_vote number, class_president_vote number, class_senator_vote number ) CREATE TABLE student ( stuid number, ...
SELECT DISTINCT T1.fname, T1.lname FROM student AS T1 JOIN voting_record AS T2 ON T1.stuid = T2.president_vote WHERE T1.sex = "F"
spider
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 SUM(t_kc21.MED_AMOUT) FROM t_kc21 WHERE t_kc21.PERSON_NM = '戚文栋' AND t_kc21.CLINIC_TYPE = '门诊'
css
CREATE TABLE table_28352 ( "\u00d7" text, "Wehdat" text, "Faisaly" text, "Ramtha" text, "Ahli" text, "Hussein" text, "Jazeera" text, "Amman" text, "Qadisiya" text, "Jeel" text, "Baqaa" text ) -- Using valid SQLite, answer the following questions for the tables provided abov...
SELECT "Qadisiya" FROM table_28352 WHERE "\u00d7" = 'Ramtha'
wikisql
CREATE TABLE table_66397 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Attendance of the game in Week 12?
SELECT MAX("Attendance") FROM table_66397 WHERE "Week" = '12'
wikisql
CREATE TABLE authors ( authid number, lname text, fname text ) CREATE TABLE inst ( instid number, name text, country text ) CREATE TABLE authorship ( authid number, instid number, paperid number, authorder number ) CREATE TABLE papers ( paperid number, title text ) -...
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University"
spider
CREATE TABLE table_name_39 ( attendance VARCHAR, week VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which attendance number was taken in a week less than 16 when the Washington Redskins were the opponents?
SELECT attendance FROM table_name_39 WHERE week < 16 AND opponent = "washington redskins"
sql_create_context
CREATE TABLE table_name_28 ( nation VARCHAR, gold VARCHAR, bronze VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For what nation is the gold medals 0, and the bronze medals less than 1?
SELECT nation FROM table_name_28 WHERE gold = 0 AND bronze < 1
sql_create_context
CREATE TABLE table_35448 ( "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 for the game on February 29?
SELECT "Score" FROM table_35448 WHERE "Date" = 'february 29'
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 t_kc24.MED_CLINIC_ID, t_kc24.t_kc21_PERSON_ID, t_kc24.t_kc21_PERSON_NM, t_kc24.t_kc21_IDENTITY_CARD, t_kc24.t_kc21_PERSON_SEX, t_kc24.t_kc21_PERSON_AGE FROM t_kc24 WHERE t_kc24.MED_AMOUT = (SELECT t_kc24.MED_AMOUT FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID = '09954947689')
css
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...
SELECT (u.Reputation / COUNT(p.OwnerUserId)) AS "Rep Per Post", u.DisplayName, COUNT(p.OwnerUserId) AS "Posts", u.Reputation FROM Users AS u INNER JOIN Posts AS p ON u.Id = p.OwnerUserId WHERE u.Reputation >= 5000 GROUP BY u.Reputation, u.DisplayName ORDER BY (u.Reputation / COUNT(p.OwnerUserId)) DESC
sede
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb 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 WHERE person_info.XM = '马...
css
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51244"
mimicsql_data
CREATE TABLE table_41983 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Set 4" text, "Set 5" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total of the 3-0 score with a set 2 of 25-12 a...
SELECT "Total" FROM table_41983 WHERE "Score" = '3-0' AND "Set 3" = '25-18' AND "Set 2" = '25-12'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-7984')) AND DATETIME(allergy.allergytime) <= DATETIME(CURRENT_TIME(), '-...
eicu
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 zzmzjzjlb ( HXPLC number, HZX...
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDBM = 'A48.710' AND jyjgzbb.JCZBMC = '...
css
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 PostsWithDeleted ( Id number, PostTypeId number, Acc...
SELECT DATEFROMPARTS(YEAR(CreationDate), MONTH(CreationDate), 1) AS YearMonth, 1 / (CAST(SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS FLOAT) / NULLIF(CAST(SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS FLOAT), 0)) AS Ratio FROM Votes WHERE CreationDate > '01-01-2010' GROUP BY DATEFROMPARTS(YEAR(CreationDate),...
sede
CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find ...
SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID
nvbench
CREATE TABLE club ( Club_ID int, Club_name text, Region text, Start_year int ) CREATE TABLE match_result ( Rank int, Club_ID int, Gold int, Big_Silver int, Small_Silver int, Bronze int, Points int ) CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starti...
SELECT Gender, COUNT(Gender) FROM player GROUP BY Gender
nvbench
CREATE TABLE table_name_47 ( years VARCHAR, nation VARCHAR, assist VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which years did the USA have a rank lower than 6 and an assist number less than 26?
SELECT years FROM table_name_47 WHERE assist < 26 AND rank < 6 AND nation = "usa"
sql_create_context
CREATE TABLE enzyme ( id int, name text, Location text, Product text, Chromosome text, OMIM int, Porphyria text ) CREATE TABLE medicine ( id int, name text, Trade_Name text, FDA_approved text ) CREATE TABLE medicine_enzyme_interaction ( enzyme_id int, medicine_id in...
SELECT Trade_Name, id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id ORDER BY Trade_Name DESC
nvbench
CREATE TABLE table_name_71 ( avg_g INTEGER, long VARCHAR, loss VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Avg/G has a Long of 93, and a Loss smaller than 249?
SELECT SUM(avg_g) FROM table_name_71 WHERE long = 93 AND loss < 249
sql_create_context
CREATE TABLE table_28472 ( "Character" text, "Played by" text, "Season 1" real, "Season 2" real, "Season 3" real, "Season 4" real, "First Appearance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many season 4 appearances are there by M...
SELECT MIN("Season 4") FROM table_28472 WHERE "Character" = 'Mrs. Jennifer Knight'
wikisql
CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, s...
SELECT cust_name, credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID
nvbench
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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, ...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 4758 AND STRFTIME('%y', admissions.admittime) >= '2105' ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON 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 jybgb.YLJGDM = jyjgzbb.YLJGD...
css
CREATE TABLE Claims_Processing ( Claim_Processing_ID INTEGER, Claim_ID INTEGER, Claim_Outcome_Code CHAR(15), Claim_Stage_ID INTEGER, Staff_ID INTEGER ) CREATE TABLE Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATETIME, End_Date DATETI...
SELECT Policy_Type_Code, COUNT(*) FROM Policies GROUP BY Policy_Type_Code
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE 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 WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.dob_year < "2078"
mimicsql_data
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id numbe...
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age ...
mimic_iii
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 Users ( Id number, Reputation number,...
SELECT t.TagName, 100 * CAST(COUNT(p.Id) AS FLOAT) / COUNT(*) AS "% Unanswered", COUNT(p.Id) AS Unanswered, COUNT(*) AS Posts FROM Tags AS t LEFT JOIN PostTags AS pt ON t.Id = pt.TagId LEFT OUTER JOIN Posts AS p ON pt.PostId = p.Id AND p.PostTypeId = 1 AND p.ViewCount < 500 AND (p.AnswerCount < 1 OR p.AnswerCount IS NU...
sede
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, d...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hyperglycemia - stress related' AND STRFTIME('%y',...
eicu
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 labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20000) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'calculated total co2') AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TI...
mimic_iii
CREATE TABLE table_58358 ( "Position" text, "Game 1" text, "Game 2" text, "Game 3" text, "Game 4" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- During which Game 4, did Brett Kenny play Game 2?
SELECT "Game 4" FROM table_58358 WHERE "Game 2" = 'brett kenny'
wikisql
CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state varchar(20) ) CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, state ...
SELECT acc_type, AVG(acc_bal) FROM customer WHERE credit_score < 50 GROUP BY acc_type ORDER BY acc_type
nvbench
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.admityear < "2194" AND diagnoses.long_title = "Hypopotassemia"
mimicsql_data
CREATE TABLE table_28491 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was Katie's order number when the theme was The Rolling Stones?
SELECT "Order #" FROM table_28491 WHERE "Theme" = 'The Rolling Stones'
wikisql
CREATE TABLE table_39458 ( "Year" real, "Class" text, "Team" text, "Machine" text, "Points" real, "Rank" text, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many years have 78 for points?
SELECT COUNT("Year") FROM table_39458 WHERE "Points" = '78'
wikisql
CREATE TABLE table_56891 ( "Result" text, "Opponent" text, "Method" text, "Event" text, "Date" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the event for vinny magalh es?
SELECT "Event" FROM table_56891 WHERE "Opponent" = 'vinny magalhães'
wikisql
CREATE TABLE Fault_Log ( fault_log_entry_id INTEGER, asset_id INTEGER, recorded_by_staff_id INTEGER, fault_log_entry_datetime DATETIME, fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) CREATE TABLE Engineer_Visits ( engineer_visit_id INTEGER, contact_staff_id INTEGER, ...
SELECT fault_status, COUNT(fault_status) FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY fault_status ORDER BY COUNT(fault_status) DESC
nvbench
CREATE TABLE table_name_57 ( built VARCHAR, cr_no VARCHAR, lms_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the built date when the CR number is more than 940 and the LMS number is 14760?
SELECT built FROM table_name_57 WHERE cr_no > 940 AND lms_no = 14760
sql_create_context
CREATE TABLE table_name_9 ( built VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was la vista built?
SELECT built FROM table_name_9 WHERE location = "la vista"
sql_create_context
CREATE TABLE table_44527 ( "Team" text, "Average" real, "Points" real, "Played" real, "1991-92" text, "1992-93" text, "1993-94" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Total points with 114 played and average of 0.982?
SELECT SUM("Points") FROM table_44527 WHERE "Played" = '114' AND "Average" = '0.982'
wikisql
CREATE TABLE table_7901 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What round was jerry corcoran drafted in as pick number 114?
SELECT MAX("Round") FROM table_7901 WHERE "Pick" > '114' AND "Player" = 'jerry corcoran'
wikisql
CREATE TABLE table_57045 ( "Tournament" text, "Winner" text, "Runner-up" text, "Score" text, "Third Place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Tournament has Pat Cash as a runner-up?
SELECT "Tournament" FROM table_57045 WHERE "Runner-up" = 'pat cash'
wikisql
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 prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Enalaprilat"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.admission_location = "EMERGENCY ROOM ADMIT"
mimicsql_data
CREATE TABLE table_name_66 ( round VARCHAR, college VARCHAR, overall VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what Round with an Overall greater than 306 was the pick from the College of Virginia Tech?
SELECT COUNT(round) FROM table_name_66 WHERE college = "virginia tech" AND overall > 306
sql_create_context
CREATE TABLE table_74753 ( "Conference" text, "# of Bids" real, "Record" text, "Win %" text, "Round of 32" text, "Sweet Sixteen" text, "Elite Eight" text, "Final Four" text, "Championship Game" text ) -- Using valid SQLite, answer the following questions for the tables provided abo...
SELECT "Sweet Sixteen" FROM table_74753 WHERE "Conference" = 'colonial'
wikisql
CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price real ) CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Rankin...
SELECT Carrier, SUM(Memory_in_G) FROM phone GROUP BY Carrier
nvbench
CREATE TABLE table_name_80 ( home_team VARCHAR, tie_no VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the Home team in Tie #23?
SELECT home_team FROM table_name_80 WHERE tie_no = 23
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2158" AND diagnoses.long_title = "Benign neoplasm of spinal meninges"
mimicsql_data
CREATE TABLE membership_register_branch ( member_id number, branch_id text, register_year text ) CREATE TABLE purchase ( member_id number, branch_id text, year text, total_pounds number ) CREATE TABLE branch ( branch_id number, name text, open_year text, address_road text, ...
SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100
spider
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) -- Using valid SQLite, answer the following questions for the tables provide...
SELECT Rank, COUNT(Rank) FROM captain GROUP BY Rank ORDER BY Rank DESC
nvbench
CREATE TABLE table_2889810_2 ( moto2_250cc VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many total number of moto2/250cc when country is united states
SELECT COUNT(moto2_250cc) FROM table_2889810_2 WHERE country = "United States"
sql_create_context
CREATE TABLE table_name_9 ( original_title VARCHAR, english_title VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- English title of mal na had what original title?
SELECT original_title FROM table_name_9 WHERE english_title = "malèna"
sql_create_context
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE departments ( DEPARTME...
SELECT DEPARTMENT_ID, SUM(SALARY) FROM employees GROUP BY DEPARTMENT_ID
nvbench
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 MED_SER_ORG_NO FROM t_kc21 WHERE PERSON_ID = '45027908' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE SOC_SRT_DIRE_CD = '7909')
css
CREATE TABLE table_25695027_1 ( number_built VARCHAR, valve_gear VARCHAR, cylinder_size VARCHAR, firebox VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many engines were built with a cylinder size of 20 x 26 , firebox is belpaire and valve gear i...
SELECT number_built FROM table_25695027_1 WHERE cylinder_size = "20 ½” x 26”" AND firebox = "Belpaire" AND valve_gear = "Stephenson"
sql_create_context
CREATE TABLE table_name_17 ( name VARCHAR, country VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the player from NGA?
SELECT name FROM table_name_17 WHERE country = "nga"
sql_create_context
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
SELECT COUNT(*) = 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course.department = 'INST...
advising
CREATE TABLE table_name_34 ( bike VARCHAR, rider VARCHAR, grid VARCHAR, laps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which bike did Jiri Drazdak ride when he had a grid number larger than 14 and less than 22 laps?
SELECT bike FROM table_name_34 WHERE grid > 14 AND laps < 22 AND rider = "jiri drazdak"
sql_create_context
CREATE TABLE table_20539826_1 ( mccain_percentage VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many percent of the votes in Debaca did McCain get?
SELECT mccain_percentage FROM table_20539826_1 WHERE county = "DeBaca"
sql_create_context
CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description...
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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER...
atis
CREATE TABLE table_57842 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What week number saw a w 31-16 result?
SELECT MIN("Week") FROM table_57842 WHERE "Result" = 'w 31-16'
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 hz_info ( KH text, KLX number...
SELECT jyjgzbb.JCFF 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_in...
css
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) 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, ...
SELECT * FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '83546041' AND hz_info.YLJGDM = '5902863' AND zyjzjlb.CYKSMC LIKE '%肾内科%'
css
CREATE TABLE table_10463 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text, "Boxscore" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which box score has an Attendance of 54,773?
SELECT "Boxscore" FROM table_10463 WHERE "Attendance" = '54,773'
wikisql
CREATE TABLE table_14716 ( "Year" real, "Category" text, "Film" text, "Winner/Nominee(s)" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What year did the movie Rango come out?
SELECT AVG("Year") FROM table_14716 WHERE "Film" = 'rango'
wikisql
CREATE TABLE table_80085 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was in 1963?
SELECT "Entrant" FROM table_80085 WHERE "Year" = '1963'
wikisql
CREATE TABLE table_61865 ( "Pick" real, "Player" text, "Team" text, "Position" text, "Hometown/School" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT TEAM HAS A PICK LARGER THAN 29?
SELECT "Team" FROM table_61865 WHERE "Pick" > '29'
wikisql
CREATE TABLE journal ( journal_id number, date text, theme text, sales number ) CREATE TABLE journal_committee ( editor_id number, journal_id number, work_type text ) CREATE TABLE editor ( editor_id number, name text, age number ) -- Using valid SQLite, answer the following q...
SELECT name FROM editor ORDER BY age
spider
CREATE TABLE table_20065425_1 ( title VARCHAR, termination_of_mission VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many different titles does the representative whose mission was terminated on August 5, 1984 have?
SELECT COUNT(title) FROM table_20065425_1 WHERE termination_of_mission = "August 5, 1984"
sql_create_context
CREATE TABLE table_name_57 ( venue VARCHAR, home_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the venue where the home team is Footscray?
SELECT venue FROM table_name_57 WHERE home_team = "footscray"
sql_create_context
CREATE TABLE table_name_41 ( loss INTEGER, long INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Loss, when Long is less than 0?
SELECT MIN(loss) FROM table_name_41 WHERE long < 0
sql_create_context
CREATE TABLE table_1213511_6 ( nationality VARCHAR, nhl_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the nationality of the player from the Detroit Red Wings?
SELECT nationality FROM table_1213511_6 WHERE nhl_team = "Detroit Red Wings"
sql_create_context