context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
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),
... | Show me a bar chart for how many students are advised by each rank of faculty? List the rank and the number of students, and order in ascending by the Y-axis please. | SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_name_25 (
semi_finalists VARCHAR,
runner_up VARCHAR,
week_of VARCHAR
) | When the runner-up is listed as Gigi Fern ndez Natalia Zvereva and the week is 26 June 2 weeks, who are the semi finalists? | SELECT semi_finalists FROM table_name_25 WHERE runner_up = "gigi fernández natalia zvereva" AND week_of = "26 june 2 weeks" | sql_create_context |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | A pie chart shows the proportion of All_Neutral and School_ID. | SELECT All_Neutral, School_ID FROM basketball_match | nvbench |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TA... | what amount of hours have passed since patient 022-6959 had the last procedure on this hospital visit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-6959'... | eicu |
CREATE TABLE table_name_50 (
score VARCHAR,
opponent_in_final VARCHAR,
outcome VARCHAR,
partnering VARCHAR
) | What is Score, when Outcome is 'winner', when Partnering is 'Nicole Sewell', and when Opponent in Final is 'Victoria Davies / Kate Warne-Holland'? | SELECT score FROM table_name_50 WHERE outcome = "winner" AND partnering = "nicole sewell" AND opponent_in_final = "victoria davies / kate warne-holland" | sql_create_context |
CREATE TABLE table_53662 (
"Entrant" text,
"Constructor" text,
"Chassis" text,
"Tyre" text,
"Driver" text,
"Rounds" text
) | Can you say what was the entrant of maserati built item with a Tyre of p with a chassis of 250f a6gcm that was driven by Luigi Villoresi? | SELECT "Entrant" FROM table_53662 WHERE "Constructor" = 'maserati' AND "Tyre" = 'p' AND "Chassis" = '250f a6gcm' AND "Driver" = 'luigi villoresi' | wikisql |
CREATE TABLE table_204_927 (
id number,
"title" text,
"year" number,
"artist(s)" text,
"album" text,
"writer(s)" text,
"producer(s)" text
) | what is the total number of titles in 2011 ? | SELECT COUNT("title") FROM table_204_927 WHERE "year" = 2011 | squall |
CREATE TABLE table_name_81 (
outcome VARCHAR,
partner VARCHAR,
venue VARCHAR
) | What is the Outcome in the Malaysia Open with Partner Yoo Sang-Hee? | SELECT outcome FROM table_name_81 WHERE partner = "yoo sang-hee" AND venue = "malaysia open" | sql_create_context |
CREATE TABLE table_15060 (
"Tournament" text,
"2007" text,
"2008" text,
"2009" text,
"Career Win-Loss" text
) | What is the win-loss when 2008 has a value of Q1 at Australian Open? | SELECT "Career Win-Loss" FROM table_15060 WHERE "2008" = 'q1' AND "Tournament" = 'australian open' | wikisql |
CREATE TABLE table_55678 (
"Riding" text,
"Candidate" text,
"Gender" text,
"Residence" text,
"Occupation" text,
"Votes" real,
"Rank" text
) | What is the occupation of the candidate that resides in Windsor Junction? | SELECT "Occupation" FROM table_55678 WHERE "Residence" = 'windsor junction' | wikisql |
CREATE TABLE table_name_10 (
eviction_result VARCHAR,
net_vote VARCHAR
) | Which Eviction result has a Net vote of 31.86%? | SELECT eviction_result FROM table_name_10 WHERE net_vote = "31.86%" | sql_create_context |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE admissions (
ro... | what were the four most frequent drugs prescribed within the same month to the patients aged 40s after having been diagnosed with acute kidney failure nos this year? | 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 table_46947 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | who is the opponent when the score is 7 5, 7 6 (8 6)? | SELECT "Opponent" FROM table_46947 WHERE "Score" = '7–5, 7–6 (8–6)' | wikisql |
CREATE TABLE table_76069 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What is the rank with 0 bronze? | SELECT AVG("Rank") FROM table_76069 WHERE "Bronze" < '0' | 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... | 自2007年3月8日起,至2014年7月22日止,4076214的医院总共记录有多少购药医疗数量 | SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4076214' AND t_kc21.IN_HOSP_DATE BETWEEN '2007-03-08' AND '2014-07-22' AND t_kc21.CLINIC_TYPE = '购药' | css |
CREATE TABLE table_34960 (
"Outcome" text,
"Year" text,
"Venue" text,
"Last opponent" text,
"Score" text
) | Outcome of 13, and a Year of 2007 happened in what venue? | SELECT "Venue" FROM table_34960 WHERE "Outcome" = '13' AND "Year" = '2007' | wikisql |
CREATE TABLE regions (
region_id number,
region_name text
)
CREATE TABLE job_history (
employee_id number,
start_date time,
end_date time,
job_id text,
department_id number
)
CREATE TABLE employees (
employee_id number,
first_name text,
last_name text,
email text,
phone... | What are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50? | SELECT email FROM employees WHERE commission_pct = "null" AND salary BETWEEN 7000 AND 12000 AND department_id = 50 | spider |
CREATE TABLE table_204_258 (
id number,
"location" text,
"frequency" number,
"call sign" text,
"network" text,
"call sign meaning" text
) | how many stations have frequencies between 88 and 92 ? | SELECT COUNT(*) FROM table_204_258 WHERE "frequency" >= 88 AND "frequency" <= 92 | squall |
CREATE TABLE table_name_74 (
round INTEGER,
grand_prix VARCHAR
) | What is the smallest round with a Grand Prix of indian gp? | SELECT MIN(round) FROM table_name_74 WHERE grand_prix = "indian gp" | sql_create_context |
CREATE TABLE table_name_93 (
year INTEGER,
playoffs VARCHAR
) | Which year is the lowest one when the playoffs did not qualify? | SELECT MIN(year) FROM table_name_93 WHERE playoffs = "did not qualify" | sql_create_context |
CREATE TABLE Product_Characteristics (
product_id INTEGER,
characteristic_id INTEGER,
product_characteristic_value VARCHAR(50)
)
CREATE TABLE Ref_Characteristic_Types (
characteristic_type_code VARCHAR(15),
characteristic_type_description VARCHAR(80)
)
CREATE TABLE Ref_Colors (
color_code VARC... | Find the category descriptions of the products whose descriptions include letter 't', and count them by a bar chart, and I want to display by the names in descending please. | SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY product_category_description DESC | nvbench |
CREATE TABLE table_46263 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" text,
"Finish" text
) | How much total has a To par of +9? | SELECT COUNT("Total") FROM table_46263 WHERE "To par" = '+9' | wikisql |
CREATE TABLE table_name_22 (
district_attorney VARCHAR,
position VARCHAR
) | Tell me the DA for bureau chief ada | SELECT district_attorney FROM table_name_22 WHERE position = "bureau chief ada" | sql_create_context |
CREATE TABLE table_43064 (
"Round" real,
"Selection" real,
"Player" text,
"Position" text,
"College" text
) | How many rounds had a selection of 165? | SELECT SUM("Round") FROM table_43064 WHERE "Selection" = '165' | wikisql |
CREATE TABLE table_10403 (
"NGC number" real,
"Object type" text,
"Constellation" text,
"Right ascension ( J2000 )" text,
"Declination ( J2000 )" text
) | Name the right ascension for sagittarius and NGC number larger than 6522 for open cluster and declination of 22 | SELECT "Right ascension ( J2000 )" FROM table_10403 WHERE "Constellation" = 'sagittarius' AND "NGC number" > '6522' AND "Object type" = 'open cluster' AND "Declination ( J2000 )" = '°22′' | wikisql |
CREATE TABLE table_25117 (
"Player" text,
"Nat" text,
"Pos" text,
"L Apps" real,
"L G" real,
"C Apps" real,
"C G" real,
"Total Apps" real,
"Total G" real
) | Name the total number of lg for cg is larger than 1.0 for c apps is 3 | SELECT COUNT("L G") FROM table_25117 WHERE "C G" > '1.0' AND "C Apps" = '3' | wikisql |
CREATE TABLE table_64830 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | How many golds have denmark as the nation, with a total less than 1? | SELECT COUNT("Gold") FROM table_64830 WHERE "Nation" = 'denmark' AND "Total" < '1' | wikisql |
CREATE TABLE table_name_89 (
part_number_s_ VARCHAR,
model_number VARCHAR
) | What is the part number of athlon x2 4850e? | SELECT part_number_s_ FROM table_name_89 WHERE model_number = "athlon x2 4850e" | sql_create_context |
CREATE TABLE table_name_1 (
id_code_of_his_zero_fighter VARCHAR,
count VARCHAR
) | Which Zero Fighter has a count of 10? | SELECT id_code_of_his_zero_fighter FROM table_name_1 WHERE count = "10" | sql_create_context |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE job_history (
EMPLO... | For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of phone_number and manager_id , and sort y axis from low to high order please. | SELECT PHONE_NUMBER, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID | nvbench |
CREATE TABLE table_20140132_1 (
venue VARCHAR,
team VARCHAR
) | What is the venue for the team Terek? | SELECT venue FROM table_20140132_1 WHERE team = "Terek" | sql_create_context |
CREATE TABLE table_49271 (
"Name" text,
"Type" text,
"Themed area" text,
"Manufacturer" text,
"Opened" text
) | Which type had an unknown manufacturer? | SELECT "Type" FROM table_49271 WHERE "Manufacturer" = 'unknown' | wikisql |
CREATE TABLE Accounts (
customer_id VARCHAR
)
CREATE TABLE Customers (
customer_first_name VARCHAR,
customer_last_name VARCHAR,
customer_id VARCHAR
) | Show the first names and last names of customers without any account. | SELECT customer_first_name, customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescription... | provide the number of patients whose age is less than 49 and lab test abnormal status is abnormal? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "49" AND lab.flag = "abnormal" | mimicsql_data |
CREATE TABLE Parts (
part_id VARCHAR,
chargeable_amount VARCHAR
) | Which part has the least chargeable amount? List the part id and amount. | SELECT part_id, chargeable_amount FROM Parts ORDER BY chargeable_amount LIMIT 1 | sql_create_context |
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req 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 ... | Is DANCE 103 section 496 going to be offered in the Fall 2017 semester ? | SELECT COUNT(*) > 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.section_number = 496 AND course.department = 'DANCE' AND course.number = 103 AND semester.semester = 'Fall' AND semester... | advising |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE microlab (
microlabid number,
... | when did patient 031-23605 receive blood, venipuncture microbiology testing for the last time? | 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-23605')) AND microlab.culturesite = 'blood, venipuncture' ORD... | eicu |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id numbe... | how many hours has it passed since patient 94229 was admitted to hospital? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 94229 AND admissions.dischtime IS NULL | mimic_iii |
CREATE TABLE table_68234 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Record" text
) | What was the score of the game that had a loss of Williams (1-1)? | SELECT "Score" FROM table_68234 WHERE "Loss" = 'williams (1-1)' | wikisql |
CREATE TABLE table_38639 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | Name the country for johannesburg | SELECT "Country" FROM table_38639 WHERE "City" = 'johannesburg' | wikisql |
CREATE TABLE table_25075 (
"Year" real,
"Network" text,
"Race caller" text,
"s Host" text,
"s Analyst" text,
"Reporters" text,
"Trophy presentation" text
) | Who is the trophy presentation in the year 1987? | SELECT "Trophy presentation" FROM table_25075 WHERE "Year" = '1987' | wikisql |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | count the number of patients who had been prescribed an biotene dry mouth mt liqd. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'biotene dry mouth mt liqd') | eicu |
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 inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id num... | since 2104, what was the four most frequent procedure for patients 20s? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B... | mimic_iii |
CREATE TABLE table_21472 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | Who had the high assists while Erick Dampier (8) had the high rebounds? | SELECT "High assists" FROM table_21472 WHERE "High rebounds" = 'Erick Dampier (8)' | wikisql |
CREATE TABLE table_32636 (
"FAT16" text,
"FAT32" text,
"HPFS" text,
"ISO 9660" text,
"NTFS" text,
"ReFS" text
) | Which NTFS has a no for ReFS and a yes for HPFS? | SELECT "NTFS" FROM table_32636 WHERE "ReFS" = 'no' AND "HPFS" = 'yes' | wikisql |
CREATE TABLE table_25401_2 (
form__to_sing_ VARCHAR,
brazilian_portuguese VARCHAR
) | What is the form ('to sing') when brazilian portuguese is [k t mus]? | SELECT form__to_sing_ FROM table_25401_2 WHERE brazilian_portuguese = "[kɐ̃ˈtẽmus]" | sql_create_context |
CREATE TABLE table_1342393_16 (
party VARCHAR,
first_elected VARCHAR
) | Name the party or first elected is 1920 | SELECT party FROM table_1342393_16 WHERE first_elected = 1920 | sql_create_context |
CREATE TABLE table_name_65 (
drawn INTEGER,
nationality VARCHAR,
games VARCHAR
) | What is the largest draw with 37 games from England? | SELECT MAX(drawn) FROM table_name_65 WHERE nationality = "england" AND games = 37 | sql_create_context |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,... | Site's questions per hour of the day. Questions grouped per hour of the day, posted less than X Days ago; also graphed | SELECT CAST(STR(DATEPART(hour, p.CreationDate)) AS INT) AS Hour, COUNT(DATEPART(hour, p.CreationDate)) AS "# of questions" FROM Posts AS p WHERE p.PostTypeId = 1 AND DATEDIFF(DAY, p.CreationDate, GETDATE()) < '##Days:int?7##' GROUP BY DATEPART(hour, p.CreationDate) | sede |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartr... | what is the average number of daily diagnosed cases of sepsis in 2104? | SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'sepsis' AND STRFTIME('%y', diagnosis.diagnosistime) = '2104' GROUP BY STRFTIME('%y-%m-%d', diagnosis.diagnosistime)) AS t1 | eicu |
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... | For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of hire_date and the average of manager_id bin hire_date by time. | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' | nvbench |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, return a bar chart about the distribution of founder and the average of price , and group by attribute founder, order by the x axis in ascending. | SELECT Founder, AVG(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder | nvbench |
CREATE TABLE table_62412 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ( $ )" real
) | What is the average amount of money of players in t8 place with a 68-71-69-72=280 score? | SELECT AVG("Money ( $ )") FROM table_62412 WHERE "Place" = 't8' AND "Score" = '68-71-69-72=280' | wikisql |
CREATE TABLE table_21101 (
"Name" text,
"Latitude" text,
"Longitude" text,
"Diameter (km)" text,
"Year named" real,
"Name origin" text
) | At the longitude of 355.0e, what is the name origin? | SELECT "Name origin" FROM table_21101 WHERE "Longitude" = '355.0E' | wikisql |
CREATE TABLE table_3733 (
"Country" text,
"Total Drivers" real,
"Champions" text,
"Championships" text,
"Current 3 November 2013" real,
"First driver(s)" text,
"Last/Current driver(s) 3 November 2013" text
) | What is the country when last/current driver(s) 3 november 2013 is daniel abt ( 2012 )? | SELECT "Country" FROM table_3733 WHERE "Last/Current driver(s) 3 November 2013" = 'Daniel Abt ( 2012 )' | wikisql |
CREATE TABLE Patient (
SSN INTEGER,
Name VARCHAR(30),
Address VARCHAR(30),
Phone VARCHAR(30),
InsuranceID INTEGER,
PCP INTEGER
)
CREATE TABLE Department (
DepartmentID INTEGER,
Name VARCHAR(30),
Head INTEGER
)
CREATE TABLE Stay (
StayID INTEGER,
Patient INTEGER,
Room IN... | Find the physicians who are trained in a procedure that costs more than 5000, and count them by a bar chart, display by the how many name from low to high. | SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name ORDER BY COUNT(T1.Name) | nvbench |
CREATE TABLE table_204_170 (
id number,
"player" text,
"position" text,
"games\nstarted" text,
"hometown" text,
"height" text,
"weight" number,
"age" number
) | how many players were from ann arbor ? | SELECT COUNT("player") FROM table_204_170 WHERE "hometown" = 'ann arbor' | squall |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | CLEANUP: find posts that could probably use some copy-editing. | SELECT p.Id AS "post_link", p.CreationDate, p.OwnerUserId AS "user_link" FROM Posts AS p WHERE p.Body LIKE '% i %' COLLATE Latin1_General_BIN OR p.Title LIKE 'a-z%' COLLATE Latin1_General_BIN OR p.Body LIKE '%`%' ORDER BY p.CreationDate DESC | sede |
CREATE TABLE table_78102 (
"Rd #" real,
"Pick #" real,
"Player" text,
"Team (League)" text,
"Reg GP" real,
"Pl GP" real
) | What's the highest Pl GP with a Reg GP over 18? | SELECT MAX("Pl GP") FROM table_78102 WHERE "Reg GP" > '18' | wikisql |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate tim... | Youngest Users With More than 5000 Reputation. | SELECT Id AS "user_link", * FROM (SELECT * FROM Users WHERE Age != '' AND Age >= 13 AND Reputation > 5000 ORDER BY Age LIMIT 100) AS users | sede |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
... | count the number of patients whose diagnoses short title is hemorrhage complic proc and drug type is main? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hemorrhage complic proc" AND prescriptions.drug_type = "MAIN" | mimicsql_data |
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,
... | count the number of inpatient hospital admission patients who were admitted before the year 2174. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.admityear < "2174" | mimicsql_data |
CREATE TABLE table_name_81 (
record VARCHAR,
round INTEGER
) | What was his record when he went over 1 round? | SELECT record FROM table_name_81 WHERE round > 1 | sql_create_context |
CREATE TABLE table_train_183 (
"id" int,
"anemia" bool,
"hiv_infection" bool,
"hemoglobin_a1c_hba1c" float,
"creatinine_clearance_cl" float,
"panel_reactive_antibodies" int,
"NOUSE" float
) | hba1c 12 % | SELECT * FROM table_train_183 WHERE hemoglobin_a1c_hba1c < 12 | criteria2sql |
CREATE TABLE table_51949 (
"Rank ( WJC )" real,
"Rank (ARDA)" real,
"Metro area" text,
"Number of Jews (WJC)" real,
"Number of Jews (ASARB)" real
) | How many number of WJC Jews in the Los Angeles Metro Area has a ARDA rank of more than 2? | SELECT SUM("Number of Jews (WJC)") FROM table_51949 WHERE "Metro area" = 'los angeles' AND "Rank (ARDA)" > '2' | wikisql |
CREATE TABLE table_21781578_2 (
original_air_date VARCHAR,
season_no VARCHAR
) | What was the original air date for season number 2? | SELECT original_air_date FROM table_21781578_2 WHERE season_no = 2 | sql_create_context |
CREATE TABLE table_14325653_2 (
publisher_s_ VARCHAR,
video_game VARCHAR
) | Name the publisher for resident evil 4 | SELECT publisher_s_ FROM table_14325653_2 WHERE video_game = "Resident Evil 4" | sql_create_context |
CREATE TABLE table_16240 (
"Province" text,
"Population (2004 estimate)" real,
"Area (km\u00b2)" real,
"Density" text,
"GDP (2003, PPS in mil. \u20ac )" real,
"GDP per cap. (2003, in \u20ac)" real
) | Which province has a gdp of 38355 million euros? | SELECT "Province" FROM table_16240 WHERE "GDP (2003, PPS in mil. \u20ac )" = '38355' | wikisql |
CREATE TABLE table_13460 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What Nation has more than 4 silver, more than 3 gold and 18 total medals? | SELECT "Nation" FROM table_13460 WHERE "Silver" > '4' AND "Gold" > '3' AND "Total" = '18' | wikisql |
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_capacity INTEGER,
gender VARCHAR(1)
)
CREATE TABLE Lives_in (
stuid INTEGER,
dormid INTEGER,
room_number INTEGER
)
CREATE TABLE Student (
StuID INTEGE... | A bar chart about how many students are older than average for each gender?, and sort by the X-axis from high to low please. | SELECT Sex, COUNT(*) FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex ORDER BY Sex DESC | nvbench |
CREATE TABLE table_68330 (
"Sydney" text,
"Melbourne" text,
"Perth" text,
"Adelaide" text,
"Gold Coast" text,
"Auckland" text
) | Which Adelaide's Melbourne and Perth were yes when Auckland was no? | SELECT "Adelaide" FROM table_68330 WHERE "Melbourne" = 'yes' AND "Auckland" = 'no' AND "Perth" = 'yes' | wikisql |
CREATE TABLE circuits (
circuitid number,
circuitref text,
name text,
location text,
country text,
lat number,
lng number,
alt number,
url text
)
CREATE TABLE pitstops (
raceid number,
driverid number,
stop number,
lap number,
time text,
duration text,
mi... | What are the different names of all the races in reverse alphabetical order? | SELECT DISTINCT name FROM races ORDER BY name DESC | spider |
CREATE TABLE table_374 (
"Rank" real,
"English title" text,
"Chinese title" text,
"Average" real,
"Peak" real,
"Premiere" real,
"Finale" real,
"HK viewers" text
) | what is the Chinese name for Forensic heroes ii? | SELECT "Chinese title" FROM table_374 WHERE "English title" = 'Forensic Heroes II' | wikisql |
CREATE TABLE table_54781 (
"Rank" real,
"Club" text,
"Gold" real,
"Big Silver" real,
"Small Silver" real,
"Bronze" real,
"Points" real
) | Club aik had over 9 small silver medals and more than 8 bronze medals, how many total points did they have? | SELECT AVG("Points") FROM table_54781 WHERE "Small Silver" > '9' AND "Club" = 'aik' AND "Bronze" > '8' | wikisql |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
Rejection... | Top 20 users called DavidG. Top 20 SO users from China | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(DisplayName) = 'jon skeet' ORDER BY Reputation DESC LIMIT 20 | sede |
CREATE TABLE table_72025 (
"Name" text,
"Reign" real,
"Days held" text,
"Location" text,
"Defenses" real
) | What is the days held the champion with a reign larger than 3 and less than 1 defense has? | SELECT "Days held" FROM table_72025 WHERE "Reign" > '3' AND "Defenses" < '1' | 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 prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | count the number of patients whose diagnoses long title is malignant carcinoid tumor of the rectum and lab test category is hematology? | 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 = "Malignant carcinoid tumor of the rectum" AND lab."CATEGORY" = "Hematology" | mimicsql_data |
CREATE TABLE table_203_228 (
id number,
"#" number,
"title" text,
"songwriters" text,
"producer(s)" text,
"performer (s)" text
) | which songwriter is credited with the largest number of songs ? | SELECT "songwriters" FROM table_203_228 GROUP BY "songwriters" ORDER BY COUNT("title") DESC LIMIT 1 | squall |
CREATE TABLE table_204_853 (
id number,
"pos" number,
"grid" number,
"no." number,
"driver" text,
"team" text,
"manufacturer" text,
"laps" number,
"points" number
) | how many drivers got less than 80 points ? | SELECT COUNT("driver") FROM table_204_853 WHERE "points" < 80 | squall |
CREATE TABLE table_55067 (
"NGC number" real,
"Object type" text,
"Constellation" text,
"Right ascension ( J2000 )" text,
"Declination ( J2000 )" text,
"Apparent magnitude" real
) | Tell me the declination with NGC number larger than 5750 | SELECT "Declination ( J2000 )" FROM table_55067 WHERE "NGC number" > '5750' | wikisql |
CREATE TABLE table_45979 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Record" text
) | What was the score when Calgary was visiting team and Niittymaki had the decision? | SELECT "Score" FROM table_45979 WHERE "Decision" = 'niittymaki' AND "Visitor" = 'calgary' | wikisql |
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId... | Show votes on my questions. | SELECT Posts.Id, Posts.Title, Posts.Score, CASE Votes.VoteTypeId WHEN 2 THEN 'up' WHEN 3 THEN 'down' WHEN 15 THEN 'mod review' WHEN 16 THEN 'approve edit' ELSE CONCAT('<', Votes.VoteTypeId, '>') END AS VoteType FROM Posts JOIN Votes ON Posts.Id = Votes.PostId WHERE Posts.OwnerUserId = '##UserId##' AND Posts.PostTypeId ... | sede |
CREATE TABLE table_61256 (
"Team" text,
"Played" real,
"Draw" real,
"Lost" real,
"Goals Scored" real,
"Goals Conceded" real,
"Points" text
) | Name the Goals Conceded which has a Draw of 0 and a Played larger than 0? | SELECT AVG("Goals Conceded") FROM table_61256 WHERE "Draw" = '0' AND "Played" > '0' | wikisql |
CREATE TABLE table_40407 (
"Platform" real,
"Frequency (per hour)" real,
"Destination" text,
"Service Pattern" text,
"Operator" text,
"Line" text
) | How many frequencies have a line of East London and destination of Crystal Palace? | SELECT COUNT("Frequency (per hour)") FROM table_40407 WHERE "Line" = 'east london' AND "Destination" = 'crystal palace' | wikisql |
CREATE TABLE table_45870 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Location" text
) | What is Method, when Location is 'Tokyo , Japan', and when Event is 'Rings: Millennium Combine 2'? | SELECT "Method" FROM table_45870 WHERE "Location" = 'tokyo , japan' AND "Event" = 'rings: millennium combine 2' | wikisql |
CREATE TABLE table_58804 (
"Date" text,
"Opponent#" text,
"Site" text,
"Result" text,
"Attendance" text
) | What was the result of the game that was attended by 72,703 people? | SELECT "Result" FROM table_58804 WHERE "Attendance" = '72,703' | wikisql |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_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... | 医院1409067所有医疗记录的个人账户支出与医疗费总额的平均比值在2010-02-01到2011-06-01内有多大? | SELECT AVG(t_kc24.PER_ACC_PAY) FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '1409067' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2010-02-01' AND '2011-06-01' | css |
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
dire... | show me all overnight flights from WASHINGTON to SAN FRANCISCO and list their fares | 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, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CIT... | atis |
CREATE TABLE table_name_67 (
attendance INTEGER,
home VARCHAR
) | What is the lowest number of people attending the game where Colorado was the home team? | SELECT MIN(attendance) FROM table_name_67 WHERE home = "colorado" | sql_create_context |
CREATE TABLE table_19071 (
"District" text,
"Counties Represented" text,
"Delegate" text,
"Party" text,
"First Elected" real,
"Committee" text
) | Which country has a delegate who was first elected in 2006? | SELECT "Counties Represented" FROM table_19071 WHERE "First Elected" = '2006' | wikisql |
CREATE TABLE table_25516 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text
) | Who directed the episode titled 'Two Towns'? | SELECT "Directed by" FROM table_25516 WHERE "Title" = 'Two Towns' | wikisql |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
... | when patient 3403 first received the open reduc-int fix femur this year? | 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 = 'open reduc-int fix femur') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3403) AND ... | mimic_iii |
CREATE TABLE table_30149 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production" text,
"U.S. viewers (in millions)" text
) | Who directed the episode whose production code is 2m5901? | SELECT "Directed by" FROM table_30149 WHERE "Production" = '2M5901' | wikisql |
CREATE TABLE table_203_442 (
id number,
"#" number,
"date" text,
"venue" text,
"opponent" text,
"score" text,
"result" text,
"competition" text
) | how many games had at least a score of two or more points ? | SELECT COUNT(*) FROM table_203_442 WHERE "score" + "score" >= 2 | squall |
CREATE TABLE table_dev_34 (
"id" int,
"gender" string,
"heart_disease" bool,
"body_weight" float,
"hematocrit_hct" float,
"fasting_blood_glucose_fbg" float,
"hyperlipidemia" bool,
"systemic_illness" bool,
"angina" bool,
"serum_ldl" int,
"clinically_significant_atherosclerotic... | marked hyperlipidemia ( serum ldl > 158 mg / dl, or serum tg > 691 mg / dl ) | SELECT * FROM table_dev_34 WHERE hyperlipidemia = 1 OR (serum_ldl > 158 OR serum_tg > 691) | criteria2sql |
CREATE TABLE table_35880 (
"Call sign" text,
"Frequency MHz" real,
"City of license" text,
"ERP W" text,
"Class" text,
"FCC info" text
) | What is the Class where City of license is lake oconee, ga? | SELECT "Class" FROM table_35880 WHERE "City of license" = 'lake oconee, ga' | wikisql |
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 patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
... | show me the top four most common diagnoses for patients 50s of age a year before? | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN... | mimic_iii |
CREATE TABLE table_75299 (
"Position" text,
"Game 1" text,
"Game 2" text,
"Game 3" text,
"Exhibition*" text
) | What game 1 has bob lindner as game 2? | SELECT "Game 1" FROM table_75299 WHERE "Game 2" = 'bob lindner' | wikisql |
CREATE TABLE status (
station_id INTEGER,
bikes_available INTEGER,
docks_available INTEGER,
time TEXT
)
CREATE TABLE station (
id INTEGER,
name TEXT,
lat NUMERIC,
long NUMERIC,
dock_count INTEGER,
city TEXT,
installation_date TEXT
)
CREATE TABLE weather (
date TEXT,
... | Tell me the trend using a line chart to show the total number of the station over the installation date, could you sort by the x-axis in asc? | SELECT installation_date, COUNT(installation_date) FROM station GROUP BY installation_date ORDER BY installation_date | nvbench |
CREATE TABLE table_56780 (
"County" text,
"Name" text,
"Length (miles)" real,
"West or south terminus" text,
"East or north terminus" text
) | what is the name when the west or south terminus is ne 112 west of blue springs? | SELECT "Name" FROM table_56780 WHERE "West or south terminus" = 'ne 112 west of blue springs' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.