instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE Comments ( Id number, PostId num...
SELECT s.Id AS "post_link", s.Score, MAX(t.Score) AS tScore FROM Posts AS t INNER JOIN PostLinks AS l ON t.Id = l.RelatedPostId INNER JOIN Posts AS s ON s.Id = l.PostId WHERE s.Score >= '##minscore:int?20##' AND l.LinkTypeId = 3 GROUP BY s.Id, s.Score ORDER BY MAX(t.Score) LIMIT 200
sede
CREATE TABLE table_72614 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When it is October 25, 1981 who is the opponent?
SELECT "Opponent" FROM table_72614 WHERE "Date" = 'October 25, 1981'
wikisql
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
(SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE hz_info.RYBH = '72522384' AND jybgb.BGRQ BETWEEN '2001-09-01' AND '2013-05-09') UNI...
css
CREATE TABLE table_21501564_1 ( original_artist VARCHAR, result VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the originally artist when Jasmine Murray was selected?
SELECT original_artist FROM table_21501564_1 WHERE result = "Selected"
sql_create_context
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CATHOLIC" AND lab.label = "WBC, Pleural"
mimicsql_data
CREATE TABLE table_26700 ( "Episode" real, "Airdate" text, "Reward" text, "Immunity" text, "Eliminated" text, "Vote" text, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the vote for 9th voted out day 22
SELECT "Vote" FROM table_26700 WHERE "Finish" = '9th Voted Out Day 22'
wikisql
CREATE TABLE county_public_safety ( county_id number, name text, population number, police_officers number, residents_per_officer number, case_burden number, crime_rate number, police_force text, location text ) CREATE TABLE city ( city_id number, county_id number, name ...
SELECT name FROM county_public_safety WHERE NOT county_id IN (SELECT county_id FROM city)
spider
CREATE TABLE table_name_55 ( team VARCHAR, sport VARCHAR, nation_of_citizenship VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which tennis team is from the United States?
SELECT team FROM table_name_55 WHERE sport = "tennis" AND nation_of_citizenship = "united states"
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 question_id = q.Id, question_url = 'https://stackoverflow.com/q/' + CAST(q.Id AS TEXT(255)), q.ClosedDate, accepted_answer_id = a.Id, accepted_answer_url = 'https://stackoverflow.com/a/' + CAST(a.Id AS TEXT(255)), answer_score = a.Score FROM dbo.Posts AS q INNER JOIN dbo.Posts AS a ON a.Id = q.AcceptedAnswerId W...
sede
CREATE TABLE table_name_53 ( type VARCHAR, principal_activities VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the type for headquarters principal activites.
SELECT type FROM table_name_53 WHERE principal_activities = "headquarters"
sql_create_context
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 allergy ( allergy...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '018-99743' AND patient.hospitaladmitsource = 'emergency department' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-6 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1
eicu
CREATE TABLE table_30413 ( "No. in Series" real, "No. in Season" real, "Title" text, "Directed by" text, "Written by" text, "U.S. viewers (millions)" text, "Original air date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many episodes ...
SELECT COUNT("No. in Series") FROM table_30413 WHERE "U.S. viewers (millions)" = '11.86'
wikisql
CREATE TABLE table_name_9 ( loss VARCHAR, opponent VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the loss of the game against the Angels with a 26-30 record?
SELECT loss FROM table_name_9 WHERE opponent = "angels" AND record = "26-30"
sql_create_context
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, econ...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
atis
CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19,4), derived_product_cost DECIMAL(19,4), derived_vat_payable DECIMAL(19,4), derived_total_cost DECIMAL...
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.customer_first_name DESC
nvbench
CREATE TABLE table_name_76 ( school VARCHAR, ihsaa_class VARCHAR, mascot VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which School has an IHSAA Class of aaa, and a Mascot of saints?
SELECT school FROM table_name_76 WHERE ihsaa_class = "aaa" AND mascot = "saints"
sql_create_context
CREATE TABLE table_name_11 ( outcome VARCHAR, event VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Outcome in 1983 of the WD Event?
SELECT outcome FROM table_name_11 WHERE event = "wd" AND year = "1983"
sql_create_context
CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Movie ( mID int, title text, year int, director text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What ...
SELECT title, AVG(stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY AVG(stars) DESC
nvbench
CREATE TABLE table_9100 ( "Region (year)" text, "No. 1" text, "No. 2" text, "No. 3" text, "No. 4" text, "No. 5" text, "No. 6" text, "No. 7" text, "No. 8" text, "No. 9" text, "No. 10" text ) -- Using valid SQLite, answer the following questions for the tables provided above....
SELECT "No. 3" FROM table_9100 WHERE "No. 5" = 'james' AND "No. 6" = 'mason'
wikisql
CREATE TABLE table_name_93 ( height VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How tall is Daniel Orton?
SELECT height FROM table_name_93 WHERE player = "daniel orton"
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.IN_DIAG_DIS_NM = '癫痫性精神病'
css
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE v...
SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'vitamins/minerals po tabs'
eicu
CREATE TABLE table_55538 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What driver has grid 2 and over 72 laps?
SELECT "Driver" FROM table_55538 WHERE "Laps" > '72' AND "Grid" = '2'
wikisql
CREATE TABLE table_204_232 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- total number of medals earned by the 8th place finishers
SELECT SUM("total") FROM table_204_232 WHERE "rank" = 8
squall
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREA...
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 = 'PHILAD...
atis
CREATE TABLE hz_info_zyjzjlb ( JZLSH number, YLJGDM number, zyjzjlb_id 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 mzjzjlb.YLJGDM FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '秦宛白' UNION SELECT hz_info_zyjzjlb.YLJGDM FROM person_info JOIN hz_info JOIN zyjzjlb JOIN hz_info_zyjzj...
css
CREATE TABLE table_203_753 ( id number, "rank" number, "name" text, "caps" number, "goals" number, "years" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many players were playing in 1990 ?
SELECT COUNT("name") FROM table_203_753 WHERE "years" <= 1990 AND "years" >= 1990
squall
CREATE TABLE table_name_23 ( entrant VARCHAR, driver VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- kenneth mcalpine drove from which entrant?
SELECT entrant FROM table_name_23 WHERE driver = "kenneth mcalpine"
sql_create_context
CREATE TABLE table_name_40 ( status VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the status of the pterosaur named Cathayopterus?
SELECT status FROM table_name_40 WHERE name = "cathayopterus"
sql_create_context
CREATE TABLE table_name_76 ( quantity INTEGER, type VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Quantity of Type 2-4-2t?
SELECT SUM(quantity) FROM table_name_76 WHERE type = "2-4-2t"
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 jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB ...
css
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "85" AND lab.label = "Epithelial Cells"
mimicsql_data
CREATE TABLE table_26129220_2 ( party VARCHAR, senator VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the party affiliation for Senator David Goodman?
SELECT party FROM table_26129220_2 WHERE senator = "David Goodman"
sql_create_context
CREATE TABLE table_66556 ( "Date" text, "Location" text, "Lineup" text, "Assist/pass" text, "Score" text, "Result" text, "Competition" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the result at match reports?
SELECT "Result" FROM table_66556 WHERE "Location" = 'match reports'
wikisql
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
SELECT Posts.Id, Posts.Id AS "post_link" FROM Posts WHERE Tags = '<homework>' AND ClosedDate IS NULL ORDER BY Posts.LastEditDate
sede
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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 varc...
SELECT LAST_NAME, MANAGER_ID FROM employees ORDER BY LAST_NAME
nvbench
CREATE TABLE table_name_5 ( location VARCHAR, reason VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which venues were closed because they were replaced?
SELECT location FROM table_name_5 WHERE reason = "replaced"
sql_create_context
CREATE TABLE table_79202 ( "Country" text, "Event" text, "Time" text, "Date" text, "Place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Place of the half marathon Event?
SELECT "Place" FROM table_79202 WHERE "Event" = 'half marathon'
wikisql
CREATE TABLE table_11621747_1 ( tournament VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the tournament of aug 29?
SELECT tournament FROM table_11621747_1 WHERE date = "Aug 29"
sql_create_context
CREATE TABLE table_56071 ( "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 was the away team's score at windy hill?
SELECT "Away team score" FROM table_56071 WHERE "Venue" = 'windy hill'
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 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "SINGLE" AND procedures.icd9_code = "4610"
mimicsql_data
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2200" AND procedures.icd9_code = "3612"
mimicsql_data
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 mzjzjlb.JZLSH FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '27160966' AND NOT mzjzjlb.JZLSH IN (SELECT zyjybgb.JZLSH FROM zyjybgb WHERE zyjybgb.BGRQ <= '2007-10-30' UNION SELECT mzjybgb.JZLSH FROM mzjybgb WHERE mzjybgb...
css
CREATE TABLE table_name_64 ( english VARCHAR, plautdietsch VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which English has Plautdietsch of aupel?
SELECT english FROM table_name_64 WHERE plautdietsch = "aupel"
sql_create_context
CREATE TABLE table_21379 ( "Official Name" text, "Status" text, "Area km 2" text, "Population" real, "Census Ranking" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the population of each community with city status?
SELECT "Population" FROM table_21379 WHERE "Status" = 'City'
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 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.YLJGDM AND jybgb.BGDH = jyjgzbb....
css
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
SELECT AVG(t_kc21.MED_AMOUT) FROM t_kc21 WHERE t_kc21.MED_ORG_DEPT_NM = '神经内科' AND t_kc21.IN_HOSP_DATE BETWEEN '2008-03-15' AND '2013-06-01' AND t_kc21.IN_DIAG_DIS_CD = 'L40.551' AND t_kc21.CLINIC_TYPE = '住院'
css
CREATE TABLE table_52767 ( "Name" text, "Pennant" text, "Builder" text, "Laid Down" text, "Launched" text, "Commissioned" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the pennant when the builder is yarrow, scotstoun?
SELECT "Pennant" FROM table_52767 WHERE "Builder" = 'yarrow, scotstoun'
wikisql
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 AVG(demographic.age) FROM demographic WHERE demographic.age >= "74" AND demographic.admityear >= "2105"
mimicsql_data
CREATE TABLE table_name_53 ( record VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the record on April 8?
SELECT record FROM table_name_53 WHERE date = "april 8"
sql_create_context
CREATE TABLE table_name_23 ( game INTEGER, points VARCHAR, february VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Game is the average one that has a February larger than 20, and a Record of 41 17 4, and Points smaller than 86?
SELECT AVG(game) FROM table_name_23 WHERE february > 20 AND record = "41–17–4" AND points < 86
sql_create_context
CREATE TABLE table_name_64 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which 2009 has a 2008 of wta premier mandatory tournaments?
SELECT 2009 FROM table_name_64 WHERE 2008 = "wta premier mandatory tournaments"
sql_create_context
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 AVG(vitalperiodic.systemicmean) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-77687')) AND NOT vitalperiodic.systemicmean I...
eicu
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT SUM(t_kc24.PER_ACC_PAY) FROM t_kc24 WHERE t_kc24.PERSON_ID = '59712321' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2011-10-02' AND '2013-05-14'
css
CREATE TABLE table_name_94 ( transfer_fee VARCHAR, transfer_window VARCHAR, moving_to VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Transfer fee, when the Transfer window is 'winter', and when the item 'Moving to' is Northwich Victoria?
SELECT transfer_fee FROM table_name_94 WHERE transfer_window = "winter" AND moving_to = "northwich victoria"
sql_create_context
CREATE TABLE table_2434 ( "Conference" text, "Regular Season Winner" text, "Conference Player of the Year" text, "Conference Tournament" text, "Tournament Venue (City)" text, "Tournament Winner" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Whe...
SELECT "Conference Player of the Year" FROM table_2434 WHERE "Tournament Winner" = 'Virginia Tech'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medication...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-24513')) AND microlab.culturesite = 'sputum, tracheal specime...
eicu
CREATE TABLE table_204_418 ( id number, "date" text, "opponent" text, "score" text, "overall record" text, "scba record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many games did they win by at least 5 points ?
SELECT COUNT(*) FROM table_204_418 WHERE "score" - "score" >= 5
squall
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
mimic_iii
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.MED_SER_ORG_NO = '4511217' AND t_kc21.HOSP_STS > 0
css
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, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
(SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN 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 = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '柳娟秀' AND NOT...
css
CREATE TABLE order_items ( order_item_id number, order_id number, product_id number ) CREATE TABLE department_store_chain ( dept_store_chain_id number, dept_store_chain_name text ) CREATE TABLE departments ( department_id number, dept_store_id number, department_name text ) CREATE TAB...
SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT AVG(product_price) FROM products)
spider
CREATE TABLE user_profiles ( name VARCHAR, email VARCHAR, followers INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the name and email of the users who have more than 1000 followers.
SELECT name, email FROM user_profiles WHERE followers > 1000
sql_create_context
CREATE TABLE table_33989 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Points" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average number of p...
SELECT AVG("Points") FROM table_33989 WHERE "Played" > '18'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT 24 * (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 = 'alkaline phosphatase') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18866 A...
mimic_iii
CREATE TABLE table_name_99 ( poles VARCHAR, races INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Poles, when Races is less than 16?
SELECT poles FROM table_name_99 WHERE races < 16
sql_create_context
CREATE TABLE table_28283 ( "Year" real, "Population" real, "Total" real, "Violent" real, "Property Crimes" real, "Forcible rape" real, "Robbery" real, "Aggravated assault" real, "Burglary" real, "Larceny Theft" real, "Vehicle Theft" real ) -- Using valid SQLite, answer the ...
SELECT MAX("Burglary") FROM table_28283 WHERE "Property Crimes" = '168630'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
SELECT * FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy...
css
CREATE TABLE SportsInfo ( StuID INTEGER, SportName VARCHAR(32), HoursPerWeek INTEGER, GamesPlayed INTEGER, OnScholarship VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, ...
SELECT SportName, COUNT(*) FROM SportsInfo GROUP BY SportName ORDER BY COUNT(*)
nvbench
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_kc22.AMOUNT) FROM t_kc22 JOIN mzb ON mzb.MED_ORG_DEPT_CD = t_kc22.MED_CLINIC_ID WHERE mzb.PERSON_SEX = '水高翰' AND t_kc22.STA_DATE BETWEEN '2000-01-07' AND '2004-02-14' AND t_kc22.MED_INV_ITEM_TYPE = '手术费'
css
CREATE TABLE table_203_323 ( id number, "city" text, "country" text, "airport" text, "begin" number, "end" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- according to the table , which destination was the last to become available ?
SELECT "city" FROM table_203_323 ORDER BY "begin" DESC LIMIT 1
squall
CREATE TABLE table_train_79 ( "id" int, "fasting_triglycerides" int, "fasting_total_cholesterol" int, "fasting_glucose" int, "age" float, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- laboratory findings of fasting triglycerides greate...
SELECT * FROM table_train_79 WHERE fasting_triglycerides >= 200
criteria2sql
CREATE TABLE table_15144 ( "Electorate" text, "Incumbent" text, "Winner" text, "Majority" real, "Runner up" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the incumbent when Arthur Osborne won the election?
SELECT "Incumbent" FROM table_15144 WHERE "Winner" = 'arthur osborne'
wikisql
CREATE TABLE table_48585 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Result of the game on December 14, 1986 after Week 11?
SELECT "Result" FROM table_48585 WHERE "Week" > '11' AND "Date" = 'december 14, 1986'
wikisql
CREATE TABLE table_203_615 ( id number, "district" text, "incumbent" text, "party" text, "first\nelected" number, "result" text, "candidates" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many democrats were re elected ?
SELECT COUNT(*) FROM table_203_615 WHERE "party" = 'democratic' AND "result" = 're-elected'
squall
CREATE TABLE people ( People_ID int, District text, Name text, Party text, Age int ) CREATE TABLE debate ( Debate_ID int, Date text, Venue text, Num_of_Audience int ) CREATE TABLE debate_people ( Debate_ID int, Affirmative int, Negative int, If_Affirmative_Win bool ...
SELECT Venue, COUNT(Venue) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID GROUP BY Venue ORDER BY Venue DESC
nvbench
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careun...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'fenofibrate micronized' AND DATETIME(prescrip...
mimic_iii
CREATE TABLE table_61509 ( "Date" text, "Opponent" text, "Site" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Opponent has a Site of war memorial stadium little rock, ar, and a Result of l6 7?
SELECT "Opponent" FROM table_61509 WHERE "Site" = 'war memorial stadium • little rock, ar' AND "Result" = 'l6–7'
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 COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '87239192' AND t_kc22.STA_DATE BETWEEN '2008-09-22' AND '2012-04-12' AND t_kc22.t_kc21_MED_SER_ORG_NO = '3998921' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE table_5468 ( "Year" real, "Champion" text, "Score" text, "Opponent" text, "State Champion Head coach" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the score in 1990
SELECT "Score" FROM table_5468 WHERE "Year" = '1990'
wikisql
CREATE TABLE table_3675 ( "No." real, "#" real, "Title" text, "Directed by" text, "Story by" text, "Teleplay by" text, "Original air date" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What number episode...
SELECT MAX("#") FROM table_3675 WHERE "U.S. viewers (millions)" = '0.49'
wikisql
CREATE TABLE table_train_9 ( "id" int, "pregnancy_or_lactation" bool, "intention_to_arterial_catheter" bool, "intention_to_central_venous_catheter" bool, "surgery" bool, "hypotension" bool, "chest_trauma" bool, "burn_injury" int, "impossible_transthoracic_echocardiogram_tte" bool, ...
SELECT * FROM table_train_9 WHERE surgery = 1
criteria2sql
CREATE TABLE table_79335 ( "Draw" real, "Singer" text, "Song" text, "Televoting (votes)" text, "Jury" text, "Place" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The song '2 Be Together' had what jury?
SELECT "Jury" FROM table_79335 WHERE "Song" = '2 be together'
wikisql
CREATE TABLE table_12385 ( "Year" real, "Gold" text, "Silver" text, "Bronze" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Notes, when Silver is 'Jarkko Huovila'?
SELECT "Notes" FROM table_12385 WHERE "Silver" = 'jarkko huovila'
wikisql
CREATE TABLE table_204_398 ( id number, "title" text, "year" number, "publisher" text, "developer" text, "platforms" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- number of official middle earth video games before the year 2000 .
SELECT COUNT("title") FROM table_204_398 WHERE "year" < 2000
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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_ty...
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5/.45ns'...
mimic_iii
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime t...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'buminate')
eicu
CREATE TABLE table_22227 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided a...
SELECT "Directed by" FROM table_22227 WHERE "Written by" = 'Mike Daniels'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicatio...
SELECT AVG(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-38131') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of mon...
eicu
CREATE TABLE track ( Track_ID int, Name text, Location text, Seating real, Year_Opened real ) CREATE TABLE race ( Race_ID int, Name text, Class text, Date text, Track_ID text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Create a ba...
SELECT Class, COUNT(Class) FROM race GROUP BY Class
nvbench
CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), building var...
SELECT dept_name, COUNT(dept_name) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY dept_name ORDER BY dept_name
nvbench
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 Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
nvbench
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), fam...
SELECT author_id, author_tutor_ATB FROM Course_Authors_and_Tutors ORDER BY personal_name
nvbench
CREATE TABLE table_name_5 ( goals VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What were the goals in the game with the 26-28 final score?
SELECT goals FROM table_name_5 WHERE score = "26-28"
sql_create_context
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.age >= "55" AND demographic.days_stay = "8"
mimicsql_data
CREATE TABLE table_46544 ( "Name" text, "Date" text, "Defending forces" text, "Brigade" text, "Population" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the defending forces when Al-Murassas shows for name?
SELECT "Defending forces" FROM table_46544 WHERE "Name" = 'al-murassas'
wikisql
CREATE TABLE table_17527 ( "Season" text, "Mens singles" text, "Womens singles" text, "Mens doubles" text, "Womens doubles" text, "Mixed doubles" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the total number for mens single for 2002/2003
SELECT COUNT("Mens singles") FROM table_17527 WHERE "Season" = '2002/2003'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.age < "62"
mimicsql_data
CREATE TABLE table_6256 ( "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 fo...
SELECT "Played" FROM table_6256 WHERE "Points against" = '263'
wikisql
CREATE TABLE table_name_76 ( score VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score in the September 26 game?
SELECT score FROM table_name_76 WHERE date = "september 26"
sql_create_context