instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE table_name_6 ( class VARCHAR, quantity VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the class with 1 quantity?
SELECT class FROM table_name_6 WHERE quantity = "1"
sql_create_context
CREATE TABLE table_11794 ( "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 away team that plays at Punt Road Ov...
SELECT "Away team score" FROM table_11794 WHERE "Venue" = 'punt road oval'
wikisql
CREATE TABLE table_26996293_7 ( position VARCHAR, cfl_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the position of cfl team saskatchewan (7)?
SELECT position FROM table_26996293_7 WHERE cfl_team = "Saskatchewan (7)"
sql_create_context
CREATE TABLE table_name_7 ( quantity_made VARCHAR, manufacturer VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the quantity made when the manufacturer was 4-6-2 oooooo pacific?
SELECT quantity_made FROM table_name_7 WHERE manufacturer = "4-6-2 — oooooo — pacific"
sql_create_context
CREATE TABLE Detention ( detention_id INTEGER, detention_type_code VARCHAR(10), teacher_id INTEGER, datetime_detention_start DATETIME, datetime_detention_end DATETIME, detention_summary VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Students_in_Detention ( student_id INTEGER, ...
SELECT other_details, COUNT(other_details) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
nvbench
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PendingFlags ( Id nu...
SELECT Id AS "post_link", CreationDate FROM Posts WHERE OwnerUserId IS NULL AND (OwnerDisplayName != 'anon' AND NOT OwnerDisplayName LIKE 'user%' AND PostTypeId = 2) ORDER BY CreationDate DESC
sede
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT jybgb.JYLX FROM jybgb WHERE jybgb.BGDH = '48426577162'
css
CREATE TABLE table_20522228_2 ( share INTEGER, rank__overall_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the share for rank 54?
SELECT MAX(share) FROM table_20522228_2 WHERE rank__overall_ = "54"
sql_create_context
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Gentamicin"
mimicsql_data
CREATE TABLE table_name_63 ( share INTEGER, rating VARCHAR, air_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest Share, when Rating is greater than 1.3, and when Air Date is May 28, 2008?
SELECT MIN(share) FROM table_name_63 WHERE rating > 1.3 AND air_date = "may 28, 2008"
sql_create_context
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) 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 ( r...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY outputevents.itemid) AS...
mimic_iii
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, a...
SELECT 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 = '010-32698' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala...
eicu
CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE artist ( artist_name text, country text, gender text, preferred_genre text ) CREATE TABLE song ( song_name text, artist_name text, country text, f_id number, genre_is text, rating num...
SELECT DISTINCT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 9
spider
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
SELECT Name, Height FROM people ORDER BY Name
nvbench
CREATE TABLE table_48832 ( "Rank" real, "Location" text, "2008" real, "2009" real, "2010" real, "2011" real, "2012" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which 2009 has a 2012 of 17,536,000, and a 2010 smaller than 16,972,000?
SELECT MAX("2009") FROM table_48832 WHERE "2012" = '17,536,000' AND "2010" < '16,972,000'
wikisql
CREATE TABLE Grants ( grant_id INTEGER, organisation_id INTEGER, grant_amount DECIMAL(19,4), grant_start_date DATETIME, grant_end_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Project_Staff ( staff_id DOUBLE, project_id INTEGER, role_code VARCHAR(10), date_from DATETI...
SELECT outcome_description, COUNT(outcome_description) FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code GROUP BY outcome_description ORDER BY outcome_description
nvbench
CREATE TABLE table_71496 ( "Lot No." real, "Diagram" real, "Mark" text, "Builder" text, "Fleet numbers" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the fleet numbers for diagram of 186 and lot number of 30798
SELECT "Fleet numbers" FROM table_71496 WHERE "Diagram" = '186' AND "Lot No." = '30798'
wikisql
CREATE TABLE table_27734286_1 ( record VARCHAR, high_points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What record has c. j. miles (20) in the high points?
SELECT record FROM table_27734286_1 WHERE high_points = "C. J. Miles (20)"
sql_create_context
CREATE TABLE table_name_72 ( ratt VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the RAtt in the year 1988?
SELECT ratt FROM table_name_72 WHERE year = "1988"
sql_create_context
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 p.Id, p.Title, p.Tags, p.CreationDate FROM Posts AS p INNER JOIN Users AS u ON u.Id = p.OwnerUserId WHERE u.Reputation < 200 AND p.CreationDate > (CURRENT_TIMESTAMP() - 20) AND AnswerCount = 0 AND CommentCount = 0 AND NOT Tags LIKE '%marketing-cloud%' AND NOT Tags LIKE '%lightning%' AND NOT Tags LIKE '%javascrip...
sede
CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number, stu_transfer number, dept_code text, stu_phone text, prof_num number ) CREATE TABLE course ( crs_code text, dept_co...
SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN class AS T5 ON T4.emp_num = T5.prof_num
spider
CREATE TABLE table_204_914 ( id number, "year" number, "team" text, "games" number, "attempts" number, "yards" number, "ypc" number, "long" number, "tds" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- in what year did he carry for ...
SELECT "year" FROM table_204_914 ORDER BY "yards" DESC LIMIT 1
squall
CREATE TABLE table_name_98 ( finish VARCHAR, laps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the finish with 51 laps?
SELECT finish FROM table_name_98 WHERE laps = 51
sql_create_context
CREATE TABLE table_name_88 ( year VARCHAR, character VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the year of the TV series that has a character of Leiloon Bala Barareh?
SELECT year FROM table_name_88 WHERE character = "leiloon bala barareh"
sql_create_context
CREATE TABLE table_name_88 ( grid VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What grid has 24 points?
SELECT grid FROM table_name_88 WHERE points = "24"
sql_create_context
CREATE TABLE student ( city_code VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the number of students for the cities where have more than one student.
SELECT COUNT(*), city_code FROM student GROUP BY city_code HAVING COUNT(*) > 1
sql_create_context
CREATE TABLE table_1341472_11 ( candidates VARCHAR, incumbent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- List all the candidates for the seat where the incumbent is Sam Gibbons?
SELECT candidates FROM table_1341472_11 WHERE incumbent = "Sam Gibbons"
sql_create_context
CREATE TABLE table_42587 ( "Average population (x 1,000)" text, "Live births" text, "Deaths" text, "Natural change" text, "Migration" text, "Crude birth rate (per 1,000)" real, "Crude death rate (per 1,000)" real, "Natural change (per 1,000)" real, "Migration (per 1,000)" real ) --...
SELECT MIN("Natural change (per 1,000)") FROM table_42587 WHERE "Deaths" = '17 413' AND "Migration (per 1,000)" > '-7.35'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '曹和光' AND t_kc22.STA_DATE BETWEEN '2001-03-24' AND '2009-09-17' AND t_kc22.SOC_SRT_DIRE_CD = '331112449-3'
css
CREATE TABLE table_203_675 ( id number, "match" number, "date" text, "round" text, "home/away" text, "opponent team" text, "score" text, "scorers" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- was the top game home or away ?
SELECT "home/away" FROM table_203_675 WHERE id = 1
squall
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 d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id numbe...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'blood (cmv ab)' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-1 year'))
mimic_iii
CREATE TABLE table_16920 ( "Year" real, "Property Taxes" text, "Investment Earnings" text, "Other Local Sources" text, "State & Federal" text, "Total Revenue" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the state and federal when propert...
SELECT "State & Federal" FROM table_16920 WHERE "Property Taxes" = '17,199,210'
wikisql
CREATE TABLE table_65887 ( "Year" real, "Class" text, "Team" text, "Machine" text, "Points" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many points did team Rothmans Honda have in 1992?
SELECT MIN("Points") FROM table_65887 WHERE "Team" = 'rothmans honda' AND "Year" = '1992'
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 hz_info.person_info_JGDM, hz_info.person_info_JGMC, COUNT(hz_info.RYBH) FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE mzjzjlb.JZZDSM = '混合性焦虑障碍' GROUP BY hz_info.person_info_JGDM
css
CREATE TABLE table_69155 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text ) -- Using valid SQLite, answer the following questions f...
SELECT "Club" FROM table_69155 WHERE "Played" = '22' AND "Losing bonus" = '7'
wikisql
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number...
SELECT p.Id AS "post_link", MAX(c.CreationDate) AS "last_commented", MAX(ph.CreationDate) AS "last_op_edit", MAX(p.ClosedDate) AS "closed" FROM Comments AS c JOIN Posts AS p ON c.PostId = p.Id AND c.UserId != p.OwnerUserId AND p.LastEditDate > c.CreationDate JOIN PostHistory AS ph ON p.Id = ph.PostId AND p.OwnerUserId ...
sede
CREATE TABLE table_name_1 ( date VARCHAR, venue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What dates were the matches at windy hill?
SELECT date FROM table_name_1 WHERE venue = "windy hill"
sql_create_context
CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What ...
SELECT title, COUNT(title) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5 GROUP BY title ORDER BY title DESC
nvbench
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 wdmzjzjlb.RYTJDM, wdmzjzjlb.RYTJMC FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '83482640652' UNION SELECT bdmzjzjlb.RYTJDM, bdmzjzjlb.RYTJMC FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '83482640652'
css
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 patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '028-32921' ORDER BY patient.hospitaladmittime DESC LIMIT 1
eicu
CREATE TABLE table_test_17 ( "id" int, "anemia" bool, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "active_infection" bool, "fever" bool, "bradycardia" int, "renal_disease" bool, "oliguria" bool, "creatinine_clearance_cl" float, "left_vent...
SELECT * FROM table_test_17 WHERE anemia = 1 OR hgb < 100
criteria2sql
CREATE TABLE table_28165 ( "Village" text, "Area km\u00b2" text, "Population (2000 census )" real, "Region" text, "Pop. Density" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What region is inarajan in?
SELECT "Region" FROM table_28165 WHERE "Village" = 'Inarajan'
wikisql
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) -- Using valid SQLite, answer the following questions for the...
SELECT Price, Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code
nvbench
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimme...
SELECT name, ID FROM swimmer ORDER BY ID DESC
nvbench
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1846" AND lab.label = "Rheumatoid Factor"
mimicsql_data
CREATE TABLE table_22323 ( "No." real, "#" real, "Title" text, "Directed by" text, "Written by" text, "Canadian air date" text, "U.S. air date" text, "Production code" real, "Canadian viewers (million)" text ) -- Using valid SQLite, answer the following questions for the tables pro...
SELECT COUNT("Production code") FROM table_22323 WHERE "Title" = 'The Better Man'
wikisql
CREATE TABLE table_name_27 ( clive_churchill_medal VARCHAR, losingteam VARCHAR, season VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who wins the clive churchill medal when the losing team is the sydney roosters in 2010?
SELECT clive_churchill_medal FROM table_name_27 WHERE losingteam = "sydney roosters" AND season = 2010
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(*) FROM treatment WHERE treatment.treatmentname = 'drug removal measures' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-1 year')
eicu
CREATE TABLE table_12925 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the To par for Lanny Wadkins?
SELECT "To par" FROM table_12925 WHERE "Player" = 'lanny wadkins'
wikisql
CREATE TABLE table_name_49 ( score VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of Wally Armstrong?
SELECT score FROM table_name_49 WHERE player = "wally armstrong"
sql_create_context
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 8 AND program_course.category LIKE 'ULCS'
advising
CREATE TABLE table_66894 ( "Year" text, "Superintendent" text, "Glendale Principal" text, "H.H. Principal" text, "Maplemere Principal" text, "W.R. Principal" text, "M.S. Principal" text, "H.S. Principal" text, "H. S. Asst. Principal" text ) -- Using valid SQLite, answer the followi...
SELECT "H. S. Asst. Principal" FROM table_66894 WHERE "Glendale Principal" = 'joyce brace' AND "Year" = '2002-2003'
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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND...
css
CREATE TABLE table_204_878 ( id number, "model" text, "release date" text, "sensor\nres., size" text, "lens (35 mm equiv.)\nzoom, aperture" text, "screen\nsize, pixels" text, "dimensions\nw (mm) \u00d7 h (mm) \u00d7 d (mm)" text, "weight" text, "features" text ) -- Using valid SQLi...
SELECT COUNT("model") FROM table_204_878 WHERE "screen\nsize, pixels" < 3
squall
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Return a bar chart on what ...
SELECT gender, AVG(age) FROM Person GROUP BY gender ORDER BY gender DESC
nvbench
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE...
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_700
nvbench
CREATE TABLE table_14253 ( "Rank" text, "Province" text, "Population (2011)" real, "Area (km\u00b2)" real, "Density (per km\u00b2)" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the area (km ) when the rank is south africa and the populatio...
SELECT AVG("Area (km\u00b2)") FROM table_14253 WHERE "Rank" = 'south africa' AND "Population (2011)" > '51,770,561'
wikisql
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 d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( ...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97395 AND admission...
mimic_iii
CREATE TABLE table_42176 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the margin of victory when the winning score was 5 (69-69-73=211)?
SELECT "Margin of victory" FROM table_42176 WHERE "Winning score" = '−5 (69-69-73=211)'
wikisql
CREATE TABLE table_26538461_2 ( subdivides_in VARCHAR, equivalence_in_varas VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the subdivides in equivalence for varas 1/5
SELECT subdivides_in FROM table_26538461_2 WHERE equivalence_in_varas = "1/5"
sql_create_context
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_kc21.MED_SER_ORG_NO FROM t_kc21 WHERE t_kc21.PERSON_NM = '吴泰和' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_CD = '772079171')
css
CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
SELECT zyjybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN zyjybgb 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 WHERE hz_info.RYBH = '84842097' AND zyjybgb.BGRQ BETWEEN '2012-09-17' AND '2021-06...
css
CREATE TABLE table_name_35 ( winning_team VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Winning team on january 28, 2006?
SELECT winning_team FROM table_name_35 WHERE date = "january 28, 2006"
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 prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Awaiting organ transplant status"
mimicsql_data
CREATE TABLE mzjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
SELECT * FROM zyjybgb WHERE zyjybgb.JZLSH = '86575549461' UNION SELECT * FROM mzjybgb WHERE mzjybgb.JZLSH = '86575549461'
css
CREATE TABLE table_40049 ( "City" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the ICAO for luqa airport?
SELECT "ICAO" FROM table_40049 WHERE "Airport" = 'luqa airport'
wikisql
CREATE TABLE table_204_889 ( id number, "date" text, "week (stage)" text, "song choice" text, "original artist" text, "theme" text, "result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the number of weeks songs were performed ?
SELECT COUNT(DISTINCT "week (stage)") FROM table_204_889
squall
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
SELECT AVG(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 = '016-25562')) AND lab.labname = 'creatinine' AND STRFTIME('%y-%m', lab.labresulttim...
eicu
CREATE TABLE table_203_430 ( id number, "draw" number, "artist" text, "song" text, "jury" number, "televote" number, "total" number, "place" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the first place eurovision song contes...
SELECT "song" FROM table_203_430 WHERE "place" = 1
squall
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '孙宏儒' AND t_kc22.STA_DATE BETWEEN '2001-05-01' AND '2016-04-05' AND t_kc22.SELF_PAY_AMO > 4787.85 UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fgwyjzb.P...
css
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Badges ( Id number, UserId number, Name t...
SELECT ot.PostId, ot.CreationDate, ot.Text, te.CreationDate, te.Text, te.Comment FROM PostHistory AS ot JOIN PostHistory AS te ON ot.PostId = te.PostId WHERE te.PostHistoryTypeId = 6 AND ot.PostHistoryTypeId = 3 AND YEAR(ot.CreationDate) < 2016 AND YEAR(ot.CreationDate) > 2012 AND te.Comment LIKE '%added tag%' ORDER BY...
sede
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 admissions ( row_id number, subject_id number, hadm_id number, admittime time, ...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'opn/oth rep mtrl vlv-tis') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 89202) AND...
mimic_iii
CREATE TABLE table_15101 ( "Model" text, "Seats" text, "Period" text, "Built" text, "Country" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what time period was the Cessna 208 built?
SELECT "Period" FROM table_15101 WHERE "Model" = 'cessna 208'
wikisql
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 qtb.OUT_DIAG_DOC_CD, qtb.OUT_DIAG_DOC_NM FROM qtb WHERE qtb.PERSON_NM = '魏力学' AND qtb.IN_HOSP_DATE BETWEEN '2006-08-31' AND '2017-12-31' GROUP BY qtb.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT gyb.OUT_DIAG_DOC_CD, gyb.OUT_DIAG_DOC_NM FROM gyb WHERE gyb.PERSON_NM = '魏力学' AND gyb.IN_HOSP_DATE BETW...
css
CREATE TABLE table_37172 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text ) -- Using valid SQLite, answer the following questions f...
SELECT "Drawn" FROM table_37172 WHERE "Played" = '22' AND "Points" = '96'
wikisql
CREATE TABLE table_name_71 ( attendance INTEGER, venue VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average Attendance, when Venue is 'Candlestick Park', and when Date is 'December 27'?
SELECT AVG(attendance) FROM table_name_71 WHERE venue = "candlestick park" AND date = "december 27"
sql_create_context
CREATE TABLE table_66563 ( "Season" text, "Event type" text, "Location" text, "Format" text, "Date" text, "Rank" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In what season did he compete in the Grand Prix in Kuala Lumpur?
SELECT "Season" FROM table_66563 WHERE "Event type" = 'grand prix' AND "Location" = 'kuala lumpur'
wikisql
CREATE TABLE table_name_36 ( rank INTEGER, team VARCHAR, speed VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Rank of the Rider with a Speed of 111.072mph in Team 250CC Honda?
SELECT AVG(rank) FROM table_name_36 WHERE team = "250cc honda" AND speed = "111.072mph"
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 WHERE t_kc21.PERSON_NM = '凤红艳' AND t_kc21.CLINIC_TYPE = '住院' AND MOD(t_kc21.MED_AMOUT, 1) = 0
css
CREATE TABLE table_name_87 ( result VARCHAR, round VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What result occurs when the round is 4 leg 2?
SELECT result FROM table_name_87 WHERE round = "4 leg 2"
sql_create_context
CREATE TABLE table_57969 ( "CERCLIS ID" text, "Name" text, "County" text, "Proposed" text, "Listed" text, "Construction completed" text, "Partially deleted" text, "Deleted" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Tell me the liste...
SELECT "Listed" FROM table_57969 WHERE "CERCLIS ID" = 'msd004006995'
wikisql
CREATE TABLE table_75134 ( "Rank" text, "Runs" text, "Opponent" text, "Venue" text, "Season" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Runs has a Opponent of south australia?
SELECT "Runs" FROM table_75134 WHERE "Opponent" = 'south australia'
wikisql
CREATE TABLE table_name_29 ( venue VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the venue on the 20th?
SELECT venue FROM table_name_29 WHERE date = "20th"
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 procedures ( ...
SELECT demographic.days_stay, demographic.discharge_location FROM demographic WHERE demographic.subject_id = "98220"
mimicsql_data
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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
SELECT COUNT(*) > 0 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 = 25814)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [syst...
mimic_iii
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 COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'plastic surgery consultation' AND STRFTIME('%y', treatment.treatmenttime)...
eicu
CREATE TABLE table_31412 ( "Rank" real, "Country/Territory" text, "Miss Earth" text, "Miss Air" real, "Miss Water" real, "Miss Fire" real, "Semifinalists" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the most Miss...
SELECT MAX("Miss Fire") FROM table_31412
wikisql
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 varchar(20) ) CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state ...
SELECT bname, SUM(amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T1.bname ORDER BY bname DESC
nvbench
CREATE TABLE table_name_85 ( high_points VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the highest number of points a player got during the game on May 25?
SELECT high_points FROM table_name_85 WHERE date = "may 25"
sql_create_context
CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cine...
SELECT Openning_year, COUNT(Openning_year) FROM cinema GROUP BY Openning_year ORDER BY COUNT(Openning_year)
nvbench
CREATE TABLE city ( City_ID int, County_ID int, Name text, White real, Black real, Amerindian real, Asian real, Multiracial real, Hispanic real ) CREATE TABLE county_public_safety ( County_ID int, Name text, Population int, Police_officers int, Residents_per_offi...
SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force ORDER BY Police_force
nvbench
CREATE TABLE table_78979 ( "Place" real, "Name" text, "All Around" real, "Clubs" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many places have bianka panova as the name, with clubs less than 10?
SELECT COUNT("Place") FROM table_78979 WHERE "Name" = 'bianka panova' AND "Clubs" < '10'
wikisql
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, ...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15107) AND NOT icustays.outtime IS NULL OR...
mimic_iii
CREATE TABLE table_12705 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Tie no for the game with the away team Whyteleafe?
SELECT "Tie no" FROM table_12705 WHERE "Away team" = 'whyteleafe'
wikisql
CREATE TABLE table_name_52 ( attendance INTEGER, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest attendance on September 3, 1972?
SELECT MIN(attendance) FROM table_name_52 WHERE date = "september 3, 1972"
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Self Pay" AND diagnoses.long_title = "Blood in stool"
mimicsql_data
CREATE TABLE table_name_15 ( week VARCHAR, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Week, when Opponent is At Cleveland Browns?
SELECT COUNT(week) FROM table_name_15 WHERE opponent = "at cleveland browns"
sql_create_context
CREATE TABLE table_name_24 ( home_team VARCHAR, tie_no VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who is the home team when tie no is less than 7 and the away team is havant & waterlooville?
SELECT home_team FROM table_name_24 WHERE tie_no < 7 AND away_team = "havant & waterlooville"
sql_create_context
CREATE TABLE table_12096 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the player with a t6 place?
SELECT "Player" FROM table_12096 WHERE "Place" = 't6'
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 prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25796) AND prescriptions.route = 'pr' ORDER BY prescriptions.startdate DESC LIMIT 1
mimic_iii