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...
did patient 012-68650 get tested in the prealbumin lab last year?
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-68650')) AND lab.labname = 'prealbumin' AND DATETIME(lab.labresulttime, 'start of ye...
eicu
CREATE TABLE table_name_11 ( winner VARCHAR, tournament VARCHAR )
Who was the winner at the tournament in Hamburg?
SELECT winner FROM table_name_11 WHERE tournament = "hamburg"
sql_create_context
CREATE TABLE table_name_63 ( week_2 VARCHAR, week_4 VARCHAR )
What Week 2 has a Week 4 of piret aava?
SELECT week_2 FROM table_name_63 WHERE week_4 = "piret aava"
sql_create_context
CREATE TABLE table_66743 ( "Supplier" text, "Basic shape" text, "Keys (x modes)" text, "Wrist pad" text, "Thumb stick" text, "Backlit" text )
Which Thumb stick has a Basic shape of curved, a Backlit of yes, and a Supplier of genius?
SELECT "Thumb stick" FROM table_66743 WHERE "Basic shape" = 'curved' AND "Backlit" = 'yes' AND "Supplier" = 'genius'
wikisql
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Average score for questions and answers, by tag. For all canonical tags, what is the average question score and the average answer score?
SELECT 'site://questions/tagged/' + CAST(Tags.TagName AS TEXT) + '|' + CAST(Tags.TagName AS TEXT) AS "tag", AVG(Answers.Score) AS "average_score", STDEV(Answers.Score) AS "score_stddev", COUNT(Answers.Id) AS "#_answers" FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts AS Questions ON Questions...
sede
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
Count the number of patients that survived and have had a drug named nifed.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "0" AND prescriptions.drug = "nifed"
mimicsql_data
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 are the top five most common procedures that followed the patients who were given agent specific therapy in the same hospital encounter?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'agent...
eicu
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
For all employees who have the letters D or S in their first name, find job_id and the average of employee_id , and group by attribute job_id, and visualize them by a bar chart, sort total number from high to low order.
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE table_70447 ( "Team" text, "Manager 1" text, "Captain" text, "Kit manufacturer" text, "Shirt sponsor" text )
Who is the manager 1 for Leeds United?
SELECT "Manager 1" FROM table_70447 WHERE "Team" = 'leeds united'
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...
provide me the number of inpatient hospital admission patients who had unilateral radical neck dissection.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.long_title = "Radical neck dissection, unilateral"
mimicsql_data
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
What are the total comment scores of users on closed questions?.
WITH UpvotedComments AS (SELECT PostId, Score, UserId, Commenter = (SELECT DisplayName FROM Users WHERE Id = UserId) FROM Comments WHERE Score > 0), ClosedPosts AS (SELECT Id, ClosedDate FROM Posts WHERE NOT ClosedDate IS NULL), UpvotedCommentsOnClosedPosts AS (SELECT Score, Commenter, UserId, ClosedPosts.ClosedDate FR...
sede
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_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY...
Show me department_id by first name in a histogram, order by the bar from high to low.
SELECT FIRST_NAME, DEPARTMENT_ID FROM employees ORDER BY FIRST_NAME DESC
nvbench
CREATE TABLE table_204_336 ( id number, "operators" text, "named trains" text, "destination" text, "year begun" text, "year discontinued" number )
what is the difference -lrb- in years -rrb- between when the royal blue began and the year the crusader began ?
SELECT ABS((SELECT "year begun" FROM table_204_336 WHERE "named trains" = 'royal blue') - (SELECT "year begun" FROM table_204_336 WHERE "named trains" = 'crusader'))
squall
CREATE TABLE table_75139 ( "Nation" text, "Skip" text, "Third" text, "Second" text, "Lead" text )
When did France come in second?
SELECT "Second" FROM table_75139 WHERE "Nation" = 'france'
wikisql
CREATE TABLE table_name_62 ( high_rebounds VARCHAR, team VARCHAR )
Who had the high rebounds, and how many, when they played Denver?
SELECT high_rebounds FROM table_name_62 WHERE team = "denver"
sql_create_context
CREATE TABLE table_31937 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Name the gold with total larger than 33
SELECT "Gold" FROM table_31937 WHERE "Total" > '33'
wikisql
CREATE TABLE table_name_94 ( series INTEGER, premiere VARCHAR, episodes VARCHAR )
Which season premiered on 29 October 1990 and had more than 6 episodes?
SELECT MAX(series) FROM table_name_94 WHERE premiere = "29 october 1990" AND episodes > 6
sql_create_context
CREATE TABLE table_name_93 ( series VARCHAR, director VARCHAR )
What is the Series of the Filmography by Directory Friz Freleng?
SELECT series FROM table_name_93 WHERE director = "friz freleng"
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...
count the number of patients who have been admitted to the hospital during a year before.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
eicu
CREATE TABLE table_name_71 ( region VARCHAR, catalog VARCHAR )
What is the Region of the 1766390 Catalog?
SELECT region FROM table_name_71 WHERE catalog = "1766390"
sql_create_context
CREATE TABLE table_name_58 ( lane INTEGER, nationality VARCHAR )
How many lanes have a Nationality of iceland?
SELECT SUM(lane) FROM table_name_58 WHERE nationality = "iceland"
sql_create_context
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...
information on afternoon flights from PHILADELPHIA to DENVER
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 = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '...
atis
CREATE TABLE table_204_882 ( id number, "number" number, "builder" text, "entered service" text, "withdrawn" text, "notes" text )
what was the most reason given in the notes column ?
SELECT "notes" FROM table_204_882 GROUP BY "notes" ORDER BY COUNT(*) DESC LIMIT 1
squall
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
count the number of patients whose admission year is less than 2180 and procedure short title is open reduc-int fix femur?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2180" AND procedures.short_title = "Open reduc-int fix femur"
mimicsql_data
CREATE TABLE table_name_23 ( seats_2001 VARCHAR, _percentage_2006 INTEGER )
None of the communities listed has a percentage smaller than 8.6 in 2006.
SELECT COUNT(seats_2001) FROM table_name_23 WHERE _percentage_2006 < 8.6
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, ...
患者李妮娜的α-羟丁酸脱氢酶情况在14年5月27日到2021年4月18日这段时间内怎么样?
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb 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 = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jy...
css
CREATE TABLE roller_coaster ( Roller_Coaster_ID int, Name text, Park text, Country_ID int, Length real, Height real, Speed text, Opened text, Status text ) CREATE TABLE country ( Country_ID int, Name text, Population int, Area int, Languages text )
what are the lengths and heights of roller coasters?
SELECT Length, Height FROM roller_coaster
nvbench
CREATE TABLE table_name_60 ( opponent VARCHAR, loss VARCHAR )
What team did Johnson (11-7) play for?
SELECT opponent FROM table_name_60 WHERE loss = "johnson (11-7)"
sql_create_context
CREATE TABLE Track ( TrackId integer, Name varchar(200), AlbumId integer, MediaTypeId integer, GenreId integer, Composer varchar(220), Milliseconds integer, Bytes integer, UnitPrice decimal(10,2) ) CREATE TABLE InvoiceLine ( InvoiceLineId integer, InvoiceId integer, Trac...
Show the album names and ids for albums that contain tracks with unit price bigger than 1 Visualize by bar chart, and list by the x axis in ascending.
SELECT T1.Title, T1.AlbumId FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 ORDER BY T1.Title
nvbench
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 prescription...
how many patients whose admission location is clinic referral/premature and diagnoses icd9 code is 431?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND diagnoses.icd9_code = "431"
mimicsql_data
CREATE TABLE table_name_32 ( against VARCHAR, position INTEGER )
Which Against has a Position larger than 11?
SELECT COUNT(against) FROM table_name_32 WHERE position > 11
sql_create_context
CREATE TABLE table_66879 ( "Year" real, "Artist" text, "Album" text, "Record label" text, "Weeks at number one" real )
What album was recorded by the rca label?
SELECT "Album" FROM table_66879 WHERE "Record label" = 'rca'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
申请编码为77970046019的检验报告单的科室名称和编码都是什么呢?
SELECT zyjybgb.SQKS, zyjybgb.SQKSMC FROM zyjybgb WHERE zyjybgb.BGDH = '77970046019' UNION SELECT mzjybgb.SQKS, mzjybgb.SQKSMC FROM mzjybgb WHERE mzjybgb.BGDH = '77970046019'
css
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program ( program_id int, name varchar, college varc...
Is course 699 available to undergraduates ?
SELECT DISTINCT advisory_requirement, enforced_requirement, name FROM course WHERE department = 'EECS' AND number = 699
advising
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 Customer_Addresses ( customer_id INTEGER, address_id INTEGER, date_from DATETIME, date_to DATETIME )...
Bar chart x axis product type code y axis maximal product price, could you display from low to high by the product_type_code?
SELECT product_type_code, MAX(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code
nvbench
CREATE TABLE table_29277 ( "District" text, "Counties Represented" text, "Delegate" text, "Party" text, "First Elected" real, "Committee" text )
For democratic party, countries represented is montgomery and where committee is judiciary mention all the delegate name.
SELECT "Delegate" FROM table_29277 WHERE "Committee" = 'Judiciary' AND "Party" = 'Democratic' AND "Counties Represented" = 'Montgomery'
wikisql
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
tell me the top three of the most common intakes the previous year?
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY inputevents_cv.it...
mimic_iii
CREATE TABLE table_64244 ( "School" text, "Location" text, "Mascot" text, "Enrollment" real, "IHSAA Class" text, "County" text, "Year Joined" real, "Previous Conference" text )
Name the IHSAA Class of 55 morgan and a School of mooresville?
SELECT "IHSAA Class" FROM table_64244 WHERE "County" = '55 morgan' AND "School" = 'mooresville'
wikisql
CREATE TABLE table_name_70 ( country VARCHAR, score VARCHAR )
From what country is the player with a score of 68-71-76=215?
SELECT country FROM table_name_70 WHERE score = 68 - 71 - 76 = 215
sql_create_context
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
Return a histogram on how old is each gender, on average?, could you show by the Y from low to high please?
SELECT gender, AVG(age) FROM Person GROUP BY gender ORDER BY AVG(age)
nvbench
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...
查一下医疗就诊61121401100中,超限价自付金额高于4579.7元的药品被开出了哪些,列出所有的这些药品
SELECT SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '61121401100' AND OVE_SELF_AMO > 4579.7
css
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 ftxmzjzjlb ( HXPLC number, HZ...
患者的a1酸性糖蛋白在门诊诊断为疾病K80.961的参考值范围有什么下限和上限?
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM txmzjzjlb JOIN jybgb JOIN jyjgzbb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE txmzjzjlb.JZZDBM = 'K80.961' AND jyjgzbb.JCZBMC = 'a1酸性糖蛋白' UNION SELECT jyjgzbb.CKZFW...
css
CREATE TABLE table_25548213_1 ( title VARCHAR, directed_by VARCHAR )
What was the name of the episode that bill lawrence directed?
SELECT title FROM table_25548213_1 WHERE directed_by = "Bill Lawrence"
sql_create_context
CREATE TABLE table_name_6 ( city VARCHAR, results¹ VARCHAR, opponent VARCHAR )
In what City was Bulgaria the Opponent with Results of 1:0?
SELECT city FROM table_name_6 WHERE results¹ = "1:0" AND opponent = "bulgaria"
sql_create_context
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE treatment ( treat...
what was the last time patient 012-30018 received a bicarbonate test, in 03/this year?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-30018')) AND lab.labname = 'bicarbonate' AND DATETIME(lab.labresulttime, 'start...
eicu
CREATE TABLE table_37306 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "9:30" text, "10:00" text, "10:30" text )
What is on at 7:30 on the same channel as Wheel of Fortune at 7:00?
SELECT "7:30" FROM table_37306 WHERE "7:00" = 'wheel of fortune'
wikisql
CREATE TABLE table_27112708_2 ( mountains_classification VARCHAR, stage VARCHAR )
Which mountains classification is listed under stage 3?
SELECT mountains_classification FROM table_27112708_2 WHERE stage = 3
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is the number of patients whose primary disease is pituitary bleed and drug route is ou?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "PITUITARY BLEED" AND prescriptions.route = "OU"
mimicsql_data
CREATE TABLE table_36919 ( "Nation" text, "Skip" text, "Third" text, "Second" text, "Lead" text )
Which Third has a Skip of ellen vogt?
SELECT "Third" FROM table_36919 WHERE "Skip" = 'ellen vogt'
wikisql
CREATE TABLE table_2226817_4 ( written_by VARCHAR, original_air_date VARCHAR )
Name who wrote the episode that aired april 9, 1989
SELECT written_by FROM table_2226817_4 WHERE original_air_date = "April 9, 1989"
sql_create_context
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTa...
List of tags and excerpt.
SELECT t.TagName, e.Body AS "Excerpt", t.Count AS "Number" FROM Tags AS t LEFT JOIN Posts AS e ON t.ExcerptPostId = e.Id ORDER BY t.Count DESC
sede
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, ...
flight numbers on AA from PHOENIX to MILWAUKEE
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 = 'PHO...
atis
CREATE TABLE table_dev_24 ( "id" int, "active_ocular_disease" bool, "systolic_blood_pressure_sbp" int, "active_infection" bool, "hemoglobin_a1c_hba1c" float, "body_weight" float, "diabetic" string, "seasonal_allergy" bool, "retinal_nerve_disease" bool, "diastolic_blood_pressure_d...
blood pressure ( bp ) readings at screening where systemic bp < 90 or > 140 mm hg, and diastolic bp < 50 or > 90 mm hg.
SELECT * FROM table_dev_24 WHERE (systolic_blood_pressure_sbp < 90 OR systolic_blood_pressure_sbp > 140) AND (diastolic_blood_pressure_dbp < 50 OR diastolic_blood_pressure_dbp > 90)
criteria2sql
CREATE TABLE table_73501 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
How many people got high points in game 35?
SELECT COUNT("High points") FROM table_73501 WHERE "Game" = '35'
wikisql
CREATE TABLE table_26758262_1 ( judges_residence VARCHAR, location_of_court VARCHAR )
Where does the judge whose court is in Groton reside?
SELECT judges_residence FROM table_26758262_1 WHERE location_of_court = "Groton"
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUser...
Which tags are frequently associated with another tag.
SELECT t.Id, t.TagName, COUNT(p.Id) AS tagCount FROM Tags AS t JOIN PostTags AS pTags ON pTags.TagId = t.Id JOIN Posts AS p ON p.Id = pTags.PostId GROUP BY t.TagName, t.Id ORDER BY COUNT(p.Id) DESC
sede
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Student_Tests_Taken ( registration_id IN...
Return the number of the completion date for all the tests that have 'Fail' result, and sort in desc by the X-axis.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY date_of_completion ORDER BY date_of_completion DESC
nvbench
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE T...
For those employees who did not have any job in the past, return a bar chart about the distribution of hire_date and the amount of hire_date bin hire_date by weekday.
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE table_36308 ( "Tournament" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text )
Which 1995 has a 1993 of 3r?
SELECT "1995" FROM table_36308 WHERE "1993" = '3r'
wikisql
CREATE TABLE table_24425976_2 ( original_air_date VARCHAR, production_code VARCHAR )
What date did the episode with code 110 originally air?
SELECT original_air_date FROM table_24425976_2 WHERE production_code = "110"
sql_create_context
CREATE TABLE table_32934 ( "Organization Name" text, "State" text, "Year" real, "Total Assets" text, "Form" real, "Pages" real )
How many forms have less than 18 pages?
SELECT COUNT("Form") FROM table_32934 WHERE "Pages" < '18'
wikisql
CREATE TABLE table_66553 ( "Date" text, "Location" text, "Lineup" text, "Assist/pass" text, "Score" text, "Result" text, "Competition" text )
What was the score on 2010-07-13 when Abby wambach had the assist/pass?
SELECT "Score" FROM table_66553 WHERE "Assist/pass" = 'abby wambach' AND "Date" = '2010-07-13'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, h...
what's the name of the diagnosis that patient 010-9767 was given for the last time?
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-9767')) ORDER BY diagnosis.diagnosistime DESC LIMIT 1
eicu
CREATE TABLE table_47850 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the total number of Week(s), when Attendance is 61,603?
SELECT COUNT("Week") FROM table_47850 WHERE "Attendance" = '61,603'
wikisql
CREATE TABLE table_1889619_5 ( country_territory VARCHAR, story_no VARCHAR, missing_episodes_with_recovered_footage VARCHAR )
When episode 4 is the missing episode with recovered footage and the 032 is the story number what is the country/territory?
SELECT country_territory FROM table_1889619_5 WHERE story_no = "032" AND missing_episodes_with_recovered_footage = "Episode 4"
sql_create_context
CREATE TABLE table_54937 ( "Year" text, "Team" text, "Comp" text, "Rate" text, "RAtt" text, "RYds" text, "RAvg" text )
What year has a RAtt of 1 and a comp of 49?
SELECT "Year" FROM table_54937 WHERE "RAtt" = '1' AND "Comp" = '49'
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_I...
For those employees who was hired before 2002-06-21, return a scatter chart about the correlation between salary and manager_id .
SELECT SALARY, MANAGER_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
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, ...
provide the number of emergency hospital admission patients who had creatine kinase, mb isoenzyme lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.label = "Creatine Kinase, MB Isoenzyme"
mimicsql_data
CREATE TABLE table_name_88 ( overall INTEGER, name VARCHAR, round VARCHAR, pick VARCHAR )
Which Overall has a Round larger than 7, a Pick larger than 13, and a Name of tony hall?
SELECT AVG(overall) FROM table_name_88 WHERE round > 7 AND pick > 13 AND name = "tony hall"
sql_create_context
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
Distribution of votes by type.
SELECT VX.YR_WK, COUNT(VX.Id) FROM VoteTypes AS VT JOIN (SELECT V.VoteTypeId AS VoteTypeId, (TIME_TO_STR(V.CreationDate, '%y') + (TIME_TO_STR(V.CreationDate, '%W') - 1) / 52.0) AS YR_WK, V.Id AS ID FROM Votes AS V) AS VX ON VX.VoteTypeId = VT.Id AND (VT.Name = 'UpMod' OR VT.Name = 'DownMod') GROUP BY VX.YR_WK ORDER BY ...
sede
CREATE TABLE table_name_85 ( actor VARCHAR, duration VARCHAR, character VARCHAR )
Which actor played Harold Bishop for 17 years?
SELECT actor FROM table_name_85 WHERE duration = "17 years" AND character = "harold bishop"
sql_create_context
CREATE TABLE table_name_66 ( division VARCHAR, country VARCHAR, season VARCHAR )
What division was Ukraine in 2006/07?
SELECT division FROM table_name_66 WHERE country = "ukraine" AND season = "2006/07"
sql_create_context
CREATE TABLE document_functional_areas ( document_code text, functional_area_code text ) CREATE TABLE document_structures ( document_structure_code text, parent_document_structure_code text, document_structure_description text ) CREATE TABLE roles ( role_code text, role_description text ) ...
What is the total access count of documents that are of the most common document type?
SELECT SUM(access_count) FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_name_98 ( outcome VARCHAR, opponent VARCHAR )
What was the outcome for Rik de Voest as opponent?
SELECT outcome FROM table_name_98 WHERE opponent = "rik de voest"
sql_create_context
CREATE TABLE table_44197 ( "NTSC M" text, "PAL B,G,H" text, "PAL I" text, "PAL N" text, "PAL M" text )
Which PAL has a PAL B, G, H of 4.43361875mhz?
SELECT "PAL N" FROM table_44197 WHERE "PAL B,G,H" = '4.43361875mhz'
wikisql
CREATE TABLE prereq ( course_id text, prereq_id text ) CREATE TABLE time_slot ( time_slot_id text, day text, start_hr number, start_min number, end_hr number, end_min number ) CREATE TABLE section ( course_id text, sec_id text, semester text, year number, building t...
What is the title of the course that is a prerequisite for Mobile Computing?
SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'Mobile Computing')
spider
CREATE TABLE table_name_14 ( format VARCHAR, frequency VARCHAR )
What format is at frequency 99.5 FM?
SELECT format FROM table_name_14 WHERE frequency = "99.5 fm"
sql_create_context
CREATE TABLE table_4058 ( "Title" text, "Developer" text, "Publisher" text, "North America" text, "Europe" text, "Asia" text, "Exclusive" text )
Which titles have been published by Gamehouse Live?
SELECT "Title" FROM table_4058 WHERE "Publisher" = 'GameHouse Live'
wikisql
CREATE TABLE table_6593 ( "Locomotive" text, "Delivered as" text, "Entered service" text, "Owner" text, "Status" text )
What is the Entered service date of the T413?
SELECT "Entered service" FROM table_6593 WHERE "Delivered as" = 't413'
wikisql
CREATE TABLE table_name_36 ( capacity VARCHAR, code VARCHAR )
what is the capacity when the code is d4f bi-fuel 732?
SELECT capacity FROM table_name_36 WHERE code = "d4f bi-fuel 732"
sql_create_context
CREATE TABLE table_31363 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who is every high rebound when the team is Mount St. Mary's?
SELECT "High rebounds" FROM table_31363 WHERE "Team" = 'Mount St. Mary''s'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
what is the number of patients whose admission location is clinic referral/premature?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE"
mimicsql_data
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 TABLE stadium ( ID int, name text, Capacity int, City text, Coun...
A bar chart shows the distribution of meter_700 and meter_100 , and rank from high to low by the bars.
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_700 DESC
nvbench
CREATE TABLE table_2175858_1 ( miles__km_ VARCHAR, average_speed__mph_ VARCHAR )
How many miles were driven with the average speed at 116.81?
SELECT miles__km_ FROM table_2175858_1 WHERE average_speed__mph_ = "116.81"
sql_create_context
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 ...
give me the number of patients whose insurance is private and lab test name is urea nitrogen, urine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Private" AND lab.label = "Urea Nitrogen, Urine"
mimicsql_data
CREATE TABLE table_name_36 ( shoulder VARCHAR, length VARCHAR )
What is the shoulder measurement of the gun with a length of 57.85 (2.278)?
SELECT shoulder FROM table_name_36 WHERE length = "57.85 (2.278)"
sql_create_context
CREATE TABLE table_66942 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
Which of the two teams has 1st leg of 2-0?
SELECT "Team 2" FROM table_66942 WHERE "1st leg" = '2-0'
wikisql
CREATE TABLE table_49663 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real )
How many Points has Wins larger than 0?
SELECT COUNT("Points") FROM table_49663 WHERE "Wins" > '0'
wikisql
CREATE TABLE phone ( company_name text, hardware_model_name text, accreditation_type text, accreditation_level text, date text, chip_model text, screen_mode text ) CREATE TABLE chip_model ( model_name text, launch_year number, ram_mib number, rom_mib number, slots text, ...
Count the number of chip model that do not have wifi.
SELECT COUNT(*) FROM chip_model WHERE wifi = 'No'
spider
CREATE TABLE party ( party_id number, minister text, took_office text, left_office text, region_id number, party_name text ) CREATE TABLE member ( member_id number, member_name text, party_id text, in_office text ) CREATE TABLE region ( region_id number, region_name tex...
find the event names that have more than 2 records.
SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2
spider
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, ...
how many patients whose year of birth is less than 2097 and lab test abnormal status is abnormal?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2097" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE zyb ( CLINIC_ID 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, INSU_TYPE text, IN...
这所医院编码是6389409所有非异地结算的医疗就诊记录在2004-09-26到2012-04-01内有哪些个?
SELECT * FROM qtb WHERE qtb.MED_SER_ORG_NO = '6389409' AND qtb.IN_HOSP_DATE BETWEEN '2004-09-26' AND '2012-04-01' UNION SELECT * FROM gyb WHERE gyb.MED_SER_ORG_NO = '6389409' AND gyb.IN_HOSP_DATE BETWEEN '2004-09-26' AND '2012-04-01' UNION SELECT * FROM zyb WHERE zyb.MED_SER_ORG_NO = '6389409' AND zyb.IN_HOSP_DATE BETW...
css
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
count the number of patients whose diagnoses short title is subendo infarct, initial and drug type is main?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Subendo infarct, initial" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) ) CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) )
Show the smallest enrollment of each state, and show in asc by the X please.
SELECT state, MIN(enr) FROM College GROUP BY state ORDER BY state
nvbench
CREATE TABLE table_51843 ( "Outcome" text, "Date" text, "Championship" text, "Opponent in the final" text, "Score in the final" text )
Who was the opponent in the championship in Johannesburg, South Africa?
SELECT "Opponent in the final" FROM table_51843 WHERE "Championship" = 'johannesburg, south africa'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ...
what are the top four most prescribed drugs for patients who were prescribed metformin hcl 500 mg po tabs at the same time?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'metformin hcl 500 mg po tabs') AS t1 JOIN (SELECT p...
eicu
CREATE TABLE table_16678052_2 ( record VARCHAR, opponent VARCHAR )
What record was reached when the Eagles played the Phoenix Cardinals?
SELECT record FROM table_16678052_2 WHERE opponent = "Phoenix Cardinals"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
count the number of patients whose admission location is transfer from hosp/extram and procedure long title is closed (needle) biopsy of tongue.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.long_title = "Closed [needle] biopsy of tongue"
mimicsql_data
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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
how many times since 6 years ago has patient 50480 been to the hospital?
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 50480 AND DATETIME(admissions.admittime) >= DATETIME(CURRENT_TIME(), '-6 year')
mimic_iii
CREATE TABLE table_72566 ( "Rank" real, "Country" text, "Overall" text, "Justice" text, "Health" text, "Education" text, "Economics" text, "Politics" text )
what's the economics score with education being 92.0
SELECT "Economics" FROM table_72566 WHERE "Education" = '92.0'
wikisql