context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_54 ( icao VARCHAR, city VARCHAR )
What is the ICAO for the airport in Ningbo?
SELECT icao FROM table_name_54 WHERE city = "ningbo"
sql_create_context
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of founder and the sum of revenue , and group by attribute founder, and I want to sort in ascending by the names.
SELECT Founder, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder
nvbench
CREATE TABLE table_14899 ( "Season" text, "Tier" text, "League" text, "Pos." text, "Postseason" text, "Cup competitions" text, "European competitions" text )
Name the position for european competitions of eurocup regular season
SELECT "Pos." FROM table_14899 WHERE "European competitions" = 'eurocup regular season'
wikisql
CREATE TABLE table_name_50 ( pba_team VARCHAR, college VARCHAR )
What is the pba team for the player who went to santo tomas college?
SELECT pba_team FROM table_name_50 WHERE college = "santo tomas"
sql_create_context
CREATE TABLE table_9532 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
What tournament had a 1 point margin of victory?
SELECT "Tournament" FROM table_9532 WHERE "Margin of victory" = '1 point'
wikisql
CREATE TABLE table_203_8 ( id number, "player" text, "rec." number, "yards" number, "avg." number, "td's" number, "long" number )
how many touchdowns did anthony hines and boo williams have altogether ?
SELECT SUM("td's") FROM table_203_8 WHERE "player" IN ('anthony hines', 'boo williams')
squall
CREATE TABLE table_name_2 ( year VARCHAR, round VARCHAR )
Which year has a Round of 17?
SELECT year FROM table_name_2 WHERE round = "17"
sql_create_context
CREATE TABLE table_20278716_2 ( mccain__percentage VARCHAR, others__percentage VARCHAR )
What percentage of voters chose McCain in the county where 2.1% of voters voted third party?
SELECT mccain__percentage FROM table_20278716_2 WHERE others__percentage = "2.1%"
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, ...
when did patient 005-87465 receive ondansetron prescription first during this month?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465')) AND medication.drugname = 'ondansetron' AND DATET...
eicu
CREATE TABLE table_name_72 ( opponent VARCHAR, player VARCHAR )
Who is the opponent of player phil graham?
SELECT opponent FROM table_name_72 WHERE player = "phil graham"
sql_create_context
CREATE TABLE table_17941032_3 ( try_bonus VARCHAR, lost VARCHAR, losing_bonus VARCHAR )
Name the try bonus for lost being 11 and losing bonus is 6
SELECT try_bonus FROM table_17941032_3 WHERE lost = "11" AND losing_bonus = "6"
sql_create_context
CREATE TABLE table_name_20 ( race VARCHAR, length VARCHAR )
What is the race 12 hours in length?
SELECT race FROM table_name_20 WHERE length = "12 hours"
sql_create_context
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...
Draw a bar chart about the distribution of ACC_Road and the amount of ACC_Road , and group by attribute ACC_Road.
SELECT ACC_Road, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road
nvbench
CREATE TABLE table_50258 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
Which money has a Country of united states, and a Place of t6?
SELECT AVG("Money ( $ )") FROM table_50258 WHERE "Country" = 'united states' AND "Place" = 't6'
wikisql
CREATE TABLE table_9841 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What was the maximum attendance when Chicago is the visiting team?
SELECT MAX("Attendance") FROM table_9841 WHERE "Visitor" = 'chicago'
wikisql
CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text ) CREATE TABLE enroll (...
What is the school code of the accounting department?
SELECT school_code FROM department WHERE dept_name = "Accounting"
spider
CREATE TABLE table_13973 ( "Team" text, "Tries for" real, "Tries against" real, "Try diff" text, "Points for" real, "Points against" real, "Points diff" text )
What is the average tries for less than 117 points and less than 48 tries against?
SELECT AVG("Tries for") FROM table_13973 WHERE "Points for" < '117' AND "Tries against" < '48'
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 demographic (...
how many patients whose insurance is government and procedure long title is colonoscopy?
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 = "Colonoscopy"
mimicsql_data
CREATE TABLE table_48490 ( "Date" text, "Opponent#" text, "Site" text, "Result" text, "Attendance" text )
What was the result of 10/18/1947?
SELECT "Result" FROM table_48490 WHERE "Date" = '10/18/1947'
wikisql
CREATE TABLE fgwyjzb ( 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, ...
在04年9月13日到2019年10月2日期间叫做褚永昌的病患医保的统筹基金有多少支出?
SELECT SUM(t_kc24.OVE_PAY) FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '褚永昌' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-09-13' AND '2019-10-02' UNION SELECT SUM(t_kc24.OVE_PAY) FROM fgwyjzb JOIN t_kc24 ON fgwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE fgwyjzb.PERSON...
css
CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) ) CREATE TABLE All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, Document_Type_Code CHAR(15), Document_Na...
what is the code of each location and the number of documents in that location?, display in desc by the X.
SELECT Location_Code, COUNT(*) FROM Document_Locations GROUP BY Location_Code ORDER BY Location_Code DESC
nvbench
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...
what is death status and procedure short title of subject id 26285?
SELECT demographic.expire_flag, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "26285"
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...
在02年2月21日到04年4月10日期间作为患者91814247检测指标506686的医务人员的工号及姓名分别是什么?
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON 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 jybgb.YLJGDM = jyjgzbb.YLJGD...
css
CREATE TABLE table_17634290_7 ( ends VARCHAR, moving_from VARCHAR )
What is the end when moving from is listed as cary clarets?
SELECT ends FROM table_17634290_7 WHERE moving_from = "Cary Clarets"
sql_create_context
CREATE TABLE table_204_676 ( id number, "year" number, "division" number, "league" text, "regular season" text, "playoffs" text, "open cup" text )
the richmond kickers future made the national semifinals only once . what year was it ?
SELECT "year" FROM table_204_676 WHERE "playoffs" = 'national semifinals'
squall
CREATE TABLE Residents_Services ( resident_id INTEGER, service_id INTEGER, date_moved_in DATETIME, property_id INTEGER, date_requested DATETIME, date_provided DATETIME, other_details VARCHAR(255) ) CREATE TABLE Organizations ( organization_id INTEGER, parent_organization_id INTEGER,...
Give me a bar chart to show the proportion of each type of the thing that has the status 'Close' or has a status record before the date '2017-06-19 02:59:21', order by the X-axis in descending.
SELECT Type_of_Thing_Code, COUNT(Type_of_Thing_Code) FROM Timed_Status_of_Things AS T1 JOIN Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.Status_of_Thing_Code = 'Close' OR T1.Date_and_Date < '2017-06-19 02:59:21' GROUP BY Type_of_Thing_Code ORDER BY Type_of_Thing_Code DESC
nvbench
CREATE TABLE table_name_74 ( home_team VARCHAR, venue VARCHAR )
When the venue was punt road oval, what was the Home teams score?
SELECT home_team AS score FROM table_name_74 WHERE venue = "punt road oval"
sql_create_context
CREATE TABLE reservations ( code number, room text, checkin text, checkout text, rate number, lastname text, firstname text, adults number, kids number ) CREATE TABLE rooms ( roomid text, roomname text, beds number, bedtype text, maxoccupancy number, basepric...
How many times the number of adults and kids staying in a room reached the maximum capacity of the room?
SELECT COUNT(*) FROM reservations AS T1 JOIN rooms AS T2 ON T1.room = T2.roomid WHERE T2.maxoccupancy = T1.adults + T1.kids
spider
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CR...
Users from Poland by Reputation.
SELECT Reputation, DisplayName, Location FROM Users WHERE LOWER(Location) LIKE '%poland%' ORDER BY Reputation DESC
sede
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE airport ( airport_code varchar, airport_name text, ...
display all the flights from BALTIMORE to DALLAS which leave after 1600
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.departure_time > 1600 AND flight.to_airport = AIRPORT_SERVICE_1.airpor...
atis
CREATE TABLE table_58218 ( "Date" text, "Competition" text, "Venue" text, "Result" text, "Score" text, "Goals" text )
Which competition has a Goal of deacon 8/8 and a Score of 32-14?
SELECT "Competition" FROM table_58218 WHERE "Goals" = 'deacon 8/8' AND "Score" = '32-14'
wikisql
CREATE TABLE table_14482 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real )
What is the average Total for the United States with a To par more than 6 and 1996 was won?
SELECT AVG("Total") FROM table_14482 WHERE "Country" = 'united states' AND "To par" > '6' AND "Year(s) won" = '1996'
wikisql
CREATE TABLE table_61391 ( "Season" text, "Premier" real, "First" real, "Second" real, "Total" real )
What is the highest Total, when Season is '1996-97', and when Second is less than 33?
SELECT MAX("Total") FROM table_61391 WHERE "Season" = '1996-97' AND "Second" < '33'
wikisql
CREATE TABLE payments ( payment_id number, booking_id number, customer_id number, payment_type_code text, amount_paid_in_full_yn text, payment_date time, amount_due number, amount_paid number ) CREATE TABLE bookings ( booking_id number, customer_id number, booking_status_cod...
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check
SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'
spider
CREATE TABLE table_204_902 ( id number, "rank" number, "name" text, "nationality" text, "time" text, "notes" text )
who finished next after kaitlin sandeno ?
SELECT "name" FROM table_204_902 WHERE "rank" = (SELECT "rank" FROM table_204_902 WHERE "name" = 'kaitlin sandeno') + 1
squall
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, sp...
what is the four, the most frequent input event in 2102?
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 STRFTIME('%y', inputevents_cv.charttime) = '2102' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 4)
mimic_iii
CREATE TABLE table_75085 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "School/Club Team" text )
What is the nationality of the player from Drexel who had a pick larger than 183?
SELECT "Nationality" FROM table_75085 WHERE "Pick" > '183' AND "School/Club Team" = 'drexel'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetake...
give me the difference between patient 006-122567's total input and the total output on 07/11/2101?
SELECT (SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-122567')) AND intakeoutput.cellpath ...
eicu
CREATE TABLE table_19722664_5 ( assists VARCHAR, player VARCHAR )
How many assists did Delisha Milton-Jones make?
SELECT assists FROM table_19722664_5 WHERE player = "DeLisha Milton-Jones"
sql_create_context
CREATE TABLE table_27922491_20 ( wickets INTEGER )
What is the fewest number of wickets recorded?
SELECT MIN(wickets) FROM table_27922491_20
sql_create_context
CREATE TABLE table_56608 ( "Congress" text, "Bill number" text, "Date introduced" text, "Sponsor" text, "# of cosponsors" real )
Who was the sponsor on April 22, 2004?
SELECT "Sponsor" FROM table_56608 WHERE "Date introduced" = 'april 22, 2004'
wikisql
CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_seaso...
What is the sum of capacity of cinemas open for each year? Return a line chart, could you display from low to high by the x axis please?
SELECT Openning_year, SUM(Capacity) FROM cinema ORDER BY Openning_year
nvbench
CREATE TABLE table_54080 ( "D 39 \u221a" text, "D 40 \u221a" text, "D 41 \u221a" text, "D 42 \u221a" text, "D 43 \u221a" text, "D 44 \u221a" text, "D 45 \u221a" text, "D 46 \u221a" text, "D 47 \u221a" text, "D 48 \u221a" text )
What's the D 42 when D 46 is majority ?
SELECT "D 42 \u221a" FROM table_54080 WHERE "D 46 \u221a" = 'majority→'
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...
查询给患者喻奇文开了氯雷他定片的医院有哪些
SELECT t_kc22.t_kc21_MED_SER_ORG_NO FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '喻奇文' AND t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_NM = '氯雷他定片')
css
CREATE TABLE table_63022 ( "Artist" text, "Song" text, "Lyrics (l) / Music (m)" text, "Votes" text, "Place" text )
What is the Artist of the Song with a Place of withdrawn?
SELECT "Artist" FROM table_63022 WHERE "Place" = 'withdrawn'
wikisql
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE course_offering ( offering_id int, course_id int, ...
What 8 -credit course are there ?
SELECT DISTINCT name, number FROM course WHERE credits = 8 AND department = 'EECS'
advising
CREATE TABLE table_name_63 ( body_width_mm INTEGER, lead_pitch_mm VARCHAR, part_number VARCHAR )
Which Body Width/mm has a Lead Pitch/mm smaller than 0.55, and a Part Number of tsop48?
SELECT MIN(body_width_mm) FROM table_name_63 WHERE lead_pitch_mm < 0.55 AND part_number = "tsop48"
sql_create_context
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE writes ( paperid i...
papers by mayank goel
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'mayank goel' AND writes.authorid = author.authorid
scholar
CREATE TABLE table_62113 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is To Par, when Country is 'Australia'?
SELECT "To par" FROM table_62113 WHERE "Country" = 'australia'
wikisql
CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE T...
How many different departments are there?
SELECT COUNT(DISTINCT dept_name) FROM department
spider
CREATE TABLE Customers ( first_name VARCHAR, last_name VARCHAR, amount_outstanding INTEGER )
List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000
sql_create_context
CREATE TABLE WINE ( Name VARCHAR, score INTEGER )
List the names of all distinct wines that have scores higher than 90.
SELECT Name FROM WINE WHERE score > 90
sql_create_context
CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description...
give me a flight from CHARLOTTE to BALTIMORE on tuesday morning
SELECT DISTINCT flight_id FROM flight WHERE (((flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 22 AND DATE_DAYalias0.month_number = 3 AND DATE_DAYalias0.year = 1991)) AND to...
atis
CREATE TABLE table_26368963_2 ( under_11 VARCHAR, under_17 VARCHAR )
What is every value for Under-11 when value of under-17 is Salma Nassar?
SELECT under_11 FROM table_26368963_2 WHERE under_17 = "Salma Nassar"
sql_create_context
CREATE TABLE table_203_729 ( id number, "township" text, "fips" number, "population\ncenter" text, "population" number, "population\ndensity\n/km2 (/sq mi)" text, "land area\nkm2 (sq mi)" text, "water area\nkm2 (sq mi)" text, "water %" text, "geographic coordinates" text )
what is the average water % for mulberry ?
SELECT "water %" FROM table_203_729 WHERE "township" = 'mulberry'
squall
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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
when did first patient 2238 have the minimum value of fibrinogen, functional in 04/last year?
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2238) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'fibrinogen, functional') AND DATETIME(labevents.charttime, 'start of year') = DA...
mimic_iii
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
最短医疗住院时间超过27天的在医院4547254有多少个科室?
SELECT COUNT(*) FROM (SELECT MED_ORG_DEPT_CD FROM t_kc21 WHERE MED_SER_ORG_NO = '4547254' GROUP BY MED_ORG_DEPT_CD HAVING MIN(IN_HOSP_DAYS) > 27) AS T
css
CREATE TABLE table_name_75 ( fa_cup_goals VARCHAR, euro_competitions VARCHAR, league_goals VARCHAR )
What is FA Cup Goals, when Euro Competitions is 1, and when League Goals is 11?
SELECT fa_cup_goals FROM table_name_75 WHERE euro_competitions = "1" AND league_goals = "11"
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...
the systemicmean of patient 006-167444 second measured on the first intensive care unit visit was less than the first value measured on the first intensive care unit visit?
SELECT (SELECT vitalperiodic.systemicmean FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-167444') AND NOT patient.unitdischargetime...
eicu
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...
找出患者方雅珺从2003-04-08到2011-10-21在医院4446242中被开了哪些药品以及对应的编码
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '方雅珺' AND t_kc22.t_kc21_MED_SER_ORG_NO = '4446242' AND t_kc22.t_kc21_IN_HOSP_DATE BETWEEN '2003-04-08' AND '2011-10-21')
css
CREATE TABLE table_name_80 ( conference VARCHAR, city VARCHAR )
Which conference is in Portland, Oregon?
SELECT conference FROM table_name_80 WHERE city = "portland, oregon"
sql_create_context
CREATE TABLE table_72161 ( "Character" text, "Fate" text, "Actor" text, "First Episode" text, "Final Episode" text, "Duration" text, "Final Episode Count" real )
what's the character with fate being deceased: knife wound
SELECT "Character" FROM table_72161 WHERE "Fate" = 'Deceased: Knife Wound'
wikisql
CREATE TABLE table_42189 ( "Week" real, "Home Team" text, "Away Team" text, "Overall Record" text, "Divisional Record" text )
Can you tell me the Week that has the Home Team of detroit, and the Divisional Record of (3-0), and the Overall Record of (5-1), and the Away Team of minnesota?
SELECT "Week" FROM table_42189 WHERE "Home Team" = 'detroit' AND "Divisional Record" = '(3-0)' AND "Overall Record" = '(5-1)' AND "Away Team" = 'minnesota'
wikisql
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId nu...
High scoring posts per month.
SELECT LAST_DATE_OF_MONTH(CreationDate), COUNT(Id) AS Posts, 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 Score >= '##min?50##' GROUP BY LAST_DATE_OF_MONTH(CreationDate) ORDER BY LAST_DATE_OF_MONTH(CreationDate)
sede
CREATE TABLE table_79339 ( "Draw" real, "Singer" text, "Song" text, "Televoting (votes)" text, "Jury" text, "Place" text )
What song was 2nd (25,517) in televoting (votes)?
SELECT "Song" FROM table_79339 WHERE "Televoting (votes)" = '2nd (25,517)'
wikisql
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 Subjects ( subject_id INTEGER, subje...
Find the student ID and personal name of the student with at least two enrollments. Plot them as pie chart.
SELECT T2.personal_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id
nvbench
CREATE TABLE table_name_60 ( country VARCHAR, finish VARCHAR, player VARCHAR )
From what Country is T2 Finish Player Gary Player?
SELECT country FROM table_name_60 WHERE finish = "t2" AND player = "gary player"
sql_create_context
CREATE TABLE table_name_25 ( left_office VARCHAR, name VARCHAR )
On what date did ke eaumoku p pa iahiahi leave office?
SELECT left_office FROM table_name_25 WHERE name = "ke ʻ eaumoku pāpa ʻ iahiahi"
sql_create_context
CREATE TABLE table_66448 ( "Year" real, "Game" text, "Genre" text, "Platform(s)" text, "Developer(s)" text )
Who was the developer of XCom: Enemy Unknown?
SELECT "Developer(s)" FROM table_66448 WHERE "Game" = 'xcom: enemy unknown'
wikisql
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, Creation...
WHERE filtering with dates and BETWEEN.
SELECT * FROM dbo.Users WHERE CreationDate BETWEEN '2016/01/01' AND '2016/12/31'
sede
CREATE TABLE table_27252 ( "Rank" real, "WS Points" real, "Name" text, "Country" text, "09-10 I/O best" real, "09-10 GP/JGP best" real, "09-10 GP/JGP 2nd" real, "09-10 OI best" real, "09-10 OI 2nd" real, "08-09 I/O best" real, "08-09 GP/JGP best" real, "08-09 GP/JGP 2nd" ...
What was the maximum 09-10 i/o best?
SELECT MAX("09-10 I/O best") FROM table_27252
wikisql
CREATE TABLE table_61715 ( "Pos." real, "Club" text, "Points" real, "Played" real, "Wins" real, "Draw" real, "Lost" real )
What's the average Played for a draw of 5 and more than 43 points?
SELECT AVG("Played") FROM table_61715 WHERE "Draw" = '5' AND "Points" > '43'
wikisql
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 ) ...
what is the number of patients whose year of birth is less than 2065 and diagnoses short title is malig neo ascend colon?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2065" AND diagnoses.short_title = "Malig neo ascend colon"
mimicsql_data
CREATE TABLE table_name_86 ( drawn INTEGER, points INTEGER )
How many drawn having more than 9 points?
SELECT SUM(drawn) FROM table_name_86 WHERE points > 9
sql_create_context
CREATE TABLE table_name_93 ( fourth VARCHAR, event VARCHAR )
Who was Fourth in the 2008 Telstra Men's Pro Event?
SELECT fourth FROM table_name_93 WHERE event = "2008 telstra men's pro"
sql_create_context
CREATE TABLE table_17263 ( "No." text, "Player" text, "Date of Birth" text, "Batting Style" text, "Bowling Style" text, "First Class Team" text )
What is the bowling style of chris harris?
SELECT "Bowling Style" FROM table_17263 WHERE "Player" = 'Chris Harris'
wikisql
CREATE TABLE table_16571 ( "Character" text, "Portrayed by" text, "First appearance" text, "Last appearance" text, "Duration" text, "Episodes" text )
How many episodes did actress Vanessa Ferlito appear in?
SELECT "Episodes" FROM table_16571 WHERE "Portrayed by" = 'Vanessa Ferlito'
wikisql
CREATE TABLE company ( company_id number, rank number, company text, headquarters text, main_industry text, sales_billion number, profits_billion number, assets_billion number, market_value number ) CREATE TABLE station_company ( station_id number, company_id number, ran...
What are the names and headquarters of all companies ordered by descending market value?
SELECT company, headquarters FROM company ORDER BY market_value DESC
spider
CREATE TABLE table_204_912 ( id number, "rank" number, "athlete" text, "country" text, "time" number, "notes" text )
how many competitors were from the soviet union ?
SELECT COUNT("athlete") FROM table_204_912 WHERE "country" = 'soviet union'
squall
CREATE TABLE table_name_25 ( event VARCHAR, opponent VARCHAR )
In what event is the opponent Joe Nameth?
SELECT event FROM table_name_25 WHERE opponent = "joe nameth"
sql_create_context
CREATE TABLE city ( City_ID int, City text, Hanzi text, Hanyu_Pinyin text, Regional_Population int, GDP real ) CREATE TABLE hosting_city ( Year int, Match_ID int, Host_City text ) CREATE TABLE temperature ( City_ID int, Jan real, Feb real, Mar real, Apr real, ...
For each competition, count the number of matches, and rank in desc by the X-axis.
SELECT Competition, COUNT(*) FROM match GROUP BY Competition ORDER BY Competition DESC
nvbench
CREATE TABLE table_48047 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
What score did Australia get?
SELECT "Score" FROM table_48047 WHERE "Country" = 'australia'
wikisql
CREATE TABLE table_name_99 ( week INTEGER, opponent VARCHAR, attendance VARCHAR )
What is the average week with St. Louis Cardinals with less than 80,010 attendance?
SELECT AVG(week) FROM table_name_99 WHERE opponent = "st. louis cardinals" AND attendance < 80 OFFSET 010
sql_create_context
CREATE TABLE table_79560 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
Which tie number had an away team of Arsenal?
SELECT "Tie no" FROM table_79560 WHERE "Away team" = 'arsenal'
wikisql
CREATE TABLE table_78047 ( "Stage" text, "Winner" text, "General classification" text, "Points classification" text, "Trofeo Fast Team" text )
who was the trofeo fast team in stage 10?
SELECT "Trofeo Fast Team" FROM table_78047 WHERE "Stage" = '10'
wikisql
CREATE TABLE table_47836 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the score when Fulham is the away team?
SELECT "Score" FROM table_47836 WHERE "Away team" = 'fulham'
wikisql
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
how much ns was prescribed during this month for the first time to patient 76332?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 76332) AND prescriptions.drug = 'ns' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY presc...
mimic_iii
CREATE TABLE table_name_44 ( attendance VARCHAR, result VARCHAR )
How many people attended the game when the game was won 4-2?
SELECT COUNT(attendance) FROM table_name_44 WHERE result = "won 4-2"
sql_create_context
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
What is the total revenue of each manufacturer, sort in ascending by the names.
SELECT Name, SUM(Revenue) FROM Manufacturers GROUP BY Name ORDER BY Name
nvbench
CREATE TABLE table_name_93 ( byes INTEGER, losses VARCHAR, draws VARCHAR )
What is the highest number of byes where the losses were 9 and the draws were less than 0?
SELECT MAX(byes) FROM table_name_93 WHERE losses = 9 AND draws < 0
sql_create_context
CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperfield ( fieldid int, ...
what author is most cited ?
SELECT DISTINCT author.authorname, COUNT(cite.citingpaperid) FROM author, cite, writes WHERE writes.authorid = author.authorid AND writes.paperid = cite.citedpaperid GROUP BY author.authorname ORDER BY COUNT(cite.citingpaperid) DESC
scholar
CREATE TABLE table_13118 ( "Mark" text, "Wind*" text, "Athlete" text, "Nationality" text, "Venue" text, "Date" text )
Which Wind* has a Nationality of united states, and an Athlete of jackie joyner-kersee?
SELECT "Wind*" FROM table_13118 WHERE "Nationality" = 'united states' AND "Athlete" = 'jackie joyner-kersee'
wikisql
CREATE TABLE table_name_20 ( episode INTEGER, segment_d VARCHAR )
What episode has a manual motorcycle transmissions section D?
SELECT SUM(episode) FROM table_name_20 WHERE segment_d = "manual motorcycle transmissions"
sql_create_context
CREATE TABLE table_29827 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What was the score when andray blatche , al thornton (20) had the high points?
SELECT "Score" FROM table_29827 WHERE "High points" = 'Andray Blatche , Al Thornton (20)'
wikisql
CREATE TABLE table_65198 ( "Rank" text, "Country" text, "Jerseys" real, "Giro wins" real, "Points" real, "Young rider" real, "Most recent cyclist" text, "Most recent date" text, "Different holders" real )
what is the least different holders when the country is ireland and giro wins is less than 1?
SELECT MIN("Different holders") FROM table_65198 WHERE "Country" = 'ireland' AND "Giro wins" < '1'
wikisql
CREATE TABLE table_name_81 ( result VARCHAR, date VARCHAR )
What was the result on 27 august 2003?
SELECT result FROM table_name_81 WHERE date = "27 august 2003"
sql_create_context
CREATE TABLE table_name_66 ( december INTEGER, score VARCHAR )
What is the lowest December, when Score is '4 - 4'?
SELECT MIN(december) FROM table_name_66 WHERE score = "4 - 4"
sql_create_context
CREATE TABLE individuals ( individual_id number, individual_first_name text, individual_middle_name text, inidividual_phone text, individual_email text, individual_address text, individual_last_name text ) CREATE TABLE party_services ( booking_id number, customer_id number, serv...
Find the name of organizations whose names contain 'Party'.
SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"
spider
CREATE TABLE table_14135 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "TV Time" text, "Attendance" text )
Which week was the December 21, 2003 game?
SELECT "Week" FROM table_14135 WHERE "Date" = 'december 21, 2003'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
when were patient 20332 first prescribed for aspirin and potassium chl 20 meq / 1000 ml d5 1/2 ns at the same time?
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'aspirin' AND admissions.subject_id = 20332) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JO...
mimic_iii