context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational...
Aside from general elective , does DUTCH 901 fulfill any requirements ?
SELECT DISTINCT program_course.category FROM course, program_course WHERE course.department = 'DUTCH' AND course.number = 901 AND program_course.course_id = course.course_id
advising
CREATE TABLE Appointment ( AppointmentID INTEGER, Patient INTEGER, PrepNurse INTEGER, Physician INTEGER, Start DATETIME, End DATETIME, ExaminationRoom TEXT ) CREATE TABLE Trained_In ( Physician INTEGER, Treatment INTEGER, CertificationDate DATETIME, CertificationExpires DATE...
Display a bar chart for how many medications are prescribed for each brand?, sort in ascending by the y axis.
SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand ORDER BY COUNT(*)
nvbench
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test...
MUSTHTRE 133 will be taught by who next semester ?
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester...
advising
CREATE TABLE table_31534 ( "Player" text, "Nationality" text, "Position" text, "Years in Toronto" text, "School/Club Team" text )
Roy Rogers play for what school/club team?
SELECT "School/Club Team" FROM table_31534 WHERE "Player" = 'roy rogers'
wikisql
CREATE TABLE table_1302886_1 ( kerry_number VARCHAR, bush_number VARCHAR )
When bush# is 3907, what is Kerry#?
SELECT kerry_number FROM table_1302886_1 WHERE bush_number = 3907
sql_create_context
CREATE TABLE table_17009 ( "Institution" text, "Location" text, "Founded" real, "Type" text, "Enrollment" real, "Nickname" text, "Joined" real, "Left" real, "Current Conference" text )
What year did longwood university leave the conference?
SELECT MIN("Left") FROM table_17009 WHERE "Institution" = 'Longwood University'
wikisql
CREATE TABLE ftxmzjzjlb ( 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...
41736838这位患者的妊娠相关性血浆蛋白-A指标在08年4月18日至10月22日期间的情况
SELECT * FROM hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_i...
css
CREATE TABLE table_35731 ( "Year" real, "Record" text, "Seed" text, "Region" text, "Results" text )
What Record has a Year that's larger than 2012?
SELECT "Record" FROM table_35731 WHERE "Year" > '2012'
wikisql
CREATE TABLE table_77225 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" real, "Class" text, "FCC info" text )
What is Call Sign, when ERP W is greater than 50?
SELECT "Call sign" FROM table_77225 WHERE "ERP W" > '50'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
calculate how many times patient 030-47098 has received a phenytoin laboratory test until 2102.
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-47098')) AND lab.labname = 'phenytoin' AND STRFTIME('%y', lab.labresulttime) <= '2102'
eicu
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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d...
how many days has it been since patient 83038 has had his first calculated total co2 lab test during this hospital visit?
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 = 'calculated total co2') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83038 AN...
mimic_iii
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...
从01年9月22日到08年2月23日医疗机构4812361的总金额是多少与统筹总金额都是多少钱呢?
SELECT SUM(t_kc24.MED_AMOUT), SUM(t_kc24.OVE_PAY) FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '4812361' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2001-09-22' AND '2008-02-23'
css
CREATE TABLE table_25643046_1 ( epicentre__lat VARCHAR, _s_ VARCHAR, origin_time VARCHAR )
What was the epicenter latitude for the quake that started at 17:09?
SELECT epicentre__lat, _s_ FROM table_25643046_1 WHERE origin_time = "17:09"
sql_create_context
CREATE TABLE table_26202847_6 ( opponent_in_the_final VARCHAR, score_in_the_final VARCHAR )
When the score in the final is 3 6, 6 4, 3 6, 4 6, who are all the opponents in the final?
SELECT opponent_in_the_final FROM table_26202847_6 WHERE score_in_the_final = "3–6, 6–4, 3–6, 4–6"
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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime ...
when was patient 15945 for the last time received intake on this month/28?
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15945)) AND DATETIME(inputevents_cv.charttime, 'start of month') = DATETIME(CURRENT_TIME(), ...
mimic_iii
CREATE TABLE table_16409 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
What is the cfl team with ryan folk?
SELECT "CFL Team" FROM table_16409 WHERE "Player" = 'Ryan Folk'
wikisql
CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text ) CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE repair_assignment ( technician_id int, repair_ID int, Machine_ID int ) CREATE T...
What is the name of the technician whose team is not 'NYY', and count them by a bar chart, show by the y-axis in ascending.
SELECT Name, COUNT(Name) FROM technician WHERE Team <> "NYY" GROUP BY Name ORDER BY COUNT(Name)
nvbench
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 ) ...
How many office admitted patients have a primary disease rash?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.diagnosis = "RASH"
mimicsql_data
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 ) ...
provide the number of patients whose insurance is government and procedure long title is biopsy of tonsils and adenoids?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.long_title = "Biopsy of tonsils and adenoids"
mimicsql_data
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 diagnosis and procedure for the patient id 42963?
SELECT diagnoses.short_title, procedures.short_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "42963"
mimicsql_data
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...
在门诊诊断为混合性焦虑和抑郁障碍的甲状旁腺素名叫金睿聪的患者的结果定量和单位都是什么?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND...
css
CREATE TABLE table_26214389_3 ( total_female VARCHAR, qatari_female VARCHAR )
If the qatari female is 918, what is the total number of females?
SELECT total_female FROM table_26214389_3 WHERE qatari_female = 918
sql_create_context
CREATE TABLE table_name_52 ( nationality VARCHAR, time VARCHAR )
Which nationality has a time of 50.92?
SELECT nationality FROM table_name_52 WHERE time = 50.92
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 diagnosis ( diagn...
since 09/11/2104, list the monthly maximum respiration of patient 021-131895.
SELECT MAX(vitalperiodic.respiration) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-131895')) AND NOT vitalperiodic.respiration IS...
eicu
CREATE TABLE table_test_15 ( "id" int, "anemia" bool, "cell_therapy" bool, "hiv_infection" bool, "hemoglobin_a1c_hba1c" float, "body_weight" float, "renal_disease" bool, "creatinine_clearance_cl" float, "active_hepatitis" bool, "chronic_inflammatory_disease" bool, "platelet_c...
hiv infection or active hepatitis
SELECT * FROM table_test_15 WHERE hiv_infection = 1 OR active_hepatitis = 1
criteria2sql
CREATE TABLE table_22719663_3 ( experience VARCHAR, name VARCHAR )
How long has Mel Daniels been playing?
SELECT experience FROM table_22719663_3 WHERE name = "Mel Daniels"
sql_create_context
CREATE TABLE table_77367 ( "Movie Title" text, "Year" real, "Role" text, "Director" text, "Producer" text )
What movie was made in 1957?
SELECT "Movie Title" FROM table_77367 WHERE "Year" = '1957'
wikisql
CREATE TABLE table_55272 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
What is the hometown for a college in Wisconsin?
SELECT "Hometown" FROM table_55272 WHERE "College" = 'wisconsin'
wikisql
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...
how many patients whose diagnoses short title is metabolic encephalopathy and drug route is id?
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 = "Metabolic encephalopathy" AND prescriptions.route = "ID"
mimicsql_data
CREATE TABLE table_name_73 ( gold INTEGER, bronze VARCHAR, silver VARCHAR )
How many Gold medals for the Nations with 6 or more Bronze medals and 18 or more Silver?
SELECT AVG(gold) FROM table_name_73 WHERE bronze > 6 AND silver > 18
sql_create_context
CREATE TABLE table_7285 ( "Position" text, "2014" text, "2013" text, "2012" text, "2011" text )
Who held the same position in 2014 that Garion Weller held in 2014?
SELECT "2014" FROM table_7285 WHERE "2012" = 'garion weller'
wikisql
CREATE TABLE table_4125 ( "Pick" text, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
How many times did Alyn McCauley get picked?
SELECT COUNT("Pick") FROM table_4125 WHERE "Player" = 'Alyn McCauley'
wikisql
CREATE TABLE table_55493 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
I want the time/retired for grid of 24
SELECT "Time/Retired" FROM table_55493 WHERE "Grid" = '24'
wikisql
CREATE TABLE table_name_29 ( date VARCHAR, region VARCHAR, format VARCHAR )
When did the United Kingdom format a stereo LP?
SELECT date FROM table_name_29 WHERE region = "united kingdom" AND format = "stereo lp"
sql_create_context
CREATE TABLE table_36139 ( "Year of Issue" real, "Weight" text, "Diameter" text, "Thickness" text, "Edge" text )
Which Diameter has a Thickness of 1.3mm?
SELECT "Diameter" FROM table_36139 WHERE "Thickness" = '1.3mm'
wikisql
CREATE TABLE table_4060 ( "Contestant" text, "Age" real, "Height" text, "Starting BMI" text, "Finale BMI" text, "Reunion BMI" text, "Start Weight" text, "Finale Weight" text, "Reunion Weight" text, "lbs lost finale" text, "lbs lost reunion" real )
What was miles's bmi att the reunion?
SELECT COUNT("Reunion BMI") FROM table_4060 WHERE "Contestant" = 'Miles'
wikisql
CREATE TABLE table_70454 ( "Year" real, "Chassis" text, "Engine" text, "Tyres" text, "Points" real )
Name the points for year more than 1987
SELECT "Points" FROM table_70454 WHERE "Year" > '1987'
wikisql
CREATE TABLE table_name_11 ( player VARCHAR, opposition VARCHAR )
Which Player has an Opposition of clare?
SELECT player FROM table_name_11 WHERE opposition = "clare"
sql_create_context
CREATE TABLE table_name_62 ( bronze VARCHAR, silver VARCHAR, gold VARCHAR, rank VARCHAR )
What is the total bronze with a Gold larger than 1, a Rank of 2, and a Silver smaller than 12?
SELECT COUNT(bronze) FROM table_name_62 WHERE gold > 1 AND rank = 2 AND silver < 12
sql_create_context
CREATE TABLE table_name_23 ( to_par VARCHAR, place VARCHAR, player VARCHAR )
What is To Par, when Place is 'T9', and when Player is 'Lee Trevino'?
SELECT to_par FROM table_name_23 WHERE place = "t9" AND player = "lee trevino"
sql_create_context
CREATE TABLE table_33543 ( "Rank" real, "Name" text, "Population ( 2011 Census )" real, "Percent of national population" text, "% growth (2006\u201311)" text, "Land area (km\u00b2)" real, "Population density (/km 2 )" real, "House of Commons seats" real, "House of Commons seats (%)" ...
What was the lowest 2011 Census population of an area with a land area larger than 908,607.67 km ?
SELECT MIN("Population ( 2011 Census )") FROM table_33543 WHERE "Land area (km\u00b2)" > '908,607.67'
wikisql
CREATE TABLE table_24725951_1 ( episode VARCHAR, celebrities VARCHAR )
How many episodes had celebrity guest stars Frank Skinner and Lee Mack?
SELECT COUNT(episode) FROM table_24725951_1 WHERE celebrities = "Frank Skinner and Lee Mack"
sql_create_context
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...
魏阳舒这个病人的医疗记录中哪几次被开出过金额不低于6027.88元的药品?查一下这个医疗就诊的编号是啥
SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_NM = '魏阳舒' AND qtb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 6027.88) UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_NM = '魏阳舒' AND gyb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 602...
css
CREATE TABLE table_name_88 ( verb_meaning VARCHAR, part_2 VARCHAR )
What is the verb meaning for *bar as Part 2?
SELECT verb_meaning FROM table_name_88 WHERE part_2 = "*bar"
sql_create_context
CREATE TABLE table_203_198 ( id number, "season" text, "series" text, "team" text, "races" number, "wins" number, "poles" number, "fast laps" number, "points" number, "pos." text )
what is the number of formula one series races that cochet has been in ?
SELECT COUNT("series") FROM table_203_198 WHERE "series" = 'formula one'
squall
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight 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_re...
hi i need to go from NEWARK to NASHVILLE on AA leaving around 630pm
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 (((flight.departure_time <= 1900 AND flight.departure_time >= 1800) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NASHVILLE' AND fli...
atis
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...
count the number of patients whose diagnoses short title is regional enteritis nos and drug route is iv?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Regional enteritis NOS" AND prescriptions.route = "IV"
mimicsql_data
CREATE TABLE table_name_24 ( opponent VARCHAR, date VARCHAR )
Who was the opponent on September 8?
SELECT opponent FROM table_name_24 WHERE date = "september 8"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
find the number of patients admitted before 2115 who have item id 51025.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2115" AND lab.itemid = "51025"
mimicsql_data
CREATE TABLE table_15842 ( "State/territory" text, "Text/background colour" text, "Format" text, "Current slogan" text, "Current series" text, "Notes" text )
What is the current series where the new series began in June 2011?
SELECT "Current series" FROM table_15842 WHERE "Notes" = 'New series began in June 2011'
wikisql
CREATE TABLE table_163 ( "Year" real, "Title" text, "Format" text, "Studio" text, "Release Date" text, "Copyright Information" text, "Catalog Number" text )
what is the format of 'callanetics: 10 years younger in 10 hours'?
SELECT "Format" FROM table_163 WHERE "Title" = 'Callanetics: 10 Years Younger In 10 Hours'
wikisql
CREATE TABLE table_58382 ( "Season" text, "Winners" text, "Score" text, "Runners-up" text, "Venue" text )
What Runners-up have a Venue in Broadwood Stadium?
SELECT "Runners-up" FROM table_58382 WHERE "Venue" = 'broadwood stadium'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ...
what is the marital status of the paient named steven sepulveda?
SELECT demographic.marital_status FROM demographic WHERE demographic.name = "Steven Sepulveda"
mimicsql_data
CREATE TABLE Customer_Event_Notes ( Customer_Event_Note_ID INTEGER, Customer_Event_ID INTEGER, service_type_code CHAR(15), resident_id INTEGER, property_id INTEGER, date_moved_in DATETIME ) CREATE TABLE Timed_Status_of_Things ( thing_id INTEGER, Date_and_Date DATETIME, Status_of_Thi...
Please use a bar chart to compare the number of customers of each customer's move-in date, note that you should bin move-in date into Day Of Week interval, sort in descending by the Y.
SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id ORDER BY COUNT(date_moved_in) DESC
nvbench
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, show me about the distribution of name and the average of revenue , and group by attribute name in a bar chart.
SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
count the number of married patients with lab test item id 51067.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.itemid = "51067"
mimicsql_data
CREATE TABLE table_name_3 ( Id VARCHAR )
What is 2010 that has 1r 2011?
SELECT 2010 FROM table_name_3 WHERE 2011 = "1r"
sql_create_context
CREATE TABLE table_204_19 ( id number, "university" text, "winner" number, "runner-up" number, "years won" text, "years runner-up" text )
which university had the most years won ?
SELECT "university" FROM table_204_19 ORDER BY "winner" DESC LIMIT 1
squall
CREATE TABLE gas_station ( Station_ID int, Open_Year int, Location text, Manager_Name text, Vice_Manager_Name text, Representative_Name text ) CREATE TABLE company ( Company_ID int, Rank int, Company text, Headquarters text, Main_Industry text, Sales_billion real, Pr...
For each company id, what are the companies and how many gas stations does each one operate Plot them as bar chart, and display Company in asc order.
SELECT Company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID GROUP BY T1.Company_ID ORDER BY Company
nvbench
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
检验报告单在2006年1月26日到2013年1月28日医疗机构4874392内开出的数量有多少?
SELECT COUNT(*) FROM jybgb WHERE YLJGDM = '4874392' AND BGRQ BETWEEN '2006-01-26' AND '2013-01-28'
css
CREATE TABLE table_name_5 ( grid INTEGER, time_retired VARCHAR, laps VARCHAR )
What was the grid associated with under 26 laps and a Time/Retired of +6.077?
SELECT AVG(grid) FROM table_name_5 WHERE time_retired = "+6.077" AND laps < 26
sql_create_context
CREATE TABLE table_56385 ( "Rank" real, "Building" text, "Height" text, "Floors" real, "Completed" real )
What is the lowest amount of floors in the building completed before 1970 ranked more than 14?
SELECT MIN("Floors") FROM table_56385 WHERE "Completed" < '1970' AND "Rank" > '14'
wikisql
CREATE TABLE table_16337329_5 ( imperative VARCHAR, past_habitual VARCHAR )
Name the imperative for garis 'you did
SELECT imperative FROM table_16337329_5 WHERE past_habitual = "गरिस् garis 'you did'"
sql_create_context
CREATE TABLE table_name_53 ( episodes INTEGER, first_aired VARCHAR )
Of the series that first aired April 8, 2011, what is the total number of episodes?
SELECT SUM(episodes) FROM table_name_53 WHERE first_aired = "april 8, 2011"
sql_create_context
CREATE TABLE job_history ( employee_id number, start_date time, end_date time, job_id text, department_id number ) CREATE TABLE regions ( region_id number, region_name text ) CREATE TABLE locations ( location_id number, street_address text, postal_code text, city text, ...
display all the information of employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40.
SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct <> "null" OR department_id <> 40
spider
CREATE TABLE table_name_97 ( capacity VARCHAR, rank VARCHAR, city VARCHAR )
What is the capacity of the stadium with a rank lower than 31 located in the city of Bel m ?
SELECT capacity FROM table_name_97 WHERE rank < 31 AND city = "belém"
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, ...
was patient 002-52932 excreting any voided amount on 03/08/2100?
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-52932')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutpu...
eicu
CREATE TABLE climber ( climber_id number, name text, country text, time text, points number, mountain_id number ) CREATE TABLE mountain ( mountain_id number, name text, height number, prominence number, range text, country text )
What is the maximum point for climbers whose country is United Kingdom?
SELECT MAX(points) FROM climber WHERE country = "United Kingdom"
spider
CREATE TABLE table_1940012_2 ( date VARCHAR, runner_s__up VARCHAR )
When did the tournament, in which the runner-up was Song-Hee Kim, happen
SELECT date FROM table_1940012_2 WHERE runner_s__up = "Song-Hee Kim"
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
in this year how many patients were diagnosed with anemia - acute blood loss anemia and didn't come back to the hospital within 2 months?
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'anemia - acute blood loss anemia' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(...
eicu
CREATE TABLE table_name_5 ( power__hp_ INTEGER, engine VARCHAR )
What is the highest power (hp) of an OM314 engine?
SELECT MAX(power__hp_) FROM table_name_5 WHERE engine = "om314"
sql_create_context
CREATE TABLE table_47875 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text )
Which team played in the Boston Garden when the final score was L 118-130?
SELECT "Team" FROM table_47875 WHERE "Location Attendance" = 'boston garden' AND "Score" = 'l 118-130'
wikisql
CREATE TABLE table_16721 ( "Rnd" real, "Race" text, "Date" text, "Location" text, "Pole Position" text, "Fastest Lap" text, "Race Winner" text, "Constructor" text, "Report" text )
How many rounds did Patrick Tambay record the fastest lap?
SELECT COUNT("Rnd") FROM table_16721 WHERE "Fastest Lap" = 'Patrick Tambay'
wikisql
CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station...
Give me the dates when the max temperature was higher than 85, and count them by a bar chart, sort by the the number of date in descending please.
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f > 85 ORDER BY COUNT(date) DESC
nvbench
CREATE TABLE table_222666_1 ( former_codes VARCHAR, new_country_names_and_codes VARCHAR )
Name the former codes for merged into panama ( pa , pan , 591 )
SELECT former_codes FROM table_222666_1 WHERE new_country_names_and_codes = "Merged into Panama ( PA , PAN , 591 )"
sql_create_context
CREATE TABLE table_1140105_6 ( circuit VARCHAR, race_name VARCHAR )
What is the name of the circuit where the race xi Syracuse grand prix was held?
SELECT circuit FROM table_1140105_6 WHERE race_name = "XI Syracuse Grand Prix"
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 was the name of the organism that was found during the first bronchial lavage test of patient 031-19622 until 50 months ago?
SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-19622')) AND microlab.culturesite = 'bronchial lavage' AND DATETIME(m...
eicu
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_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TA...
How often does STRATEGY 502 meet ?
SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_i...
advising
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
列出医院6264917所有非异地结算的医疗就诊记录在2001-05-03到2011-04-15内有哪些?
(SELECT * FROM t_kc21 WHERE MED_SER_ORG_NO = '6264917' AND IN_HOSP_DATE BETWEEN '2001-05-03' AND '2011-04-15') EXCEPT (SELECT * FROM t_kc21 WHERE MED_SER_ORG_NO = '6264917' AND IN_HOSP_DATE BETWEEN '2001-05-03' AND '2011-04-15' AND (REMOTE_SETTLE_FLG = '异地1' OR REMOTE_SETTLE_FLG = '异地2'))
css
CREATE TABLE table_name_28 ( attendance INTEGER, round VARCHAR )
How many people on average attend round f?
SELECT AVG(attendance) FROM table_name_28 WHERE round = "f"
sql_create_context
CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_Percentage real ) CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE game ( ...
List the number of games for each away team and group by home team in a stacked bar chart. The x-axis is away team.
SELECT Away_team, COUNT(Away_team) FROM game GROUP BY Home_team, Away_team
nvbench
CREATE TABLE table_57041 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
Which extra resulted in 2nd before 2005?
SELECT "Extra" FROM table_57041 WHERE "Result" = '2nd' AND "Year" < '2005'
wikisql
CREATE TABLE table_46764 ( "Name" text, "Seasons" real, "Matches" real, "Win %" text, "Draw" real, "Draw %" text, "Lose" real, "Lose %" text )
What is the draw % with more than 110 matches, more than 59 draws, and a losing % of 18.5792%?
SELECT "Draw %" FROM table_46764 WHERE "Matches" > '110' AND "Draw" > '59' AND "Lose %" = '18.5792%'
wikisql
CREATE TABLE table_51413 ( "Air Date" text, "Timeslot (EST)" text, "Season" text, "Rating" real, "Share" real, "18-49 (Rating/Share)" text, "Viewers (m)" real, "Weekly Rank (#)" text )
What is the weekly rank for a share of 9 and 9.42 million viewers?
SELECT "Weekly Rank (#)" FROM table_51413 WHERE "Share" = '9' AND "Viewers (m)" = '9.42'
wikisql
CREATE TABLE table_20596 ( "Western Title" text, "Chinese Title" text, "Pinyin" text, "Released Date" text, "Genre" text, "Game Modes" text )
What was the released date of Polarium?
SELECT "Released Date" FROM table_20596 WHERE "Western Title" = 'Polarium'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid numb...
since 11/2105, when was the first time that patient 002-34744 was prescribed both 50 ml syringe : dextrose 50 % iv soln and sodium chloride 0.9% 1000 ml lvp at the same time?
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = '50 ml syringe : dextrose 50 % iv soln' AND patient.uniquepid = '002-34744' AND STRFTIME('%y-%m', medication.drugstarttime...
eicu
CREATE TABLE table_name_32 ( pl_gp INTEGER, reg_gp VARCHAR, pick__number VARCHAR )
What is the average PI GP when the pick is smaller tha 70 and the reg GP is 97?
SELECT AVG(pl_gp) FROM table_name_32 WHERE reg_gp = 97 AND pick__number < 70
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text ) 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...
列出马华美住在8433751这家医院出院的时候办出院的科室名字没有带角膜两个字的住院记载
SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_i...
css
CREATE TABLE table_3789 ( "Year" text, "Stage" real, "Start of stage" text, "Distance (km)" text, "Category of climb" text, "Stage winner" text, "Nationality" text, "Yellow jersey" text, "Bend" real )
What is the lowest stage when the yellow jersey is Ronan Pensec?
SELECT MIN("Stage") FROM table_3789 WHERE "Yellow jersey" = 'Ronan Pensec'
wikisql
CREATE TABLE table_name_47 ( best VARCHAR, name VARCHAR )
What was Alex Figge's Best?
SELECT best FROM table_name_47 WHERE name = "alex figge"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate n...
when was patient 025-28600 last given a microbiology test on the last hospital encounter?
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-28600' AND NOT patient.hospitaldischargetime IS NULL ORDER BY...
eicu
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, Creati...
How many posts created in 2017?.
SELECT COUNT(CreationDate) FROM Posts WHERE CreationDate BETWEEN '2017-01-01' AND '2017-12-31'
sede
CREATE TABLE table_name_16 ( high_points VARCHAR, date VARCHAR )
What were the high points on september 9?
SELECT high_points FROM table_name_16 WHERE date = "september 9"
sql_create_context
CREATE TABLE table_178408_1 ( sub_parish__sokn_ VARCHAR, year_built VARCHAR )
Name the total number for sub parish sokn for 1865
SELECT COUNT(sub_parish__sokn_) FROM table_178408_1 WHERE year_built = 1865
sql_create_context
CREATE TABLE table_11776 ( "Class" real, "State" text, "Name" text, "Party" text, "First took office" real, "Born" real )
What state was maria cantwell born in after 1955?
SELECT "State" FROM table_11776 WHERE "Born" > '1955' AND "Name" = 'maria cantwell'
wikisql
CREATE TABLE all_documents ( document_id number, date_stored time, document_type_code text, document_name text, document_description text, other_details text ) CREATE TABLE ref_calendar ( calendar_date time, day_number number ) CREATE TABLE document_locations ( document_id number, ...
List the names of the employees who authorized the destruction of documents and the employees who destroyed the corresponding documents.
SELECT T2.employee_name, T3.employee_name FROM documents_to_be_destroyed AS T1 JOIN employees AS T2 ON T1.destruction_authorised_by_employee_id = T2.employee_id JOIN employees AS T3 ON T1.destroyed_by_employee_id = T3.employee_id
spider
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...
Daily Activity Posts Comments Users.
SELECT * FROM (SELECT DATE(CreationDate) AS Date_Posted, SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) AS Questions, SUM(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) AS Answers FROM Posts WHERE YEAR(CreationDate) = 2020 AND DeletionDate IS NULL GROUP BY DATE(CreationDate)) AS a FULL OUTER JOIN (SELECT DATE(CreationDat...
sede
CREATE TABLE table_40349 ( "From" real, "Goal" real, "Round 1" text, "Round 2" text, "Round 3" text, "Round 4" text, "Round 5" text, "Round 6+" text )
What is the round 4 that has from less than 1990, and double for round 3?
SELECT "Round 4" FROM table_40349 WHERE "From" < '1990' AND "Round 3" = 'double'
wikisql
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...
Bar chart x axis all games y axis team_id, and display by the X-axis in ascending please.
SELECT All_Games, Team_ID FROM basketball_match ORDER BY All_Games
nvbench
CREATE TABLE table_203_348 ( id number, "number" number, "name" text, "team" text, "position" text, "years with franchise" text, "note" text )
how many teams have retired a number worn by charles barkley ?
SELECT COUNT("team") FROM table_203_348 WHERE "name" = 'charles barkley'
squall