context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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... | is the hgb level of patient 002-54808 last measured on the first hospital visit less than first measured on the first hospital visit? | SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-54808' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... | eicu |
CREATE TABLE table_9706 (
"Date" text,
"Home team" text,
"Score" text,
"Away team" text,
"Venue" text,
"Box Score" text,
"Report" text
) | Who was the away team for the game with a score of 139-119? | SELECT "Away team" FROM table_9706 WHERE "Score" = '139-119' | wikisql |
CREATE TABLE table_290017_1 (
subdivision_name___ru____bgn_pcgn_ VARCHAR,
code VARCHAR
) | What subdivision names (RU) have a code of by-hr? | SELECT subdivision_name___ru____bgn_pcgn_ FROM table_290017_1 WHERE code = "BY-HR" | sql_create_context |
CREATE TABLE artist (
Artist_ID int,
Artist text,
Age int,
Famous_Title text,
Famous_Release_date text
)
CREATE TABLE music_festival (
ID int,
Music_Festival text,
Date_of_ceremony text,
Category text,
Volume int,
Result text
)
CREATE TABLE volume (
Volume_ID int,
V... | Please give me a bar chart to show the distribution of results of all music festival, and show by the x axis from low to high please. | SELECT Result, COUNT(Result) FROM music_festival GROUP BY Result ORDER BY Result | nvbench |
CREATE TABLE table_31965 (
"Calls" text,
"Frequency" text,
"Branding" text,
"Format" text,
"Timeslot" text,
"Group owner" text
) | Tell me the calls for frequency of 1290 khz | SELECT "Calls" FROM table_31965 WHERE "Frequency" = '1290 khz' | wikisql |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
... | For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of job_id and the sum of department_id , and group by attribute job_id, I want to sort by the sum department id from low to high. | SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(DEPARTMENT_ID) | nvbench |
CREATE TABLE table_28138035_27 (
womens_singles VARCHAR,
womens_doubles VARCHAR
) | How many womens singles entries are there when womens doubles is li xiaodan wen jia? | SELECT COUNT(womens_singles) FROM table_28138035_27 WHERE womens_doubles = "Li Xiaodan Wen Jia" | sql_create_context |
CREATE TABLE table_12195 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" real
) | What is the total for the year (s) won in 1977? | SELECT "Total" FROM table_12195 WHERE "Year(s) won" = '1977' | wikisql |
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
... | What is the average salary for each job title. Show bar chart. | SELECT JOB_TITLE, AVG(SALARY) FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID GROUP BY T2.JOB_TITLE | nvbench |
CREATE TABLE table_name_35 (
no_3 VARCHAR,
no_5 VARCHAR,
no_6 VARCHAR
) | Who was No. 3 when No. 5 James and No. 6 Mason? | SELECT no_3 FROM table_name_35 WHERE no_5 = "james" AND no_6 = "mason" | sql_create_context |
CREATE TABLE zyjzjlb_jybgb (
YLJGDM_ZYJZJLB text,
BGDH number,
YLJGDM number
)
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time... | 在医疗机构2064104中的科室2722在02年8月18日到10年5月12日内处理了多少住院就诊的病人? | SELECT COUNT(*) FROM zyjzjlb WHERE zyjzjlb.YLJGDM = '2064104' AND zyjzjlb.JZKSDM = '2722' AND zyjzjlb.RYDJSJ BETWEEN '2002-08-18' AND '2010-05-12' | css |
CREATE TABLE table_77158 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | What is the lowest Game, when Date is 'November 1'? | SELECT MIN("Game") FROM table_77158 WHERE "Date" = 'november 1' | wikisql |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefin... | Look for a word or substring in user profiles. | SELECT * FROM Users WHERE AboutMe LIKE '%' + '##Text##' + '%' | sede |
CREATE TABLE Staff_Department_Assignments (
staff_id INTEGER,
department_id INTEGER,
date_assigned_from DATETIME,
job_title_code VARCHAR(10),
date_assigned_to DATETIME
)
CREATE TABLE Product_Suppliers (
product_id INTEGER,
supplier_id INTEGER,
date_supplied_from DATETIME,
date_suppl... | Give me a bar chart showing the number of products supplied by supplier id 3 for different product type code. | SELECT product_type_code, COUNT(product_type_code) FROM Product_Suppliers AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3 GROUP BY product_type_code | nvbench |
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
basePrice INTEGER,
decor TEXT
)
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adul... | What is the proportion of the average base price of the rooms for each different decor? Show me a pie chart! | SELECT decor, AVG(basePrice) FROM Rooms GROUP BY decor | nvbench |
CREATE TABLE table_name_19 (
status VARCHAR,
province VARCHAR,
rank VARCHAR
) | What is the listed Status that has the Province of Ontario and Rank of 86? | SELECT status FROM table_name_19 WHERE province = "ontario" AND rank = 86 | sql_create_context |
CREATE TABLE table_18218 (
"District" text,
"Incumbent" text,
"Party" text,
"Elected" real,
"Status" text,
"Opponent" text
) | In how many districts was the democratic incumbent elected in 1974? | SELECT COUNT("District") FROM table_18218 WHERE "Party" = 'Democratic' AND "Elected" = '1974' | wikisql |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age te... | when was the first time patient 018-118331 has been diagnosed with upper respiratory obstruction - suspected in this year? | SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-118331')) AND diagnosis.diagnosisname = 'upper respiratory ob... | eicu |
CREATE TABLE table_47493 (
"Rank" real,
"Club" text,
"Points" real,
"Played" real,
"Victories" real,
"Draws" real,
"Defeats" real,
"Goals for" real,
"Goals against" real,
"Goal average" real
) | What is the highest amount of points with a goal average larger than 4, less than 12 draws, and a goal of 63? | SELECT MAX("Points") FROM table_47493 WHERE "Goal average" > '4' AND "Draws" < '12' AND "Goals for" = '63' | wikisql |
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... | patient 016-29746's temperature during this month was normal? | SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-29746')) AND vitalperiodic.temperature BETWEEN temperature_lower... | eicu |
CREATE TABLE table_11222744_3 (
catalog_number VARCHAR,
title VARCHAR
) | how many titles have the name 'quick callanetics'? | SELECT COUNT(catalog_number) FROM table_11222744_3 WHERE title = "Quick Callanetics" | sql_create_context |
CREATE TABLE table_2101431_1 (
broadcast_date VARCHAR,
archive VARCHAR,
run_time VARCHAR
) | What is the broadcast date of the episode on 16mm t/r that ran 23:25? | SELECT broadcast_date FROM table_2101431_1 WHERE archive = "16mm t/r" AND run_time = "23:25" | sql_create_context |
CREATE TABLE table_27979 (
"No. in series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
) | How many million U.S. viewers watched the epiode with a production code of 1arc12? | SELECT "U.S. viewers (million)" FROM table_27979 WHERE "Production code" = '1ARC12' | wikisql |
CREATE TABLE table_1958 (
"Date Released" text,
"Polling institute" text,
"Social Democratic" text,
"Socialist" text,
"Green-Communist" text,
"Peoples Party" text,
"Left Bloc" text,
"Lead" text
) | How many figures are given for the Socialists in the case where the Social Democrats received 42.2%? | SELECT COUNT("Socialist") FROM table_1958 WHERE "Social Democratic" = '42.2%' | wikisql |
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int... | For 499 , next semester , will Prof. Frank Anderson be teaching the class ? | SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 499 AND instructor.name LIKE '%Frank Anderson%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_... | advising |
CREATE TABLE band (
id number,
firstname text,
lastname text
)
CREATE TABLE performance (
songid number,
bandmate number,
stageposition text
)
CREATE TABLE vocals (
songid number,
bandmate number,
type text
)
CREATE TABLE songs (
songid number,
title text
)
CREATE TABLE i... | What is the last name of the musician that have produced the most number of songs? | SELECT T2.lastname FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid GROUP BY lastname ORDER BY COUNT(*) DESC LIMIT 1 | spider |
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
basePrice INTEGER,
decor TEXT
)
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adul... | Show me the average of baseprice by bedtype in a histogram, and could you sort in ascending by the bars? | SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY bedType | 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... | 找出在一零年十二月二十七号到二一年十二月六号这些年里患者92724967在医院4295408开的所有药的编码和药名 | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '92724967' AND t_kc21.MED_SER_ORG_NO = '4295408' AND t_kc21.IN_HOSP_DATE BETWEEN '2010-12-27' AND '2021-12-06') | css |
CREATE TABLE table_name_54 (
tournament VARCHAR
) | What is the Tournament when the 2013 is 1r? | SELECT tournament FROM table_name_54 WHERE 2013 = "1r" | sql_create_context |
CREATE TABLE roles (
role_code text,
role_name text,
role_description text
)
CREATE TABLE employees (
employee_id number,
role_code text,
employee_name text,
gender_mfu text,
date_of_birth time,
other_details text
)
CREATE TABLE ref_locations (
location_code text,
location_... | What is the name and description for document type code RV? | SELECT document_type_name, document_type_description FROM ref_document_types WHERE document_type_code = "RV" | spider |
CREATE TABLE table_75051 (
"Date" text,
"Result" text,
"Score" text,
"Brazil scorers" text,
"Competition" text
) | What competition has a result of W on June 30, 1966? | SELECT "Competition" FROM table_75051 WHERE "Result" = 'w' AND "Date" = 'june 30, 1966' | 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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | what is days of hospital stay and diagnoses short title of subject id 87275? | SELECT demographic.days_stay, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "87275" | mimicsql_data |
CREATE TABLE table_51676 (
"Rank" real,
"Player" text,
"Country" text,
"Earnings( $ )" real,
"Wins" real
) | What is the average rank of someone who earned smaller than 3,069,633? | SELECT AVG("Rank") FROM table_51676 WHERE "Earnings( $ )" < '3,069,633' | wikisql |
CREATE TABLE table_75009 (
"Series Ep." text,
"Episode" real,
"Netflix" text,
"Segment A" text,
"Segment B" text,
"Segment C" text,
"Segment D" text
) | Segment B of aerospace fuel lines has what segment A? | SELECT "Segment A" FROM table_75009 WHERE "Segment B" = 'aerospace fuel lines' | 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年12月20日到2016年9月1日间15522613这个患者买了几次西药? | SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '15522613' AND t_kc22.STA_DATE BETWEEN '2007-12-20' AND '2016-09-01' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' | css |
CREATE TABLE table_204_342 (
id number,
"#" number,
"player" text,
"span" text,
"caps" number,
"total caps" number,
"win %" text
) | who had the largest win percentage ? | SELECT "player" FROM table_204_342 ORDER BY "win %" DESC LIMIT 1 | squall |
CREATE TABLE table_203_791 (
id number,
"represented" text,
"contestant" text,
"age" number,
"height" text,
"hometown" text
) | who was the youngest delegate for miss dominican republic in 2002 ? | SELECT "contestant" FROM table_203_791 ORDER BY "age" LIMIT 1 | squall |
CREATE TABLE table_261895_1 (
institution VARCHAR,
founded VARCHAR
) | in 1833, how many institutions were created? | SELECT COUNT(institution) FROM table_261895_1 WHERE founded = 1833 | 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,
... | how many patients whose ethnicity is white - russian and lab test name is troponin i? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND lab.label = "Troponin I" | mimicsql_data |
CREATE TABLE table_17265 (
"No." text,
"Player" text,
"Date of Birth" text,
"Batting Style" text,
"Bowling Style" text,
"First Class Team" text
) | What's Javagal Srinath's batting style? | SELECT "Batting Style" FROM table_17265 WHERE "Player" = 'Javagal Srinath' | wikisql |
CREATE TABLE table_name_81 (
position VARCHAR,
school_club_team VARCHAR,
round VARCHAR
) | What position does Maryland have a player for Round 3? | SELECT position FROM table_name_81 WHERE school_club_team = "maryland" AND round = 3 | sql_create_context |
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
... | tell me about the ground transportation from NASHVILLE airport | SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'NASHVILLE' AND ground_service.city_code = city.city_code | atis |
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_DIRE_CD text,
MED_DIRE_NM text,... | 35087658病患在2013年3月20日起2020年5月17日之中的住院次数一共是多少次? | SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.PERSON_ID = '35087658' AND t_kc21.IN_HOSP_DATE BETWEEN '2013-03-20' AND '2020-05-17' AND t_kc21.CLINIC_TYPE = '住院' | css |
CREATE TABLE table_1779 (
"Parish ( Prestegjeld )" text,
"Sub-Parish (Sokn)" text,
"Church Name" text,
"Year Built" real,
"Location of the Church" text
) | Name the most year built for davik kyrkje | SELECT MAX("Year Built") FROM table_1779 WHERE "Church Name" = 'Davik Kyrkje' | wikisql |
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE... | Give me the comparison about the average of ID over the Nationality , and group by attribute Nationality by a bar chart, rank by the Y in descending. | SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY AVG(ID) DESC | nvbench |
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,
... | what is the drug name and drug route of Colton Andrade? | SELECT prescriptions.drug, prescriptions.route FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Colton Andrade" | mimicsql_data |
CREATE TABLE table_13216 (
"Club" text,
"City" text,
"Stadium" text,
"Capacity" real,
"2007\u201308 season" text
) | What Club in Pizzighettone has a Capacity of 10,000 or greater? | SELECT "Club" FROM table_13216 WHERE "Capacity" > '10,000' AND "City" = 'pizzighettone' | wikisql |
CREATE TABLE table_name_38 (
swimsuit INTEGER,
average VARCHAR
) | What is the lowest swimsuit for a contestant with an average of 9.125? | SELECT MIN(swimsuit) FROM table_name_38 WHERE average = 9.125 | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | what is the number of patients whose hospital stay is above 7 days and diagnosed with single ib in-hosp w cs? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "7" AND diagnoses.short_title = "Single lb in-hosp w cs" | mimicsql_data |
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
)
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
) | Compare the total number of captains with different classes using a bar graph, show by the Class in ascending. | SELECT Class, COUNT(Class) FROM captain GROUP BY Class ORDER BY Class | nvbench |
CREATE TABLE table_46661 (
"Country" text,
"Preliminary" real,
"Interview" real,
"Swimsuit" real,
"Evening Gown" real,
"Average" real
) | What is the lowest interview score for Missouri, where the swimsuit score was highter than 9.433? | SELECT MIN("Interview") FROM table_46661 WHERE "Country" = 'missouri' AND "Swimsuit" > '9.433' | wikisql |
CREATE TABLE table_73545 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (in millions)" text
) | How many millions of viewers did the episode written by Andrea Conway Kagey? | SELECT "U.S. viewers (in millions)" FROM table_73545 WHERE "Written by" = 'Andrea Conway Kagey' | wikisql |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
Revision... | User's Rank in a location with min rep cap. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", DisplayName, Reputation, Location, Views, ProfileImageUrl, AboutMe FROM Users WHERE Reputation >= '##repcap##' AND LOWER(Location) LIKE LOWER(N'%##Location##%') ORDER BY Reputation DESC | sede |
CREATE TABLE table_77176 (
"Season" real,
"League" text,
"Finish" text,
"Wins" real,
"Losses" real,
"Ties" real
) | What is the number of losses when the ties are lesser than 0? | SELECT COUNT("Losses") FROM table_77176 WHERE "Ties" < '0' | wikisql |
CREATE TABLE table_37377 (
"Position" text,
"Number" real,
"Name" text,
"Height" text,
"Weight" real,
"Class" text,
"Hometown" text,
"Games\u2191" real
) | What is the hometown of number 40? | SELECT "Hometown" FROM table_37377 WHERE "Number" = '40' | wikisql |
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
... | show me economy fares from DALLAS to BALTIMORE | 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, fare_basis, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND ... | atis |
CREATE TABLE table_49250 (
"Round" real,
"Pick #" real,
"Player" text,
"Position" text,
"College" text
) | What is the total round of the 129 pick? | SELECT COUNT("Round") FROM table_49250 WHERE "Pick #" = '129' | wikisql |
CREATE TABLE table_1140088_6 (
winning_driver VARCHAR,
circuit VARCHAR
) | Who won the Brands Hatch circuit? | SELECT winning_driver FROM table_1140088_6 WHERE circuit = "Brands Hatch" | sql_create_context |
CREATE TABLE table_556 (
"Basic stem (root)" text,
"Present stem" text,
"Non-present stem" text,
"Participle" text,
"Verbal noun" text,
"Short stem" text,
"Meaning" text
) | What's the participle when the verbal noun is i-bil-tze? | SELECT "Participle" FROM table_556 WHERE "Verbal noun" = 'i-bil-tze' | wikisql |
CREATE TABLE table_name_62 (
total INTEGER,
silver VARCHAR,
nation VARCHAR,
gold VARCHAR,
bronze VARCHAR
) | What's the total amount of USSR that has more than 0 gold, less than 85 silver and more than 6 bronze? | SELECT MIN(total) FROM table_name_62 WHERE gold > 0 AND bronze > 6 AND nation = "ussr" AND silver < 85 | sql_create_context |
CREATE TABLE table_27547668_2 (
original_airdate VARCHAR,
_number VARCHAR
) | What is the original air date of # 6? | SELECT original_airdate FROM table_27547668_2 WHERE _number = 6 | sql_create_context |
CREATE TABLE table_73906 (
"Municipality" text,
"No. of Barangays" real,
"Area (km\u00b2)" text,
"Population (2010)" real,
"Pop. density (per km\u00b2)" text,
"Income Class (2004)" text
) | List the population density per kilometer for the city of calintaan? | SELECT "Pop. density (per km\u00b2)" FROM table_73906 WHERE "Municipality" = 'Calintaan' | wikisql |
CREATE TABLE Lessons (
lesson_status_code VARCHAR
) | How many lessons were in cancelled state? | SELECT COUNT(*) FROM Lessons WHERE lesson_status_code = "Cancelled" | sql_create_context |
CREATE TABLE table_13079788_3 (
gtc_winner VARCHAR,
pole_position VARCHAR
) | what are all the gtc winners for pole position no. 21 team modena | SELECT gtc_winner FROM table_13079788_3 WHERE pole_position = "No. 21 Team Modena" | sql_create_context |
CREATE TABLE table_name_16 (
score VARCHAR,
home_team VARCHAR
) | What was the score for the match where the home team was Leicester City? | SELECT score FROM table_name_16 WHERE home_team = "leicester city" | sql_create_context |
CREATE TABLE table_name_31 (
label VARCHAR,
country VARCHAR
) | Which label is from Spain? | SELECT label FROM table_name_31 WHERE country = "spain" | sql_create_context |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate t... | Closed, undeleted, questions with votes <= 1 by date. | SELECT q.Id AS "post_link", q.CreationDate FROM Posts AS q WHERE q.PostTypeId = 1 AND q.CreationDate > '##StartDate##' AND q.CreationDate < '##EndDate##' AND q.ClosedDate > '##StartDate##' AND q.DeletionDate IS NULL AND q.Score <= 1 AND COALESCE((SELECT MAX(a.Score) FROM Posts AS a WHERE a.ParentId = q.Id AND a.PostTyp... | sede |
CREATE TABLE table_name_74 (
escorts VARCHAR,
cruisers VARCHAR
) | How many escorts does the nation with 6 cruisers have? | SELECT escorts FROM table_name_74 WHERE cruisers = "6" | sql_create_context |
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
) | For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and code , and group by attribute name, and display by the y-axis in descending please. | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Code DESC | nvbench |
CREATE TABLE table_29770 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | Who was the other team on march 27? | SELECT "Team" FROM table_29770 WHERE "Date" = 'March 27' | wikisql |
CREATE TABLE department (
Department_ID int,
Name text,
Creation text,
Ranking int,
Budget_in_Billions real,
Num_Employees real
)
CREATE TABLE head (
head_ID int,
name text,
born_state text,
age real
)
CREATE TABLE management (
department_ID int,
head_ID int,
tempor... | Show me mean age by born state in a histogram, rank by the y axis in asc. | SELECT born_state, AVG(age) FROM head GROUP BY born_state ORDER BY AVG(age) | nvbench |
CREATE TABLE mountain (
Mountain_ID int,
Name text,
Height real,
Prominence real,
Range text,
Country text
)
CREATE TABLE climber (
Climber_ID int,
Name text,
Country text,
Time text,
Points real,
Mountain_ID int
) | What are the number of the countries of mountains with height bigger than 5000?, I want to rank by the Y-axis from low to high. | SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country ORDER BY COUNT(Country) | nvbench |
CREATE TABLE table_name_5 (
Id VARCHAR
) | What shows for 2009 when the 2012 is 1R? | SELECT 2009 FROM table_name_5 WHERE 2012 = "1r" | sql_create_context |
CREATE TABLE circulation_history (
document_id number,
draft_number number,
copy_number number,
employee_id number
)
CREATE TABLE addresses (
address_id number,
address_details text
)
CREATE TABLE documents (
document_id number,
document_status_code text,
document_type_code text,
... | Which documents have more than 1 draft copies? List document id and number of draft copies. | SELECT document_id, COUNT(*) FROM draft_copies GROUP BY document_id HAVING COUNT(*) > 1 | spider |
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE... | Bar chart x axis time y axis id | SELECT Time, ID FROM swimmer | nvbench |
CREATE TABLE table_45276 (
"Senator" text,
"Party" text,
"District" real,
"Home Town" text,
"Took Office" real
) | What district has a democratic leader from Roby? | SELECT SUM("District") FROM table_45276 WHERE "Party" = 'democratic' AND "Home Town" = 'roby' | 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 ... | what is the number of patients whose diagnoses long title is abdominal pain, other specified site 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.long_title = "Abdominal pain, other specified site" AND prescriptions.drug_type = "MAIN" | mimicsql_data |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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 employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
... | For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the average of department_id bin hire_date by time, rank by the the average of department id from high to low. | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(DEPARTMENT_ID) DESC | nvbench |
CREATE TABLE table_29829 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | How many teams listed for game 45? | SELECT COUNT("Team") FROM table_29829 WHERE "Game" = '45' | wikisql |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
va... | how was patient 26772 admitted to hospital the last time since 2105? | SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 26772 AND STRFTIME('%y', admissions.admittime) >= '2105' ORDER BY admissions.admittime DESC LIMIT 1 | mimic_iii |
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... | Give me the number of patients diagnosed with cerebral thrombosis with cerebral infarction who had a csf lab test. | 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 = "Cerebral thrombosis with cerebral infarction" AND lab.fluid = "Cerebrospinal Fluid (CSF)" | mimicsql_data |
CREATE TABLE table_30403 (
"# (season #)" text,
"No. (episode #)" text,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Prod. code" text
) | Who directed # (season #) is 1 ( 2 )? | SELECT "Directed by" FROM table_30403 WHERE "# (season #)" = '1 ( 2 )' | wikisql |
CREATE TABLE table_15010 (
"Film" text,
"Year" real,
"Score composer" text,
"U.K. peak position" text,
"U.S. peak position" text
) | How many years had a film that peaked at #10 in the UK? | SELECT COUNT("Year") FROM table_15010 WHERE "U.K. peak position" = '10' | wikisql |
CREATE TABLE table_14103 (
"Pick" real,
"Player" text,
"Team" text,
"Position" text,
"Hometown/School" text
) | Which player was picked before 13, in a P position, and is from Georgia Tech? | SELECT "Player" FROM table_14103 WHERE "Pick" < '13' AND "Position" = 'p' AND "Hometown/School" = 'georgia tech' | wikisql |
CREATE TABLE table_51783 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | Which total number of Week has an Opponent of at new orleans saints, and an Attendance larger than 53,448? | SELECT COUNT("Week") FROM table_51783 WHERE "Opponent" = 'at new orleans saints' AND "Attendance" > '53,448' | wikisql |
CREATE TABLE entrepreneur (
People_ID VARCHAR,
Investor VARCHAR
)
CREATE TABLE people (
Name VARCHAR,
People_ID VARCHAR
) | What are the names of entrepreneurs whose investor is not 'Rachel Elnaugh'? | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor <> "Rachel Elnaugh" | sql_create_context |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE intakeoutput (
intakeoutpu... | since 2105 how many people were diagnosed with hyperglycemia within the same hospital visit after the first diagnosis of diabetes mellitus - type ii? | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hyperglycemia' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105') AS ... | eicu |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE medication (
medicationid number,
pat... | how much is the change in weight of patient 006-161415 last measured on the first hospital visit compared to the second to last value measured on the first hospital visit? | SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-161415' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionweight IS NULL O... | eicu |
CREATE TABLE table_name_67 (
attendance VARCHAR,
home VARCHAR,
date VARCHAR
) | What is the attendance at the Dallas home game on may 12? | SELECT COUNT(attendance) FROM table_name_67 WHERE home = "dallas" AND date = "may 12" | 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... | count the number of patients whose diagnoses short title is candidal esophagitis and drug route is iv? | 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 = "Candidal esophagitis" AND prescriptions.route = "IV" | mimicsql_data |
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
) | For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and code , and group by attribute headquarter, I want to rank in asc by the X-axis. | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name | nvbench |
CREATE TABLE table_1895522_2 (
converted INTEGER,
number VARCHAR
) | What is the smallest converted value at number 19? | SELECT MIN(converted) FROM table_1895522_2 WHERE number = "19" | sql_create_context |
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
... | Dr. Hyukjin Shin will be teaching which classes next semester ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Hyukjin Shin%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offe... | advising |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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... | is patient 16715's level of heart rate last measured on the last intensive care unit visit less than it was second to last measured on the last intensive care unit visit? | SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16715) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents... | mimic_iii |
CREATE TABLE table_57929 (
"Episode" text,
"Air Date" text,
"Rating" real,
"Share" real,
"Rating/Share 18\u201349" text,
"Viewers (m)" real,
"Timeslot Rank" real,
"Night Rank" text,
"Overall Rank" real
) | What is the rating of the episode with 13.47 million viewers and overall rank larger than 6? | SELECT SUM("Rating") FROM table_57929 WHERE "Viewers (m)" = '13.47' AND "Overall Rank" > '6' | wikisql |
CREATE TABLE table_name_4 (
label VARCHAR,
catalog VARCHAR
) | What label has 887 448-2 as the catalog? | SELECT label FROM table_name_4 WHERE catalog = "887 448-2" | sql_create_context |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE p... | what are the three most commonly used procedures for patients that have previously received c v v h within the same month, until 4 years ago? | SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'c v v h' AND DATETIME(treatment.treatmen... | eicu |
CREATE TABLE table_65659 (
"School" text,
"City" text,
"Mascot" text,
"County" text,
"Year joined" real,
"Previous Conference" text,
"Year Left" real,
"Conference Joined" text
) | What city joined the Independents conference after 1963? | SELECT "City" FROM table_65659 WHERE "Year joined" > '1963' AND "Conference Joined" = 'independents' | wikisql |
CREATE TABLE table_name_22 (
away VARCHAR,
season VARCHAR,
record VARCHAR,
win__percentage VARCHAR
) | What is the away score with a record of 7-4, win% of 0.637, and 2010 season? | SELECT away FROM table_name_22 WHERE record = "7-4" AND win__percentage = 0.637 AND season = "2010" | sql_create_context |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE lab (
labid number,
pa... | what is the last ward of patient 013-36766? | SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-36766') ORDER BY patient.unitadmittime DESC LIMIT 1 | eicu |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.