context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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 demographic (...
Calculate the average age of white ethnic background patients who were admitted in or after 2123.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.admityear >= "2123"
mimicsql_data
CREATE TABLE table_388 ( "Component" text, "Integrated" text, "Allied-Related" text, "Allied-Unrelated" text, "Holding" text )
what is the integrated in which the holding allied-unrelated is many?
SELECT "Holding" FROM table_388 WHERE "Allied-Unrelated" = 'Many'
wikisql
CREATE TABLE table_12261806_2 ( trofeo_fast_team VARCHAR, stage VARCHAR )
Name the total number of trofeo fast team of stage 16
SELECT COUNT(trofeo_fast_team) FROM table_12261806_2 WHERE stage = "16"
sql_create_context
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 hz_info ( KH text, KLX number...
报告人的检验报告单38449722176的工号、姓名分别为?
SELECT zyjybgb.BGRGH, zyjybgb.BGRXM FROM zyjybgb WHERE zyjybgb.BGDH = '38449722176' UNION SELECT mzjybgb.BGRGH, mzjybgb.BGRXM FROM mzjybgb WHERE mzjybgb.BGDH = '38449722176'
css
CREATE TABLE table_16710541_2 ( poles INTEGER )
What is the lowest number of poles?
SELECT MIN(poles) FROM table_16710541_2
sql_create_context
CREATE TABLE table_45568 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location/Attendance" text, "Record" text )
What is the opponent of the game with a w 87-64 score?
SELECT "Opponent" FROM table_45568 WHERE "Score" = 'w 87-64'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Show me about the distribution of All_Home and the sum of School_ID , and group by attribute All_Home in a bar chart, and rank sum school id in ascending order please.
SELECT All_Home, SUM(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY SUM(School_ID)
nvbench
CREATE TABLE table_14860 ( "Round" text, "Track" text, "Race 1" text, "Race 2" text, "Race 3" text )
What Round has the Track Clipsal 500 Support?
SELECT "Round" FROM table_14860 WHERE "Track" = 'clipsal 500 support'
wikisql
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostHistory...
Duplicate 'Duplicate' post notices (Thanks to Samuel Liew for a good basis).
SELECT p.CreationDate, p.Id AS "post_link", p.Score, p.ViewCount, p.AnswerCount FROM Posts AS p WHERE p.PostTypeId = 1 AND p.ClosedDate IS NULL AND p.DeletionDate IS NULL AND p.Body LIKE '%Possible Duplicate:%' ORDER BY p.ViewCount DESC LIMIT 1000
sede
CREATE TABLE table_203_523 ( id number, "state" text, "swimsuit" number, "interview" number, "evening gown" number, "average" number, "finalists" number )
what is the total number of points scored in the three rounds in kansas ?
SELECT "swimsuit" + "interview" + "evening gown" FROM table_203_523 WHERE "state" = 'kansas'
squall
CREATE TABLE Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_status_code VARCHAR(10), order_date DATETIME ) CREATE TABLE Department_Stores ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80)...
How many customers use each payment method, list x axis in ascending order.
SELECT payment_method_code, COUNT(*) FROM Customers GROUP BY payment_method_code ORDER BY payment_method_code
nvbench
CREATE TABLE table_name_67 ( round VARCHAR, overall VARCHAR )
Overall of 208 occurred in what round?
SELECT round FROM table_name_67 WHERE overall = 208
sql_create_context
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, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
潘乐山这位患者的补体C3在2003年5月12日到2009年10月10日期间的情况
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM...
css
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...
find the minimum age of patients with primary disease as chest pain and admission location as clinic referral/premature.
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "CHEST PAIN"
mimicsql_data
CREATE TABLE CLASS ( crs_code VARCHAR ) CREATE TABLE department ( school_code VARCHAR, dept_code VARCHAR ) CREATE TABLE course ( crs_code VARCHAR, dept_code VARCHAR )
Find the number of classes in each school.
SELECT COUNT(*), T3.school_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T2.dept_code = T3.dept_code GROUP BY T3.school_code
sql_create_context
CREATE TABLE table_32730 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the venue for the Footscray home team?
SELECT "Venue" FROM table_32730 WHERE "Home team" = 'footscray'
wikisql
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...
which disease is the patient paul edwards diagnosed from?
SELECT diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Paul Edwards"
mimicsql_data
CREATE TABLE table_name_19 ( period INTEGER, element VARCHAR )
Which highest period's element is platinum?
SELECT MAX(period) FROM table_name_19 WHERE element = "platinum"
sql_create_context
CREATE TABLE tracks ( id number, name text, album_id number, media_type_id number, genre_id number, composer text, milliseconds number, bytes number, unit_price number ) CREATE TABLE media_types ( id number, name text ) CREATE TABLE invoice_lines ( id number, invoic...
Find number of tracks in each genre?
SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name
spider
CREATE TABLE table_38193 ( "Rank" real, "Name" text, "Height m (ft)" text, "Floors" real, "Year" real )
What is the height for rank greater than 10 in Tameer Tower?
SELECT "Height m (ft)" FROM table_38193 WHERE "Rank" > '10' AND "Name" = 'tameer tower'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, ...
what is the yearly average amount of indwelling catheter in patient 021-79544 since 04/16/2104?
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-79544')) AND intakeoutput.celllabel = 'indwe...
eicu
CREATE TABLE table_name_98 ( rank VARCHAR, total_gdp__€_bn__ VARCHAR )
Which rank has a Total GDP ( bn) of 11.243??
SELECT rank FROM table_name_98 WHERE total_gdp__€_bn__ = "€11.243"
sql_create_context
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 job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by time, I want to list from low to high by the Y-axis.
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(MANAGER_ID)
nvbench
CREATE TABLE table_31094 ( "Name" text, "Occupation" text, "Gender" text, "Prison connection" text, "Played by" text, "Status" text )
Who played the mathematics student?
SELECT "Played by" FROM table_31094 WHERE "Occupation" = 'Mathematics Student'
wikisql
CREATE TABLE table_21026 ( "Rnd" real, "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Winning team" text, "Report" text )
PLEASE LIST ALL RACES WHERE THE RND IS 13.
SELECT "Race Name" FROM table_21026 WHERE "Rnd" = '13'
wikisql
CREATE TABLE table_11961582_10 ( high_points VARCHAR, high_assists VARCHAR )
How had the high points when the high assists were from J. Johnson (7)?
SELECT high_points FROM table_11961582_10 WHERE high_assists = "J. Johnson (7)"
sql_create_context
CREATE TABLE mzjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, ...
患者10580420所做的检验报告中有哪些报告对应的检验结果指标均正常?列出检验报告单号即可
SELECT zyjybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN zyjybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '10580420' AND NOT zyjybgb.BGDH IN (SELECT jyjgzbb.BGDH FROM ...
css
CREATE TABLE table_1816 ( "Club" text, "First season in top division" text, "Number of seasons in top division" real, "First season of current spell in top division" text, "Number of seasons in Liga MX" real, "Top division titles" real )
What was the club that won 10 top division titles?
SELECT "Club" FROM table_1816 WHERE "Top division titles" = '10'
wikisql
CREATE TABLE table_name_94 ( nationality VARCHAR, player VARCHAR )
What is the nationality of Shaun Sabol?
SELECT nationality FROM table_name_94 WHERE player = "shaun sabol"
sql_create_context
CREATE TABLE table_name_77 ( attendance INTEGER, week VARCHAR )
In Week 7, what is the highest attendance number?
SELECT MAX(attendance) FROM table_name_77 WHERE week = 7
sql_create_context
CREATE TABLE table_65015 ( "Rank" real, "Lane" real, "Athlete" text, "Country" text, "Time" text )
What is the highest lane for Brazil, ranked less than 8?
SELECT MAX("Lane") FROM table_65015 WHERE "Country" = 'brazil' AND "Rank" < '8'
wikisql
CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE restriction ...
does DL aircraft fly DC10
SELECT DISTINCT aircraft.aircraft_code FROM aircraft, equipment_sequence, flight WHERE aircraft.basic_type = 'DC10' AND equipment_sequence.aircraft_code = aircraft.aircraft_code AND flight.aircraft_code_sequence = equipment_sequence.aircraft_code_sequence AND flight.airline_code = 'DL'
atis
CREATE TABLE table_68676 ( "Year" real, "Total Region" real, "Mackay" real, "Pioneer" real, "Mirani" real, "Sarina" real )
What is the lowest Pioneer population with a Sarina population less than 7,537 and a Mirani population less than 5,379 in 1966?
SELECT MIN("Pioneer") FROM table_68676 WHERE "Sarina" < '7,537' AND "Year" = '1966' AND "Mirani" < '5,379'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
how did patient 76886 last be admitted to the hospital until 4 years ago?
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 76886 AND DATETIME(admissions.admittime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE table_name_80 ( percentage VARCHAR, first_game VARCHAR )
What Percentage did the First game of 1998 have?
SELECT percentage FROM table_name_80 WHERE first_game = 1998
sql_create_context
CREATE TABLE table_24399 ( "District" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date successor seated" text )
When james brooks (d) is the vacator what is the date the successor was seated?
SELECT "Date successor seated" FROM table_24399 WHERE "Vacator" = 'James Brooks (D)'
wikisql
CREATE TABLE table_49128 ( "Team" text, "City" text, "State/Province" text, "League" text, "Est." text )
What team is located in brooklyn?
SELECT "Team" FROM table_49128 WHERE "City" = 'brooklyn'
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...
姓苗名伟懋的患者治病记录上记的医疗费总额有多少次不少于6998.54元的,入院的时候做的诊断其疾病序列码和名称是啥?
SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '苗伟懋' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 6998.54)
css
CREATE TABLE table_64594 ( "Version" text, "Standard name" text, "Common name" text, "Downstream rate" text, "Upstream rate" text )
What's the version that has a 20.0 mbit/s downstream rate?
SELECT "Version" FROM table_64594 WHERE "Downstream rate" = '20.0 mbit/s'
wikisql
CREATE TABLE fzzmzjzjlb ( 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, MZZYZD...
从06年1月27日至2008年10月10日内病患11575009的所有检验结果指标记录中的仪器编号都是啥?名称都叫什么?
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ...
css
CREATE TABLE debate ( Venue VARCHAR )
Show the distinct venues of debates
SELECT DISTINCT Venue FROM debate
sql_create_context
CREATE TABLE table_name_34 ( runners INTEGER, dist__f_ VARCHAR )
Name the least runners with dist of 10.5
SELECT MIN(runners) FROM table_name_34 WHERE dist__f_ = 10.5
sql_create_context
CREATE TABLE table_203_24 ( id number, "date" text, "home team" text, "score" text, "away team" text, "notes" text )
what is the total number of points earned by all away team members in december ?
SELECT SUM("score") FROM table_203_24 WHERE "date" = 12
squall
CREATE TABLE table_204_936 ( id number, "week" number, "opponent" text, "result" text, "game site" text, "tv" text, "time" text, "attendance" number, "bye" text )
what team was lost to after the miami dolphins in week 6 ?
SELECT "opponent" FROM table_204_936 WHERE "result" = 'l' AND "week" > 6 ORDER BY "week" LIMIT 1
squall
CREATE TABLE table_name_34 ( team_2 VARCHAR )
What was the score in the 1st leg when Stade d'Abidjan was Team 2?
SELECT 1 AS st_leg FROM table_name_34 WHERE team_2 = "stade d'abidjan"
sql_create_context
CREATE TABLE table_25355392_2 ( june_10_11 VARCHAR, august_21_22 VARCHAR )
What is the june 10-11 when august 21-22 is august 21, 2017?
SELECT june_10_11 FROM table_25355392_2 WHERE august_21_22 = "August 21, 2017"
sql_create_context
CREATE TABLE document_types ( document_type_code text, document_description text ) CREATE TABLE grants ( grant_id number, organisation_id number, grant_amount number, grant_start_date time, grant_end_date time, other_details text ) CREATE TABLE project_outcomes ( project_id number,...
What are the send dates for all documents that have a grant amount of more than 5000 and are involved in research?
SELECT T1.sent_date FROM documents AS T1 JOIN grants AS T2 ON T1.grant_id = T2.grant_id JOIN organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN organisation_types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research'
spider
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE days ( days_code varchar, ...
i need to go to SAN DIEGO from TORONTO but i want to stopover in DENVER
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DIEGO' AND CITY_2....
atis
CREATE TABLE table_1463383_1 ( date_released VARCHAR, green_communist VARCHAR )
When was there 8.9% Green-Communist?
SELECT date_released FROM table_1463383_1 WHERE green_communist = "8.9%"
sql_create_context
CREATE TABLE table_11544 ( "Rank" text, "Name" text, "Location" text, "Height m / ft" text, "Floors" real )
What is the highest amount of floors in Stockholm with a rank of 15?
SELECT MAX("Floors") FROM table_11544 WHERE "Location" = 'stockholm' AND "Rank" = '15'
wikisql
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Badges ( Id number, UserId number, Name text, ...
Questions By High Rep Users.
SELECT ParentId AS "link_to_question" FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Users.Reputation > 1000
sede
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
How many patients are with white Russian ethnicity and admission year before 2154?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.admityear < "2154"
mimicsql_data
CREATE TABLE table_68649 ( "Club" text, "City or town" text, "Position in 2012\u201313 season" text, "First season in top division" text, "Number of seasons in top division" real, "First season of current spell in top division" text, "Top division titles" text, "Last top division title" ...
Which City or town has top division smaller than 40 and Gaziantepspor Club ?
SELECT "City or town" FROM table_68649 WHERE "Number of seasons in top division" < '40' AND "Club" = 'gaziantepspor'
wikisql
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate re...
Draw a scatter chart about the correlation between Height and Weight , and group by attribute Sex.
SELECT Height, Weight FROM people GROUP BY Sex
nvbench
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
indicate the daily maximum amount of sao2 for patient 022-199074 on their current hospital encounter.
SELECT MAX(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-199074' AND patient.hospitaldischargetime IS NULL)) A...
eicu
CREATE TABLE students ( student_id number, date_of_registration time, date_of_latest_logon time, login_name text, password text, personal_name text, middle_name text, family_name text ) CREATE TABLE courses ( course_id number, author_id number, subject_id number, course_...
What are the names and descriptions of the all courses under the 'Computer Science' subject?
SELECT T1.course_name, T1.course_description FROM courses AS T1 JOIN subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = "Computer Science"
spider
CREATE TABLE checking ( balance INTEGER, custid VARCHAR ) CREATE TABLE savings ( balance INTEGER, custid VARCHAR ) CREATE TABLE accounts ( name VARCHAR, custid VARCHAR )
Find the name and total checking and savings balance of the accounts whose savings balance is lower than corresponding checking balance.
SELECT T1.name, T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance
sql_create_context
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_icd_diagnoses ( 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 t...
what was the last anion gap value when they visited the hospital first time for patient 69819?
SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 69819 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion...
mimic_iii
CREATE TABLE table_13998897_1 ( frequency_mhz VARCHAR, city_of_license VARCHAR )
what's the frequency mhz with city of license being chattanooga, tennessee
SELECT frequency_mhz FROM table_13998897_1 WHERE city_of_license = "Chattanooga, Tennessee"
sql_create_context
CREATE TABLE table_203_160 ( id number, "rank" number, "heat" number, "nation" text, "competitors" text, "time" text, "notes" text )
which country took the least amount of time ?
SELECT "nation" FROM table_203_160 ORDER BY "time" LIMIT 1
squall
CREATE TABLE table_75797 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What is Package/Option, when Content is Tennis?
SELECT "Package/Option" FROM table_75797 WHERE "Content" = 'tennis'
wikisql
CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int,...
flights from WASHINGTON to SEATTLE
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEA...
atis
CREATE TABLE table_name_23 ( date_and_time___utc__ VARCHAR, site VARCHAR, rocket VARCHAR, orbit VARCHAR, function VARCHAR )
What date and time has a sub-orbital of orbit, a function of aeronomy research, and a Nike Orion rocket, as well as a Poker Flat site?
SELECT date_and_time___utc__ FROM table_name_23 WHERE orbit = "sub-orbital" AND function = "aeronomy research" AND rocket = "nike orion" AND site = "poker flat"
sql_create_context
CREATE TABLE table_name_20 ( english_title__chinese_title_ VARCHAR, number_of_episodes VARCHAR, airing_date VARCHAR )
Which title had 20 episodes and aired on 11 jun- 6 jul?
SELECT english_title__chinese_title_ FROM table_name_20 WHERE number_of_episodes = 20 AND airing_date = "11 jun- 6 jul"
sql_create_context
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) 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 ) ...
Give me the comparison about meter_100 over the name by a bar chart.
SELECT name, meter_100 FROM swimmer
nvbench
CREATE TABLE table_14242137_4 ( oberliga_bayern VARCHAR, oberliga_baden_württemberg VARCHAR, season VARCHAR )
Name the oberliga bayern for sv sandhausen for 1986-87
SELECT oberliga_bayern FROM table_14242137_4 WHERE oberliga_baden_württemberg = "SV Sandhausen" AND season = "1986-87"
sql_create_context
CREATE TABLE aircraft ( Aircraft_ID int(11), Aircraft varchar(50), Description varchar(50), Max_Gross_Weight varchar(50), Total_disk_area varchar(50), Max_disk_Loading varchar(50) ) CREATE TABLE airport_aircraft ( ID int, Airport_ID int, Aircraft_ID int ) CREATE TABLE airport ( ...
List the names of aircrafts and the number of times it won matches Plot them as bar chart, and list x axis in asc order please.
SELECT Aircraft, COUNT(*) FROM aircraft AS T1 JOIN match AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY Aircraft
nvbench
CREATE TABLE table_name_42 ( position VARCHAR, first_election VARCHAR, name VARCHAR )
What Position does First Elected in 2003 William D. Euille hold ?
SELECT position FROM table_name_42 WHERE first_election = "2003" AND name = "william d. euille"
sql_create_context
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
ENSCEN 171 can be taken at the moment ?
SELECT COUNT(*) > 0 FROM course, course_offering, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ENSCEN' AND course.number = 171 AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'WN' AND semester.semester_id = course_off...
advising
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
what is average age of patients whose ethnicity is hispanic/latino - puerto rican and days of hospital stay is 15?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND demographic.days_stay = "15"
mimicsql_data
CREATE TABLE table_45818 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What player has t5 as the place?
SELECT "Player" FROM table_45818 WHERE "Place" = 't5'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, ...
what's the name of the treatment that patient 010-19726's got two or more times until 64 months ago?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ...
eicu
CREATE TABLE table_train_134 ( "id" int, "mini_mental_state_examination_mmse" int, "geriatric_depression_scale_gds" int, "alzheimer_disease_ad" bool, "rosen_modified_hachinski_ischemic_score" int, "clinical_dementia_rating_cdr" float, "NOUSE" float )
score <= 5 on the geriatric depression scale ( gds )
SELECT * FROM table_train_134 WHERE geriatric_depression_scale_gds <= 5
criteria2sql
CREATE TABLE table_2175685_1 ( miles__km_ VARCHAR, average_speed__mph_ VARCHAR )
How many miles (km) were driven when the average speed (mph) was 103.145?
SELECT miles__km_ FROM table_2175685_1 WHERE average_speed__mph_ = "103.145"
sql_create_context
CREATE TABLE table_26083 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
What team did the Maple Leafs score 9 points against?
SELECT "Opponent" FROM table_26083 WHERE "Points" = '9'
wikisql
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolea...
How many downvotes do I have for each tag?.
SELECT TagName, COUNT(*) AS DownVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 3 WHERE Posts.OwnerUserId = '##UserId##' GROUP BY TagName ORDER BY DownVotes DESC
sede
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )...
flight from MILWAUKEE to CHICAGO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MILWAUKEE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CHIC...
atis
CREATE TABLE table_45148 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What is the average number of rounds that Lance Gibson fought when his record was 1-1?
SELECT AVG("Round") FROM table_45148 WHERE "Record" = '1-1'
wikisql
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal...
Sandboxed posts that have a score < 1 and no activity for two years.
SELECT Id AS "post_link" FROM Posts WHERE ParentId = 2140 AND LastActivityDate < DATEADD(YEAR, -2, GETDATE()) AND Score < 1
sede
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...
how many patients with drug type base were diagnosed with diaphragmatic hernia?
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 = "Diaphragmatic hernia" AND prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE table_50481 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
What is the venue of the team race that was before 2010?
SELECT "Venue" FROM table_50481 WHERE "Notes" = 'team' AND "Year" < '2010'
wikisql
CREATE TABLE table_42791 ( "Name" text, "Innings" real, "Runs Scored" real, "Balls Faced" real, "Average" real, "S.R." real )
Which average S.R. has an Average of 39.13 and Balls Faced larger than 318?
SELECT AVG("S.R.") FROM table_42791 WHERE "Average" = '39.13' AND "Balls Faced" > '318'
wikisql
CREATE TABLE table_54144 ( "Race" text, "Dist (f)" real, "Course" text, "Class" text, "Prize (\u00a3K)" real, "Odds" text, "Runners" real, "Placing" real, "Margin" text, "Time" text, "Jockey" text, "Trainer" text )
What is the lowest number of Runners that has a Placing that isn't 1?
SELECT MIN("Runners") FROM table_54144 WHERE "Placing" < '1'
wikisql
CREATE TABLE election ( Delegate VARCHAR, Party VARCHAR ) CREATE TABLE party ( Party VARCHAR, Party_ID VARCHAR )
Show the delegates and the names of the party they belong to.
SELECT T1.Delegate, T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID
sql_create_context
CREATE TABLE table_73553 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
What scores happened on February 11?
SELECT "Score" FROM table_73553 WHERE "Date" = 'February 11'
wikisql
CREATE TABLE table_25217 ( "Year" text, "Date" text, "Driver" text, "Team" text, "Manufacturer" text, "Laps" text, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text )
What team competed in 2003?
SELECT "Team" FROM table_25217 WHERE "Year" = '2003'
wikisql
CREATE TABLE table_25407 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Opponent in the final" text, "Score in the final" text )
Which surfaces have the final score of 6 1, 6 7 (2 7) , 7 6 (7 5) , 7 6 (10 8)?
SELECT "Surface" FROM table_25407 WHERE "Score in the final" = '6–1, 6–7 (2–7) , 7–6 (7–5) , 7–6 (10–8)'
wikisql
CREATE TABLE Ref_locations ( location_code VARCHAR, location_name VARCHAR )
List all location codes and location names.
SELECT location_code, location_name FROM Ref_locations
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, d...
what is the drug name that was prescribed to patient 016-18150 in the same day after they received a vascular catheter placement - arterial procedure during the previous month?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-18150') AND treatment.treatme...
eicu
CREATE TABLE table_61679 ( "Year" real, "Manufacturer" text, "Start" real, "Finish" real, "Team" text )
What is the lowest Year, when Finish is '29', and when Start is less than 24?
SELECT MIN("Year") FROM table_61679 WHERE "Finish" = '29' AND "Start" < '24'
wikisql
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, show me about the distribution of name and revenue , and group by attribute founder in a bar chart, and I want to display by the X in desc.
SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Name DESC
nvbench
CREATE TABLE table_44002 ( "Player" text, "Nationality" text, "Position" text, "Years for Grizzlies" text, "School/Club Team" text )
What position did the player who was with the grizzlies from 2007-2009 play?
SELECT "Position" FROM table_44002 WHERE "Years for Grizzlies" = '2007-2009'
wikisql
CREATE TABLE table_4677 ( "Team" text, "Constructor" text, "Motorcycle" text, "Rider" text, "Rounds" text )
Who is the Constructor for round 5?
SELECT "Constructor" FROM table_4677 WHERE "Rounds" = '5'
wikisql
CREATE TABLE table_name_5 ( high_points VARCHAR, game VARCHAR )
What is High Points, when Game is '5'?
SELECT high_points FROM table_name_5 WHERE game = 5
sql_create_context
CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_Percentage real ) CREATE TABLE game ( ...
The trend about the the number of season of different Home_team over the season, and I want to show in ascending by the x-axis.
SELECT Season, COUNT(Season) FROM game GROUP BY Home_team ORDER BY Season
nvbench
CREATE TABLE table_10450 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
Who was the leading scorer in the match when the Golden State Warriors were visiting the Dallas Mavericks?
SELECT "Leading scorer" FROM table_10450 WHERE "Visitor" = 'golden state warriors' AND "Home" = 'dallas mavericks'
wikisql
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, Crea...
Language rating in StackOverflow tags since 2014-01-01.
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS RecentRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsRecent, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostI...
sede
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, draw a bar chart about the distribution of name and revenue , and group by attribute headquarter, and could you show bar in asc order?
SELECT T1.Name, T2.Revenue 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
how many patients whose admission location is trsf within this facility and drug code is bume05?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.formulary_drug_cd = "BUME05"
mimicsql_data
CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19,4), derived_product_cost DECIMAL(19,4), derived_vat_payable DECIMAL(19,4), derived_total_cost DECIMAL...
I want to see trend of how many date account opened by date account opened
SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts
nvbench