context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate ti...
Rough Average Number of Characters in an Answer.
SELECT AVG(LENGTH(ph.Text)) FROM Posts AS p LEFT JOIN PostHistory AS ph ON p.Id = ph.PostId WHERE p.PostTypeId = 1 AND ph.PostHistoryTypeId IN (2, 5)
sede
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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime tim...
the arterial bp [diastolic] of patient 15447 second measured on the current intensive care unit visit is less than the value first measured on the current 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 = 15447) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_i...
mimic_iii
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, visualize a bar chart about the distribution of name and the sum of code , and group by attribute name, and I want to order Name from low to high order.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name
nvbench
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 lab ( subject_id text, hadm_id text, ...
how many patients whose admission location is transfer from hosp/extram and lab test fluid is joint fluid?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND lab.fluid = "Joint Fluid"
mimicsql_data
CREATE TABLE table_name_76 ( date VARCHAR, week VARCHAR )
What was the date of the week 9 game?
SELECT date FROM table_name_76 WHERE week = 9
sql_create_context
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
what laboratory test was given to patient 70206 for the first time until 25 months ago?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70206) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-25 month') ORDER BY labevents.charttime LI...
mimic_iii
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, ...
how many days have elapsed since the first time that patient 3929 received a anion gap laboratory test on this hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3929 AND admissions...
mimic_iii
CREATE TABLE table_name_53 ( date VARCHAR, away_team VARCHAR )
When did Collingwood play an away game?
SELECT date FROM table_name_53 WHERE away_team = "collingwood"
sql_create_context
CREATE TABLE table_46530 ( "car model" text, "displacement & configuration" text, "max. motive power @ rpm" text, "max. torque @ rpm" text, "max. speed" text, "emissions CO2" text )
What is the emissions CO2 with a max speed of km/h (mph) of the car model Panamera 4s?
SELECT "emissions CO2" FROM table_46530 WHERE "max. speed" = 'km/h (mph)' AND "car model" = 'panamera 4s'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
病患凤香馨使用的药品均低于3461.35元一共有多少记载在次医疗记录上?编号当时都是多少?
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '凤香馨' AND NOT gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 3461.35) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '凤香馨' AND NOT fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FR...
css
CREATE TABLE table_name_40 ( date VARCHAR, team VARCHAR, circuit VARCHAR )
What is Date, when Team is Holden Racing Team, and when Circuit is Eastern Creek Raceway?
SELECT date FROM table_name_40 WHERE team = "holden racing team" AND circuit = "eastern creek raceway"
sql_create_context
CREATE TABLE Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_date DATETIME, order_status_code VARCHAR(15) ) CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(...
Show the number of customer address history for each city in a bar chart, and order Y-axis in desc order please.
SELECT T3.city, COUNT(T3.city) FROM Customer_Address_History AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T1.address_id = T3.address_id GROUP BY T3.city ORDER BY COUNT(T3.city) DESC
nvbench
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,...
how many stops are on all flights from BOSTON to SAN FRANCISCO that depart before 1200
SELECT DISTINCT flight.stops FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time < 1200 AND flight.to_airport = AIRPORT_SERVICE_1.air...
atis
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 (...
give me the number of patients whose primary disease is abdominal abscess and days of hospital stay is greater than 8?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL ABSCESS" AND demographic.days_stay > "8"
mimicsql_data
CREATE TABLE table_1346118_5 ( party VARCHAR, candidates VARCHAR )
Which party was the incumbent from when the cadidates were henry e. barbour (r) 52.1% henry hawson (d) 47.9%? Answer: Democratic
SELECT COUNT(party) FROM table_1346118_5 WHERE candidates = "Henry E. Barbour (R) 52.1% Henry Hawson (D) 47.9%"
sql_create_context
CREATE TABLE Projects ( project_details VARCHAR, project_id VARCHAR ) CREATE TABLE Tasks ( project_id VARCHAR )
How many tasks does each project have? List the task count and the project detail.
SELECT COUNT(*), T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id
sql_create_context
CREATE TABLE table_name_77 ( country VARCHAR, catalogue__number VARCHAR )
What Country is Catalogue # ASW 50248 (724385024825) from?
SELECT country FROM table_name_77 WHERE catalogue__number = "asw 50248 (724385024825)"
sql_create_context
CREATE TABLE table_2791668_1 ( original_air_date VARCHAR, us_viewers__millions_ VARCHAR )
how many premieres had the episode that had 12.68 millions of north american viewers?
SELECT COUNT(original_air_date) FROM table_2791668_1 WHERE us_viewers__millions_ = "12.68"
sql_create_context
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
When Prof. Michelle Kees teaches UKRAINE 451 , does it have a lab ?
SELECT COUNT(*) = 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course.department = 'UKRA...
advising
CREATE TABLE table_20313 ( "Series" text, "Episodes" real, "Series premiere" text, "Series finale" text, "Region 1" text, "Region 2" text, "Region 4" text )
When was series premiere on the pilot episode
SELECT "Series premiere" FROM table_20313 WHERE "Series" = 'Pilot'
wikisql
CREATE TABLE table_name_76 ( tv_time VARCHAR, week VARCHAR )
What was the tv time for the game on week 12?
SELECT tv_time FROM table_name_76 WHERE week = 12
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 job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about salary over the first_name by a bar chart, and could you show X-axis in descending order?
SELECT FIRST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY FIRST_NAME DESC
nvbench
CREATE TABLE table_36468 ( "School" text, "Team" text, "City" text, "State" text, "Conference" text )
What school is in hillsboro city?
SELECT "School" FROM table_36468 WHERE "City" = 'hillsboro'
wikisql
CREATE TABLE table_50157 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
What is the Score of the match on August 23, 2004?
SELECT "Score" FROM table_50157 WHERE "Date" = 'august 23, 2004'
wikisql
CREATE TABLE table_name_79 ( current_branch_opened INTEGER, neighborhood VARCHAR )
What is the highest Current Branch Opened, when Neighborhood is W. Portland Park?
SELECT MAX(current_branch_opened) FROM table_name_79 WHERE neighborhood = "w. portland park"
sql_create_context
CREATE TABLE table_31757 ( "Year" real, "Class" text, "Team" text, "Points" real, "Rank" text, "Wins" real )
Tell me the lowest wins for class of 50cc and team of tomos for year less than 1969
SELECT MIN("Wins") FROM table_31757 WHERE "Class" = '50cc' AND "Team" = 'tomos' AND "Year" < '1969'
wikisql
CREATE TABLE table_name_10 ( notes VARCHAR, rank VARCHAR )
Rank 6 has what notes?
SELECT notes FROM table_name_10 WHERE rank = 6
sql_create_context
CREATE TABLE table_53100 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Tell me the lowest Laps with a time/retired of +2 Laps and Grid of 20
SELECT MIN("Laps") FROM table_53100 WHERE "Time/Retired" = '+2 laps' AND "Grid" = '20'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
Among married patients, how many were born before the year 2052?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.dob_year < "2052"
mimicsql_data
CREATE TABLE table_name_37 ( satu_mare INTEGER, baia_mare INTEGER )
What is the smallest Satu Mare value associated with Baia Mare over 523?
SELECT MIN(satu_mare) FROM table_name_37 WHERE baia_mare > 523
sql_create_context
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,...
这个赵伟博的患者以往做了哪些检查还知道么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '赵伟博' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_name_12 ( goals_against INTEGER, draws VARCHAR, wins VARCHAR, points VARCHAR, goal_difference VARCHAR )
What is the highest goals against when points are larger than 31, the goal difference is smaller than 9, wins are 13, and draws are larger than 6?
SELECT MAX(goals_against) FROM table_name_12 WHERE points > 31 AND goal_difference < 9 AND wins = 13 AND draws > 6
sql_create_context
CREATE TABLE table_55382 ( "Sport" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
With 1 Gold, more than 2 Bronze and Total greater than 1, what is the Silver?
SELECT AVG("Silver") FROM table_55382 WHERE "Total" > '1' AND "Gold" = '1' AND "Bronze" > '2'
wikisql
CREATE TABLE table_36344 ( "Wind Farm" text, "Scheduled" text, "Capacity (MW)" real, "Turbines" real, "Type" text, "Location" text )
What is the average capacity for the farm at Gortahile having more than 8 turbines?
SELECT AVG("Capacity (MW)") FROM table_36344 WHERE "Wind Farm" = 'gortahile' AND "Turbines" > '8'
wikisql
CREATE TABLE table_1458412_1 ( avg_start VARCHAR, starts VARCHAR )
What is the avg start that starts at 30?
SELECT avg_start FROM table_1458412_1 WHERE starts = 30
sql_create_context
CREATE TABLE table_26920192_5 ( fastest_lap VARCHAR, winning_driver VARCHAR )
Who had the fastest lap when the winning driver is giorgio sanna?
SELECT fastest_lap FROM table_26920192_5 WHERE winning_driver = "Giorgio Sanna"
sql_create_context
CREATE TABLE table_name_21 ( away_team VARCHAR, home_team VARCHAR )
What is the score of the away team who played home team Hawthorn?
SELECT away_team AS score FROM table_name_21 WHERE home_team = "hawthorn"
sql_create_context
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
SELECT CreationDate FROM Posts WHERE Id BETWEEN 20 AND 30.
SELECT CreationDate FROM Posts WHERE Id BETWEEN 20 AND 30
sede
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREA...
how do i get downtown from the TORONTO airport
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'TORONTO' AND ground_service.airport_code = airport.airport_code
atis
CREATE TABLE table_name_46 ( catalogue VARCHAR, label VARCHAR )
Which catalogue has essential, castle music as it's label?
SELECT catalogue FROM table_name_46 WHERE label = "essential, castle music"
sql_create_context
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
Total DTD (Range) 'google-classroom' Tag + 'classroom' in Title.
SELECT Id AS "post_link", CreationDate, Tags FROM Posts WHERE Title LIKE '%classroom%' AND Posts.Tags COLLATE SQL_Latin1_General_CP1_CI_AS LIKE '%google-classroom%' AND CreationDate BETWEEN @StartDate AND @EndDate ORDER BY CreationDate
sede
CREATE TABLE table_6196 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real, "Finish" text )
Name the most total with to par more than 16
SELECT MAX("Total") FROM table_6196 WHERE "To par" > '16'
wikisql
CREATE TABLE table_name_71 ( assists INTEGER, player VARCHAR )
How many assists does David Tomlinson have?
SELECT SUM(assists) FROM table_name_71 WHERE player = "david tomlinson"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
how many patients were prescribed the drug sodium chloride 0.9 % iv soln bolus within 2 months after being diagnosed with esrd (end stage renal disease), since 1 year ago?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'esrd (end stage renal disease)' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-1 year')...
eicu
CREATE TABLE table_name_38 ( pata INTEGER, model VARCHAR )
How many PATAs does an nForce Professional 3400 MCP have?
SELECT SUM(pata) FROM table_name_38 WHERE model = "nforce professional 3400 mcp"
sql_create_context
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
在2012年8月24日到2020年5月4日内病人尤云霞被开出的所有检验报告单的检验报告单号都有哪些?
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.person_info_XM = '尤云霞' AND jybgb.BGRQ BETWEEN '2012-08-24' AND '2020-05-04' ...
css
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) ...
count the number of times patient 15209 had had a gastric tube output in 09/2105.
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15209)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'gastric tube' AND ...
mimic_iii
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, ...
did patient 1114 have any microbiology test results for his stool during this hospital encounter?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1114 AND admissions.dischtime IS NULL) AND microbiologyevents.spec_type_desc = 'stool'
mimic_iii
CREATE TABLE table_name_28 ( date VARCHAR, decision VARCHAR, visitor VARCHAR )
What is the date of the game where Dipietro earned a decision and Carolina was the visiting team?
SELECT date FROM table_name_28 WHERE decision = "dipietro" AND visitor = "carolina"
sql_create_context
CREATE TABLE table_name_17 ( score VARCHAR, away_team VARCHAR, date VARCHAR )
How much did the away team b3 score on August 12, 2014?
SELECT score FROM table_name_17 WHERE away_team = "b3" AND date = "august 12, 2014"
sql_create_context
CREATE TABLE farm_competition ( Competition_ID int, Year int, Theme text, Host_city_ID int, Hosts text ) CREATE TABLE competition_record ( Competition_ID int, Farm_ID int, Rank int ) CREATE TABLE farm ( Farm_ID int, Year int, Total_Horses real, Working_Horses real, ...
Use a group line chart to show how many competitions are held in each year, group by official name and bin by year, and order x axis in descending order.
SELECT Year, COUNT(Year) FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY Official_Name ORDER BY Year DESC
nvbench
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...
provide the number of patients whose age is less than 45 and admission year is less than 2131?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "45" AND demographic.admityear < "2131"
mimicsql_data
CREATE TABLE table_76275 ( "Game" real, "Date" text, "Team" text, "Score" text, "Record" text, "Streak" text )
What Game had a Score of 129 105?
SELECT MIN("Game") FROM table_76275 WHERE "Score" = '129–105'
wikisql
CREATE TABLE table_name_77 ( laps INTEGER, grid VARCHAR, driver VARCHAR )
How many laps did Nick Heidfeld drive on grids larger than 4?
SELECT SUM(laps) FROM table_name_77 WHERE grid > 4 AND driver = "nick heidfeld"
sql_create_context
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE STUDENT ...
Show me maximal stu gpa by dept code in a histogram, and display in desc by the bars.
SELECT DEPT_CODE, MAX(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE DESC
nvbench
CREATE TABLE table_40465 ( "Rank by average" text, "Place" text, "Perfect 40s" text, "Total" text, "Number of dances" text, "Season" text, "Average" text )
What is the total for 3rd place on season 9?
SELECT "Total" FROM table_40465 WHERE "Place" = '3rd' AND "Season" = '9'
wikisql
CREATE TABLE circuits ( circuitId INTEGER, circuitRef TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT ) CREATE TABLE status ( statusId INTEGER, status TEXT ) CREATE TABLE constructors ( constructorId INTEGER, constructorRef TEXT,...
Plot a scatter chart, count(*) by constructorid.
SELECT COUNT(*), constructorId FROM constructorStandings GROUP BY constructorId
nvbench
CREATE TABLE Students_in_Detention ( student_id INTEGER, detention_id INTEGER, incident_id INTEGER ) CREATE TABLE Assessment_Notes ( notes_id INTEGER, student_id INTEGER, teacher_id INTEGER, date_of_notes DATETIME, text_of_notes VARCHAR(255), other_details VARCHAR(255) ) CREATE TAB...
What are the number of the dates of the assessment notes?, sort by the x-axis from high to low please.
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY date_of_notes DESC
nvbench
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREA...
what is the ground transportation in SAN DIEGO
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'SAN DIEGO' AND ground_service.city_code = city.city_code
atis
CREATE TABLE table_5790 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponents in the final" text, "Score" text )
WHich Tournament has a Partnering of diego p rez and a Opponents in the final of christer allgardh carl limberger?
SELECT "Tournament" FROM table_5790 WHERE "Partnering" = 'diego pérez' AND "Opponents in the final" = 'christer allgardh carl limberger'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
give me the number of patients whose primary disease is rash and the procedure icd9 code is 5091.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "RASH" AND procedures.icd9_code = "5091"
mimicsql_data
CREATE TABLE table_28352386_1 ( emma_bunton VARCHAR, total VARCHAR )
What was Emma Bunton's score for the performance with a total score of 22?
SELECT emma_bunton FROM table_28352386_1 WHERE total = "22"
sql_create_context
CREATE TABLE table_45017 ( "Player" text, "Position" text, "Premier League" real, "FA Cup" real, "League Cup" real, "UEFA Cup" real, "Total" real )
What is the total number of appearances in the premier league when there were 10 appearances at UEFA and less than 4 at league cup?
SELECT COUNT("Premier League") FROM table_45017 WHERE "UEFA Cup" = '10' AND "League Cup" < '4'
wikisql
CREATE TABLE table_name_23 ( transfer_window VARCHAR, name VARCHAR )
What is the transfer window for Christian Nerlinger?
SELECT transfer_window FROM table_name_23 WHERE name = "christian nerlinger"
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...
tell me the route of administration of drug with drug code mago140.
SELECT prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "MAGO140"
mimicsql_data
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NA...
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a scatter chart about the correlation between employee_id and department_id .
SELECT EMPLOYEE_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
nvbench
CREATE TABLE table_24719 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text )
How many different final scores were there in 1963?
SELECT COUNT("Score in the final") FROM table_24719 WHERE "Year" = '1963'
wikisql
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime t...
how much magnesium sulfate was prescribed for the first time on their last hospital visit to patient 44451?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 44451 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'magnesium sulfate' ORDER BY prescriptions.startdate...
mimic_iii
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, ...
flights between BALTIMORE and WASHINGTON
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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASH...
atis
CREATE TABLE table_62606 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
What is Place, when Score is '70-70-68-70=278'?
SELECT "Place" FROM table_62606 WHERE "Score" = '70-70-68-70=278'
wikisql
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
看看复方氯己定含漱液的开出记录,报一下2009.3.14到2016.8.18期间的总用量和总金额
SELECT SUM(QTY), SUM(AMOUNT) FROM t_kc22 WHERE SOC_SRT_DIRE_NM = '复方氯己定含漱液' AND STA_DATE BETWEEN '2009-03-14' AND '2016-08-18'
css
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...
Visualize a pie chart about the proportion of All_Road and School_ID.
SELECT All_Road, School_ID FROM basketball_match
nvbench
CREATE TABLE gwyjzb ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
显示出患者曹志新在编号为0686560这个医院的就诊记录里,在2005年12月25到2012年4月14的这段时间里开了哪些药?药品对应的编码是什么
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '曹志新' AND gwyjzb.MED_SER_ORG_NO = '0686560' AND gwyjzb.IN_HOSP_DATE BETWEEN '2005-12-25' AND '2012-04-14' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHER...
css
CREATE TABLE table_60106 ( "Player" text, "Tries" real, "Goals" text, "Field Goals" real, "Points" real )
How many tries did the player have which ended with 20 Points?
SELECT "Tries" FROM table_60106 WHERE "Points" = '20'
wikisql
CREATE TABLE table_name_10 ( intergiro_classification VARCHAR, trofeo_fast_team VARCHAR, stage VARCHAR )
In stage 13, what is the intergiro classification and is on the team of Asics-c.g.a.?
SELECT intergiro_classification FROM table_name_10 WHERE trofeo_fast_team = "asics-c.g.a." AND stage = "13"
sql_create_context
CREATE TABLE table_name_86 ( entered INTEGER, wrestler VARCHAR )
Shawn Michaels entered the elimination chamber in what position?
SELECT SUM(entered) FROM table_name_86 WHERE wrestler = "shawn michaels"
sql_create_context
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what is the four most frequently ordered lab tests since 1 year ago in patients of age 40s?
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY lab.labname) AS t1 WHER...
eicu
CREATE TABLE table_204_266 ( id number, "#" number, "event year" number, "season" text, "flag bearer" text )
who was the last flag bearer ?
SELECT "flag bearer" FROM table_204_266 ORDER BY "#" DESC LIMIT 1
squall
CREATE TABLE table_name_47 ( chassis VARCHAR, engine VARCHAR, sponsor VARCHAR )
What is the Chassis of the Honda Engine with a Motorola sponsor?
SELECT chassis FROM table_name_47 WHERE engine = "honda" AND sponsor = "motorola"
sql_create_context
CREATE TABLE table_name_88 ( penalties VARCHAR, pim VARCHAR )
What penalties has P.I.M. of 34.5?
SELECT penalties FROM table_name_88 WHERE pim = "34.5"
sql_create_context
CREATE TABLE table_name_65 ( country VARCHAR, score VARCHAR )
What is the country with a 70-74-69=213 score?
SELECT country FROM table_name_65 WHERE score = 70 - 74 - 69 = 213
sql_create_context
CREATE TABLE table_44758 ( "Name" text, "WSU Year(s)" text, "Position" text, "Team" text, "Pro Year(s)" text )
What is Name, when Team is New York Knicks, and when WSU Year(s) is 1965-68?
SELECT "Name" FROM table_44758 WHERE "Team" = 'new york knicks' AND "WSU Year(s)" = '1965-68'
wikisql
CREATE TABLE table_name_20 ( score VARCHAR, date VARCHAR )
What was the score for the match on November 13, 2005?
SELECT score FROM table_name_20 WHERE date = "november 13, 2005"
sql_create_context
CREATE TABLE table_name_87 ( obesity_rank VARCHAR, overweight__incl_obese__adults VARCHAR, state_and_district_of_columbia VARCHAR )
What's the rank in West Virginia when the overweight adult was 66.8%?
SELECT obesity_rank FROM table_name_87 WHERE overweight__incl_obese__adults = "66.8%" AND state_and_district_of_columbia = "west virginia"
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 job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE...
For those employees who did not have any job in the past, give me the comparison about the average of department_id over the job_id , and group by attribute job_id by a bar chart, and I want to display y axis from high to low order please.
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID) DESC
nvbench
CREATE TABLE table_name_17 ( total VARCHAR, affiliation VARCHAR, life_peers VARCHAR, hereditary_peers VARCHAR, lords_spiritual VARCHAR )
Which Total has a Hereditary peer of , and a Lords spiritual of , and a Life peers of 2, and an Affiliation of plaid cymru?
SELECT COUNT(total) FROM table_name_17 WHERE hereditary_peers = "–" AND lords_spiritual = "–" AND life_peers = "2" AND affiliation = "plaid cymru"
sql_create_context
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
all suggested edits for a user. http://meta.stackoverflow.com/questions/276461/see-edits-made-to-my-answers
SELECT p.Id AS "post_link", s.OwnerUserId AS "user_link", s.Id AS "suggested_edit_link", s.Comment, s.CreationDate, s.ApprovalDate, s.RejectionDate, vt.Name, v.UserId AS "user_link" FROM Posts AS p INNER JOIN SuggestedEdits AS s ON s.PostId = p.Id INNER JOIN SuggestedEditVotes AS v ON v.SuggestedEditId = s.Id INNER JOI...
sede
CREATE TABLE table_49293 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text )
Which Place has a Score larger than 68, and a Player of david ogrin?
SELECT "Place" FROM table_49293 WHERE "Score" > '68' AND "Player" = 'david ogrin'
wikisql
CREATE TABLE salary ( year number, team_id text, league_id text, player_id text, salary number ) CREATE TABLE manager_award ( player_id text, award_id text, year number, league_id text, tie text, notes number ) CREATE TABLE pitching_postseason ( player_id text, year...
Find the year in which the least people enter hall of fame.
SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*) LIMIT 1
spider
CREATE TABLE table_51479 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Which constructor had laps amounting to more than 21 where the driver was John Surtees?
SELECT "Constructor" FROM table_51479 WHERE "Laps" > '21' AND "Driver" = 'john surtees'
wikisql
CREATE TABLE table_name_54 ( epicenter VARCHAR, date VARCHAR )
Where was the epicenter of the quake on December 1, 2012?
SELECT epicenter FROM table_name_54 WHERE date = "december 1, 2012"
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 demographic ...
what is procedure short title and drug code of subject id 24425?
SELECT procedures.short_title, prescriptions.formulary_drug_cd FROM procedures INNER JOIN prescriptions ON procedures.hadm_id = prescriptions.hadm_id WHERE procedures.subject_id = "24425"
mimicsql_data
CREATE TABLE table_18475946_2 ( lyric_fm__mhz_ VARCHAR, rnag__mhz_ VARCHAR )
What is the lyric fm for rnag 93.2?
SELECT lyric_fm__mhz_ FROM table_18475946_2 WHERE rnag__mhz_ = "93.2"
sql_create_context
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
What number of the prerequisites for MACROMOL 512 have I met ?
SELECT COUNT(DISTINCT COURSE_1.department, COURSE_0.number) FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, student_record WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'MACROMOL' AND COURSE_1.number = 512 ...
advising
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, find name and the average of revenue , and group by attribute name, and visualize them by a bar chart, could you list by the x axis in ascending please?
SELECT T2.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name
nvbench
CREATE TABLE table_24579 ( "Round #" real, "Pick #" real, "Player" text, "Position" text, "Nationality" text, "College/junior/club team" text )
Which nationality is kitchener rangers (ohl) college/junior/club team?
SELECT "Nationality" FROM table_24579 WHERE "College/junior/club team" = 'Kitchener Rangers (OHL)'
wikisql
CREATE TABLE table_17800 ( "Club" text, "Played" text, "Won" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
How many draws were there when there were 30 tries against?
SELECT "Drawn" FROM table_17800 WHERE "Tries against" = '30'
wikisql
CREATE TABLE table_23481 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
state the number of location attendance where record is 15 10 (5 7)
SELECT COUNT("Location Attendance") FROM table_23481 WHERE "Record" = '15–10 (5–7)'
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, ...
provide the number of patients whose diagnoses short title is other alter consciousnes and lab test fluid is ascites?
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.short_title = "Other alter consciousnes" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_name_31 ( notes VARCHAR, title VARCHAR )
What notes did the creature comforts film have?
SELECT notes FROM table_name_31 WHERE title = "creature comforts"
sql_create_context