instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
)
CREATE TABLE takes (
ID varchar(5),
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0),
grade varchar(2)
)
CREATE TABLE prereq (
course_id va... | SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name ORDER BY salary | nvbench |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE aircraft (
aircraft_code varchar,... | SELECT DISTINCT airline.airline_code FROM airline, 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_na... | atis |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
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,... | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE program_course.course_id = course.course_id AND program_course.course_id = course.course_id AND program.name LIKE '%CS%' AND program.program_id = program_course.program_id AND semester.sem... | advising |
CREATE TABLE table_46372 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Score" text,
"Record" text,
"Streak" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people attended the game whose score wa... | SELECT "Attendance" FROM table_46372 WHERE "Record" = '1-1' | wikisql |
CREATE TABLE table_203_368 (
id number,
"date" text,
"opponent" text,
"venue" text,
"result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- on what date was the last game in which cardiff city f.c. scored 2 goals ?
| SELECT "date" FROM table_203_368 WHERE "result" = 2 ORDER BY id DESC LIMIT 1 | squall |
CREATE TABLE table_name_84 (
crowd INTEGER,
venue VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lowest crowd seen by the mcg Venue?
| SELECT MIN(crowd) FROM table_name_84 WHERE venue = "mcg" | sql_create_context |
CREATE TABLE table_1059743_1 (
play_off VARCHAR,
points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many games had a score value of 813.5 in post-season play?
| SELECT COUNT(play_off) FROM table_1059743_1 WHERE points = "813.5" | sql_create_context |
CREATE TABLE table_32209 (
"Player" text,
"Nationality" text,
"Position" text,
"From" text,
"School/Country" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which player is associated with Temple?
| SELECT "Player" FROM table_32209 WHERE "School/Country" = 'temple' | wikisql |
CREATE TABLE table_name_82 (
attendance INTEGER,
opponent VARCHAR,
week VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest attendance when the opponent is the Los Angeles Rams and the week is less than 11?
| SELECT MAX(attendance) FROM table_name_82 WHERE opponent = "los angeles rams" AND week < 11 | sql_create_context |
CREATE TABLE table_23014923_1 (
season VARCHAR,
primary__south__winners VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the primary (South) winners is Inter The Bloomfield, what is the season total number?
| SELECT COUNT(season) FROM table_23014923_1 WHERE primary__south__winners = "Inter The Bloomfield" | sql_create_context |
CREATE TABLE table_54232 (
"Draw" real,
"Artist" text,
"Song" text,
"Points" real,
"Place" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What draw for 'ljubav jedne ene' with under 153 points?
| SELECT SUM("Draw") FROM table_54232 WHERE "Song" = 'ljubav jedne žene' AND "Points" < '153' | wikisql |
CREATE TABLE table_11044765_1 (
location VARCHAR,
mascot VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What city and state is the Lancers mascot located?
| SELECT location FROM table_11044765_1 WHERE mascot = "Lancers" | sql_create_context |
CREATE TABLE table_14245 (
"Elector" text,
"Place of birth" text,
"Cardinalatial title" text,
"Elevated" text,
"Elevator" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is listed as the Place of birth for the Elector of Soffredo?
| SELECT "Place of birth" FROM table_14245 WHERE "Elector" = 'soffredo' | wikisql |
CREATE TABLE Invoices (
invoice_number INTEGER,
order_id INTEGER,
invoice_date DATETIME
)
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),
de... | SELECT order_id, COUNT(*) FROM Invoices GROUP BY order_id | nvbench |
CREATE TABLE Player (
pID numeric(5,0),
pName varchar(20),
yCard varchar(3),
HS numeric(5,0)
)
CREATE TABLE Tryout (
pID numeric(5,0),
cName varchar(20),
pPos varchar(8),
decision varchar(3)
)
CREATE TABLE College (
cName varchar(20),
state varchar(2),
enr numeric(5,0)
)
... | SELECT pPos, MIN(T2.HS) FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID GROUP BY pPos ORDER BY pPos | nvbench |
CREATE TABLE table_name_48 (
score_in_the_final VARCHAR,
partner VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Partner Tomas Behrend's Score in the final?
| SELECT score_in_the_final FROM table_name_48 WHERE partner = "tomas behrend" | 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 MIN(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.diagnosis = "CHEST PAIN" | mimicsql_data |
CREATE TABLE appointment (
appointmentid number,
patient number,
prepnurse number,
physician number,
start time,
end time,
examinationroom text
)
CREATE TABLE affiliated_with (
physician number,
department number,
primaryaffiliation boolean
)
CREATE TABLE medication (
code ... | SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures | spider |
CREATE TABLE table_78333 (
"engine name" text,
"engine code(s)" text,
"engine configuration" text,
"displacement" text,
"max. power at rpm" text,
"max. torque at rpm" text,
"production period" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- W... | SELECT "max. power at rpm" FROM table_78333 WHERE "engine code(s)" = '2e' | wikisql |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic ... | 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.long_title = "Bone marrow replaced by transplant" AND lab.fluid = "Pleural" | mimicsql_data |
CREATE TABLE table_name_36 (
year INTEGER,
notes VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average of all the years when the notes are electronics brand?
| SELECT AVG(year) FROM table_name_36 WHERE notes = "electronics brand" | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2131" AND procedures.short_title = "Open biopsy soft tissue" | mimicsql_data |
CREATE TABLE table_1342292_2 (
district VARCHAR,
first_elected VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what's the district with first elected being 1938
| SELECT district FROM table_1342292_2 WHERE first_elected = 1938 | 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 DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'aspirin chew tab 81 mg') | eicu |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | SELECT DisplayName FROM Users WHERE Reputation >= 3000 | sede |
CREATE TABLE table_6250 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was... | SELECT "Team" FROM table_6250 WHERE "Date" = 'february 1' | wikisql |
CREATE TABLE table_79839 (
"Tournament" text,
"2000" text,
"2001" text,
"2002" text,
"Career SR" text,
"Career Win-Loss" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In what year 2000 tournment did Angeles Montolio have a career win-loss recor... | SELECT "Tournament" FROM table_79839 WHERE "2000" = '2-4' | wikisql |
CREATE TABLE table_name_52 (
title VARCHAR,
length VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which title is 3:38 long?
| SELECT title FROM table_name_52 WHERE length = "3:38" | sql_create_context |
CREATE TABLE table_72977 (
"Aircraft" text,
"1990" real,
"destroyed" real,
"damaged" real,
"to Iran" real,
"survived" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If 4 went to iran and the amount that survived was less than 12.0 how many were ... | SELECT COUNT("1990") FROM table_72977 WHERE "to Iran" = '4' AND "survived" < '12.0' | wikisql |
CREATE TABLE t_kc22 (
MED_EXP_DET_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
MED_EXP_BILL_ID text,
SOC_SRT_DIRE_CD text,
SOC_SRT_DIRE_NM text,
DIRE_TYPE number,
CHA_ITEM_LEV number,
MED_INV_ITEM_TYPE text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | SELECT COUNT(*) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '潘和正' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2006-11-28' AND '2019-10-22' AND t_kc24.MED_AMOUT <= 10 | css |
CREATE TABLE Apartments (
apt_id INTEGER,
building_id INTEGER,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5)
)
CREATE TABLE Apartment_Facilities (
apt_id INTEGER,
facility_code CHAR(15)
)
CREATE TABLE Apartment_Buildi... | SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex" ORDER BY COUNT(booking_start_date) DESC | nvbench |
CREATE TABLE table_60770 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score of the 1998 FIFA World Cup qualification competition?
| SELECT "Score" FROM table_60770 WHERE "Competition" = '1998 fifa world cup qualification' | wikisql |
CREATE TABLE table_381 (
"Member" text,
"Electorate" text,
"Province" text,
"MPs term" text,
"Election date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what's the election date where electorate is christchurch country
| SELECT "Election date" FROM table_381 WHERE "Electorate" = 'Christchurch Country' | wikisql |
CREATE TABLE table_68712 (
"Rank" real,
"Station" text,
"City" text,
"State" text,
"Boardings and deboardings" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people boarded and de-boarded the Amtrak in Linthicum?
| SELECT COUNT("Boardings and deboardings") FROM table_68712 WHERE "City" = 'linthicum' | wikisql |
CREATE TABLE table_name_85 (
attendance INTEGER,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the attendance of the game that was played on September 27, 1964?
| SELECT MAX(attendance) FROM table_name_85 WHERE date = "september 27, 1964" | 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 vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605')) AND NOT vitalperiodic.systemicdiastol... | eicu |
CREATE TABLE table_27733909_1 (
date VARCHAR,
game VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what are the times where the play is 5
| SELECT date FROM table_27733909_1 WHERE game = 5 | sql_create_context |
CREATE TABLE table_name_37 (
place VARCHAR,
year VARCHAR,
champion VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Place, when Year is greater than 2006, and when Champion is 'Asvel'?
| SELECT place FROM table_name_37 WHERE year > 2006 AND champion = "asvel" | sql_create_context |
CREATE TABLE table_204_599 (
id number,
"party" text,
"first duma" text,
"second duma" text,
"third duma" text,
"fourth duma" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many third duma and fourth duma for nationalists
| SELECT "third duma" + "fourth duma" FROM table_204_599 WHERE "party" = 'nationalists' | squall |
CREATE TABLE table_name_82 (
incumbent VARCHAR,
result VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the incumbent that retired to run for the senate democratic hold?
| SELECT incumbent FROM table_name_82 WHERE result = "retired to run for the senate democratic hold" | sql_create_context |
CREATE TABLE table_8858 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who had... | SELECT "High rebounds" FROM table_8858 WHERE "Team" = 'denver' | wikisql |
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adults INTEGER,
Kids INTEGER
)
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
baseP... | SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType | nvbench |
CREATE TABLE table_18656 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What district has Riley Joseph Wilson as the incumbent?
| SELECT "District" FROM table_18656 WHERE "Incumbent" = 'Riley Joseph Wilson' | wikisql |
CREATE TABLE table_3225 (
"Pick #" real,
"CFL Team" text,
"Player" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What college did the Toronto Argonauts draft pick come from?
| SELECT "College" FROM table_3225 WHERE "CFL Team" = 'Toronto Argonauts' | wikisql |
CREATE TABLE table_71559 (
"D 48" text,
"D 47" text,
"D 46" text,
"D 45" text,
"D 44" text,
"D 43" text,
"D 42" text,
"D 41" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the D43 associated with a D41 of r 21?
| SELECT "D 43" FROM table_71559 WHERE "D 41" = 'r 21' | wikisql |
CREATE TABLE table_72296 (
"Episode" 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 the result of the Top 3 episode?
| SELECT "Result" FROM table_72296 WHERE "Episode" = 'Top 3' | wikisql |
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50)
)
CREATE TABLE STUDENT (
STU_NUM int,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
STU_HRS int,
STU_CLASS varchar(2),
STU_GPA float(8),
STU_TRANSFER... | SELECT SCHOOL_CODE, COUNT(*) FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE | nvbench |
CREATE TABLE table_name_55 (
name VARCHAR,
nationality VARCHAR,
rank VARCHAR,
lane VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which one has a rank bigger than 2, lane of 1, and is from Hong Kong?
| SELECT name FROM table_name_55 WHERE rank > 2 AND lane = 1 AND nationality = "hong kong" | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Endovascular (total) embolization or occlusion of head and neck vessels" | mimicsql_data |
CREATE TABLE table_39964 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What i... | SELECT "High points" FROM table_39964 WHERE "Date" = 'january 20' | wikisql |
CREATE TABLE table_name_92 (
total INTEGER,
bronze VARCHAR,
silver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the largest total for a nation with 1 bronze and more than 1 silver?
| SELECT MAX(total) FROM table_name_92 WHERE bronze = 1 AND silver > 1 | sql_create_context |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location... | SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18678) AND prescriptions.drug = 'docusate sodium' | mimic_iii |
CREATE TABLE table_56101 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many laps had a grid of greater than 17 and retired due to collision?
| SELECT SUM("Laps") FROM table_56101 WHERE "Grid" > '17' AND "Time/Retired" = 'collision' | wikisql |
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Activity (
actid INTEGER,
... | SELECT Building, COUNT(*) FROM Faculty GROUP BY Building | nvbench |
CREATE TABLE table_1180228_1 (
num_of_discs VARCHAR,
duration VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the total number of discs where the run time was 4 hours 40 minutes?
| SELECT COUNT(num_of_discs) FROM table_1180228_1 WHERE duration = "4 hours 40 minutes" | sql_create_context |
CREATE TABLE gwyjzb (
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 gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '72214494' AND t_kc22.STA_DATE BETWEEN '2003-07-26' AND '2015-04-29' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE f... | css |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPOXIA" | mimicsql_data |
CREATE TABLE table_name_70 (
wins INTEGER,
ties VARCHAR,
losses VARCHAR,
years VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average number of wins for the person who coached from 1951 to 1956 and had less than 174 losses and less than 6... | SELECT AVG(wins) FROM table_name_70 WHERE losses < 174 AND years = "1951 to 1956" AND ties < 6 | sql_create_context |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
... | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-5 yea... | eicu |
CREATE TABLE table_70654 (
"Team 1" text,
"Agg." text,
"Team 2" text,
"1st leg" text,
"2nd leg" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the team 2 with a 0-0 2nd leg?
| SELECT "Team 2" FROM table_70654 WHERE "2nd leg" = '0-0' | wikisql |
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE ta (
campus_job_id int,... | SELECT DISTINCT instructor.name 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_offeri... | advising |
CREATE TABLE table_203_830 (
id number,
"year" number,
"song" text,
"chart positions\nus country" number,
"chart positions\ncan country" number,
"album" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many songs were released after 1977 ?
| SELECT COUNT("song") FROM table_203_830 WHERE "year" > 1977 | squall |
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 * FROM jyjgzbb WHERE jyjgzbb.JCZBMC = (SELECT jyjgzbb.JCZBMC FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '38241644433') AND jyjgzbb.JCZBJGDW = (SELECT jyjgzbb.JCZBJGDW FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '38241644433') AND jyjgzbb.JCZBJGDL >= (SELECT jyjgzbb.JCZBJGDL FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '38241644433') | css |
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_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'cholesterol ratio (total/hdl)') AND STRFTIME('%y', labevents.charttime) <= '2101') | mimic_iii |
CREATE TABLE table_1682026_3 (
profits__billion_$_ VARCHAR,
assets__billion_$_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the profits (in billions) where the assets are 192.8 billion?
| SELECT profits__billion_$_ FROM table_1682026_3 WHERE assets__billion_$_ = "192.8" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.dob_year < "2074" | mimicsql_data |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
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 ... | SELECT t_kc22.HOSP_DOC_CD, t_kc22.HOSP_DOC_NM FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '71582240745' | css |
CREATE TABLE table_19908651_3 (
pole_position VARCHAR,
race_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was on the pole position in the Texaco/Havoline 200 race?
| SELECT pole_position FROM table_19908651_3 WHERE race_name = "Texaco/Havoline 200" | 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 = '章问筠' GROUP BY t_kc21.MED_SER_ORG_NO ORDER BY COUNT(*) DESC | css |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
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,
H... | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '章傲晴' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' | css |
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER... | SELECT Fname, COUNT(Fname) FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = "food") GROUP BY Fname ORDER BY Fname DESC | nvbench |
CREATE TABLE table_13498403_1 (
barrier VARCHAR,
jockey VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How old is Darryll Holland's horse
| SELECT barrier FROM table_13498403_1 WHERE jockey = "Darryll Holland" | sql_create_context |
CREATE TABLE table_name_72 (
record VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Record, when Date is 'November 22'?
| SELECT record FROM table_name_72 WHERE date = "november 22" | 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 gwyjzb.IN_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '1715411' GROUP BY gwyjzb.IN_DIAG_DIS_NM UNION SELECT fgwyjzb.IN_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '1715411' GROUP BY fgwyjzb.IN_DIAG_DIS_NM | css |
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 intakeoutput (
intakeoutpu... | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-8973')) AND intakeoutput.cellpath LIKE '%output%'... | eicu |
CREATE TABLE betfront (
year number,
datetime time,
country text,
competion text,
match text,
home_opening number,
draw_opening number,
away_opening number,
home_closing number,
draw_closing number,
away_closing number
)
CREATE TABLE football_data (
season text,
date... | SELECT COUNT(*) FROM football_data WHERE b365h > psh | worldsoccerdatabase |
CREATE TABLE table_name_23 (
name VARCHAR,
type VARCHAR,
number VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the name for the locomotive with a type of 2-8-0 and a number of 20?
| SELECT name FROM table_name_23 WHERE type = "2-8-0" AND number = 20 | sql_create_context |
CREATE TABLE film (
Studio VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List the name of film studio that have the most number of films.
| SELECT Studio FROM film GROUP BY Studio ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_29641 (
"Rnd" real,
"Circuit" text,
"Sports +2.0 Winning Team" text,
"Sports 2.0 Winning Team" text,
"GT +2.0 Winning Team" text,
"GT 2.0 Winning Team" text,
"Results" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is... | SELECT MIN("Rnd") FROM table_29641 WHERE "Circuit" = 'Laguna Seca' | wikisql |
CREATE TABLE table_204_534 (
id number,
"#" number,
"name" text,
"height" text,
"weight (lbs.)" number,
"position" text,
"class" text,
"hometown" text,
"previous team(s)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- tell me the num... | SELECT COUNT(*) FROM table_204_534 WHERE "class" = 'jr' | squall |
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 person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND 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_MZ... | css |
CREATE TABLE table_name_34 (
circuit VARCHAR,
winner VARCHAR,
series VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Circuit in the ATCC Round 1 Series with Winner Jim Richards?
| SELECT circuit FROM table_name_34 WHERE winner = "jim richards" AND series = "atcc round 1" | sql_create_context |
CREATE TABLE table_27940569_1 (
laps INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the greatest number of laps run?
| SELECT MAX(laps) FROM table_27940569_1 | sql_create_context |
CREATE TABLE table_2508633_8 (
pick__number VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the pick number if the player is Gary Kubiak?
| SELECT pick__number FROM table_2508633_8 WHERE player = "Gary Kubiak" | sql_create_context |
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2178" AND lab.flag = "delta" | mimicsql_data |
CREATE TABLE table_name_2 (
home_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score for south melbourne at home?
| SELECT home_team AS score FROM table_name_2 WHERE home_team = "south melbourne" | sql_create_context |
CREATE TABLE table_23548 (
"#" text,
"Original title" text,
"Directed by" text,
"Written by" text,
"Original airdate" text,
"Production code" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the production code for 'down to earth'?
| SELECT "Production code" FROM table_23548 WHERE "Original title" = 'Down to Earth' | wikisql |
CREATE TABLE Patient (
SSN INTEGER,
Name VARCHAR(30),
Address VARCHAR(30),
Phone VARCHAR(30),
InsuranceID INTEGER,
PCP INTEGER
)
CREATE TABLE Appointment (
AppointmentID INTEGER,
Patient INTEGER,
PrepNurse INTEGER,
Physician INTEGER,
Start DATETIME,
End DATETIME,
Exa... | SELECT T1.Name, COUNT(*) FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP GROUP BY T1.EmployeeID ORDER BY T1.Name | nvbench |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25... | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID | nvbench |
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 jybgb_jyjgzbb (
JYZBLSH number,
... | SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_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 = jybgb_jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BG... | css |
CREATE TABLE table_34873 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Game site" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What results has a week smaller than 2?
| SELECT "Result" FROM table_34873 WHERE "Week" < '2' | wikisql |
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
start_time time,
end_time time,
monday varchar,
tuesday varchar,
wednesday v... | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Sonya Lewis%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = c... | advising |
CREATE TABLE table_47831 (
"Round" real,
"Pick #" real,
"Player" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the pick # for round 11?
| SELECT "Pick #" FROM table_47831 WHERE "Round" = '11' | 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 (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '2158734' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2012-03-27' AND '2015-09-07' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) > 1025.62) AS T | css |
CREATE TABLE hall_of_fame (
player_id text,
yearid number,
votedby text,
ballots number,
needed number,
votes number,
inducted text,
category text,
needed_note text
)
CREATE TABLE pitching_postseason (
player_id text,
year number,
round text,
team_id text,
league... | SELECT T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY AVG(T2.salary) LIMIT 1 | spider |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
C... | SELECT u.Id AS "user_link", u.DisplayName, u.Location, u.Reputation, u.WebsiteUrl FROM Users AS u, Badges AS B WHERE (u.Location LIKE ('%nited%ingdom%') OR u.Location LIKE ('%UK%') OR u.Location LIKE ('%uk%') OR u.Location LIKE ('%ondon%') OR u.Location LIKE ('%anchester%') OR u.Location LIKE ('%dinburgh%') OR u.Locati... | sede |
CREATE TABLE table_39345 (
"County" text,
"1948" real,
"1956" real,
"1966" real,
"1977" real,
"1992" real,
"2002" real,
"2011" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which 1956 has a County of v lcea, and a 2011 smaller than 3717... | SELECT SUM("1956") FROM table_39345 WHERE "County" = 'vâlcea' AND "2011" < '371714' | wikisql |
CREATE TABLE table_21794 (
"Poll Source" text,
"Dates administered" text,
"Democrat: Jay Nixon" text,
"Republican: Kenny Hulshof" text,
"Lead Margin" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What poll source claimed that Republican: Kenny Huls... | SELECT "Poll Source" FROM table_21794 WHERE "Republican: Kenny Hulshof" = '43%' | wikisql |
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE... | SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID | nvbench |
CREATE TABLE table_11660 (
"Game" real,
"Date" text,
"Location" text,
"Time" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which is the most recent game with an attendance larger than 65,042?
| SELECT MAX("Game") FROM table_11660 WHERE "Attendance" > '65,042' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.