context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_24 ( away_team VARCHAR, venue VARCHAR )
What away team played at Kardinia Park?
SELECT away_team FROM table_name_24 WHERE venue = "kardinia park"
sql_create_context
CREATE TABLE table_1602858_1 ( margin_of_victory VARCHAR, winning_score VARCHAR )
What was the margin of victory with the winning score '63-68-68-68=267'?
SELECT margin_of_victory FROM table_1602858_1 WHERE winning_score = 63 - 68 - 68 - 68 = 267
sql_create_context
CREATE TABLE mountain ( id int, name text, Height real, Prominence real, Range text, Country text ) CREATE TABLE camera_lens ( id int, brand text, name text, focal_length_mm real, max_aperture real ) CREATE TABLE photos ( id int, camera_lens_id int, mountain_id ...
Return a bar chart on what are the id and name of the mountains that have at least 2 photos?, and could you order in desc by the id please?
SELECT T1.name, T1.id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id ORDER BY T1.id DESC
nvbench
CREATE TABLE table_54857 ( "Player" text, "Height" text, "School" text, "Hometown" text, "College" text, "NBA Draft" text )
Tell me the college that paul davis went to
SELECT "College" FROM table_54857 WHERE "Player" = 'paul davis'
wikisql
CREATE TABLE table_76671 ( "Driver" text, "Team" text, "Race 1" text, "Race 2" text, "Points" real )
Which team received 4 in race 1?
SELECT "Team" FROM table_76671 WHERE "Race 1" = '4'
wikisql
CREATE TABLE table_44781 ( "Year" real, "Month" text, "Single" text, "Album" text, "Record label" text )
What's the earliest year listed for 'where are you going to my love' from the album united we stand?
SELECT MIN("Year") FROM table_44781 WHERE "Album" = 'united we stand' AND "Single" = 'where are you going to my love'
wikisql
CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEG...
Find the number of male students (with sex M) from each city in a bar chart.
SELECT city_code, COUNT(*) FROM Student WHERE Sex = 'M' GROUP BY city_code
nvbench
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additio...
For the COMM 311 course , what are the morning times ?
SELECT DISTINCT course_offering.end_time, course_offering.start_time, semester.semester, semester.year FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'COMM' AND cou...
advising
CREATE TABLE table_name_16 ( member VARCHAR, electorate VARCHAR )
Which member has Cook as the electorate?
SELECT member FROM table_name_16 WHERE electorate = "cook"
sql_create_context
CREATE TABLE table_name_4 ( soap_opera VARCHAR, duration VARCHAR, character VARCHAR )
what is the soap opera when the duration is 18 years and the character is miley byrne?
SELECT soap_opera FROM table_name_4 WHERE duration = "18 years" AND character = "miley byrne"
sql_create_context
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
住院治疗编号94773706571的门诊诊断主要的编码类型、序列号码列表、名字列表都有啥呢?
SELECT zyjzjlb.MZBMLX, zyjzjlb.MZZDBM, zyjzjlb.MZZDMC FROM zyjzjlb WHERE zyjzjlb.JZLSH = '94773706571'
css
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, sort by the JOB_ID from low to high.
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_12496 ( "Lexton Plains" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
Which against has 14 losses?
SELECT "Against" FROM table_12496 WHERE "Losses" = '14'
wikisql
CREATE TABLE table_7184 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What is HDTV, when Content is Cinema, when Package/Option is Sky Cinema + Sky HD, and when Television Service is Sky Cinema Passion HD?
SELECT "HDTV" FROM table_7184 WHERE "Content" = 'cinema' AND "Package/Option" = 'sky cinema + sky hd' AND "Television service" = 'sky cinema passion hd'
wikisql
CREATE TABLE table_59052 ( "Place" text, "Player" text, "Country" text, "Score" real, "To Par" text )
Which Score has a To Par of 1?
SELECT MIN("Score") FROM table_59052 WHERE "To Par" = '–1'
wikisql
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...
what has been patient 027-120551's allergies?
SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-120551'))
eicu
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( c...
did patient 015-100195 come into an er in 2105?
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '015-100195' AND patient.hospitaladmitsource = 'emergency department' AND STRFTIME('%y', patient.unitadmittime) = '2105'
eicu
CREATE TABLE table_name_20 ( fumble_force VARCHAR, solo VARCHAR, player VARCHAR )
How many forced fumbles for jim laney with under 2 solo tackles?
SELECT COUNT(fumble_force) FROM table_name_20 WHERE solo < 2 AND player = "jim laney"
sql_create_context
CREATE TABLE table_204_13 ( id number, "finished" text, "post" number, "horse" text, "jockey" text, "trainer" text, "owner" text, "time / behind" text )
what is the name of the top horse 's trainer ?
SELECT "trainer" FROM table_204_13 ORDER BY "finished" LIMIT 1
squall
CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT )
Who has friends that are older than the average age? Print their name and their ages as well using a bar chart, and list by the X in ascending.
SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM Person) ORDER BY T1.name
nvbench
CREATE TABLE table_name_98 ( nation VARCHAR, rank VARCHAR, gold VARCHAR, bronze VARCHAR )
What is the nation when gold is 0, bronze is more than 0 and rank is 16?
SELECT nation FROM table_name_98 WHERE gold = 0 AND bronze > 0 AND rank = "16"
sql_create_context
CREATE TABLE table_name_42 ( location VARCHAR, record VARCHAR )
What was the location of the fight when Sara McMann's record was 1-0?
SELECT location FROM table_name_42 WHERE record = "1-0"
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 medication ( medi...
how many patient have died after they were diagnosed with hematological effect of infection - leukocytosis during the same hospital encounter until 2 years ago?
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ...
eicu
CREATE TABLE table_35272 ( "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 the 9:00 show that will be aired on the station that airs Dawson's Creek at 8:00?
SELECT "9:00" FROM table_35272 WHERE "8:00" = 'dawson''s creek'
wikisql
CREATE TABLE table_29106 ( "Series #" real, "Season #" real, "Title" text, "Director" text, "Writer" text, "Original air date" text )
Who wrote 'Monica's bad day'?
SELECT "Writer" FROM table_29106 WHERE "Title" = 'Monica''s Bad Day'
wikisql
CREATE TABLE table_203_250 ( id number, "name" text, "type" text, "r.a. (j2000)" text, "dec. (j2000)" text, "redshift (km/s)" text, "apparent magnitude" number )
what number of irregular types are there ?
SELECT COUNT(*) FROM table_203_250 WHERE "type" = 'irregular'
squall
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
Suggested edits by a specific user.
SELECT Id AS "suggested_edit_link" FROM SuggestedEdits WHERE OwnerUserId = '##UserId##'
sede
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, ...
how many times did patient 021-196241 during this year go to the icu?
SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-196241') AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
eicu
CREATE TABLE member ( Member_ID int, Name text, Country text, College_ID int ) CREATE TABLE college ( College_ID int, Name text, Leader_Name text, College_Location text ) CREATE TABLE round ( Round_ID int, Member_ID int, Decoration_Theme text, Rank_in_Round int )
Give me a pie to show how many country from different country.
SELECT Country, COUNT(Country) FROM member GROUP BY Country
nvbench
CREATE TABLE table_train_57 ( "id" int, "bleeding" int, "in_another_study" bool, "hiv_infection" bool, "hepatitis_c_infection" bool, "receiving_vasopressor" bool, "hypotension" bool, "NOUSE" float )
hypotension requiring vasopressor therapy, despite fluid resuscitation of at least 30 cc / kg and lactate > 2 mmol / l
SELECT * FROM table_train_57 WHERE hypotension = 1 AND receiving_vasopressor = 1
criteria2sql
CREATE TABLE table_26448179_4 ( title VARCHAR, production_code VARCHAR )
What is the title of the episode with production code 305?
SELECT title FROM table_26448179_4 WHERE production_code = 305
sql_create_context
CREATE TABLE organizations ( organization_id number, date_formed time, organization_name text, uk_vat_number text ) CREATE TABLE organization_contact_individuals ( individual_id number, organization_id number, date_contact_from time, date_contact_to time ) CREATE TABLE addresses ( ...
Find the payment method and phone of the party with email 'enrico09@example.com'.
SELECT payment_method_code, party_phone FROM parties WHERE party_email = "enrico09@example.com"
spider
CREATE TABLE table_58211 ( "Player" text, "Height" text, "School" text, "Hometown" text, "College" text, "NBA Draft" text )
What is the NBA draft result of the player from Dunbar High School?
SELECT "NBA Draft" FROM table_58211 WHERE "School" = 'dunbar high school'
wikisql
CREATE TABLE table_name_34 ( player VARCHAR, college VARCHAR )
What player belongs to Northwestern College?
SELECT player FROM table_name_34 WHERE college = "northwestern"
sql_create_context
CREATE TABLE table_204_881 ( id number, "round" number, "date" text, "score" text, "opponent" text, "opponent's score" text, "result" text, "venue" text, "attendance" number, "best on ground" text, "team" text )
who was the opponent after hawthorn ?
SELECT "opponent" FROM table_204_881 WHERE id = (SELECT id FROM table_204_881 WHERE "opponent" = 'hawthorn') + 1
squall
CREATE TABLE table_16891 ( "Name of ground" text, "Location" text, "First-class span" text, "Worcs f-c matches" real, "List A span" text, "Worcs LA matches" real )
There were 68 worcs f-c matches played on Chester Road North Ground.
SELECT "Worcs f-c matches" FROM table_16891 WHERE "Name of ground" = 'Chester Road North Ground'
wikisql
CREATE TABLE table_204_558 ( id number, "name" text, "location" text, "city" text, "listing date" text )
what is the total number of locations in the city of algonac ?
SELECT COUNT("location") FROM table_204_558 WHERE "city" = 'algonac'
squall
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
方光华这位患者自07.7.13起,到21.5.12止,看过病的医院总共有多少家
SELECT COUNT(gwyjzb.MED_SER_ORG_NO) FROM gwyjzb WHERE gwyjzb.PERSON_NM = '方光华' AND gwyjzb.IN_HOSP_DATE BETWEEN '2007-07-13' AND '2021-05-12' UNION SELECT COUNT(fgwyjzb.MED_SER_ORG_NO) FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '方光华' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2007-07-13' AND '2021-05-12'
css
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number ...
In Summer 2003 , can I take GREEKMOD 505 ?
SELECT COUNT(*) > 0 FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, semester AS SEMESTERalias0 WHERE COURSEalias0.course_id = COURSE_OFFERINGalias0.course_id AND NOT COURSEalias0.course_id IN...
advising
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE fare ( fare...
i would like to find a flight from PITTSBURGH to BOSTON on wednesday and i have to be in BOSTON by one so i'd like a flight out of here no later than 1100
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, date_day, days, flight WHERE (((flight.arrival_time <= 1300 AND flight.departure_time <= 1100) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = ...
atis
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
What are the course numbers Dr. William Gehring is teaching next semester ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%William Gehring%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.o...
advising
CREATE TABLE table_4223 ( "Quartier" text, "% 0-19 years" text, "% 20-39 years" text, "% 40-59 years" text, "% 60-74 years" text, "% 75 years and +" text )
How many o-19% are where the quartier is in saint-loup?
SELECT "% 0-19 years" FROM table_4223 WHERE "Quartier" = 'Saint-Loup'
wikisql
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...
在门诊就诊65477459453中,中医诊断名是什么?对应的编码呢
SELECT txmzjzjlb.MZZYZDZZBM, txmzjzjlb.MZZYZDZZMC FROM txmzjzjlb WHERE txmzjzjlb.JZLSH = '65477459453' UNION SELECT ftxmzjzjlb.MZZYZDZZBM, ftxmzjzjlb.MZZYZDZZMC FROM ftxmzjzjlb WHERE ftxmzjzjlb.JZLSH = '65477459453'
css
CREATE TABLE table_204_500 ( id number, "year" number, "title" text, "peak chart positions\nus country" number, "peak chart positions\nus" number, "album" text )
how many singles did kitty wells release before 1952 ?
SELECT COUNT("title") FROM table_204_500 WHERE "year" < 1952
squall
CREATE TABLE table_name_74 ( position VARCHAR, player VARCHAR )
What position is Jeff Brown?
SELECT position FROM table_name_74 WHERE player = "jeff brown"
sql_create_context
CREATE TABLE table_name_54 ( goals VARCHAR, score VARCHAR )
Tell me the goals for score of 38-28
SELECT goals FROM table_name_54 WHERE score = "38-28"
sql_create_context
CREATE TABLE table_204_48 ( id number, "date" text, "race name" text, "location" text, "uci rating" text, "winner" text, "team" text )
who won more races , the usa or canada ?
SELECT "winner" FROM table_204_48 WHERE "winner" IN ('usa', 'canada') GROUP BY "winner" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_26758 ( "Player" text, "Group Legs won" real, "Play-Off Legs won" real, "Winners Group Legs won" real, "Winners Play-Off Legs won" real, "Final position money won*" text, "Total money won" text )
What is the highest amount of group legs won when the prize money was 21,850?
SELECT MAX("Winners Group Legs won") FROM table_26758 WHERE "Total money won" = '£21,850'
wikisql
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate ti...
Average Reputation of SO Users n Manchester, United Kingdom.
SELECT AVG(Reputation) AS "average_reputation", COUNT(Id) AS "total_users" FROM Users WHERE LOWER(Location) LIKE '%manchester, united kingdom' AND Reputation > 1
sede
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
患者陈雅惠之前哪些检查已经做了
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '陈雅惠' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_name_12 ( gold VARCHAR, total VARCHAR, silver VARCHAR, nation VARCHAR )
Tell me the number of gold for albania with a silver of 1 and total less than 1
SELECT COUNT(gold) FROM table_name_12 WHERE silver = 1 AND nation = "albania" AND total < 1
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
How many patients born before the year 2094 have diagnosis short title anemia in chronic kidney disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2094" AND diagnoses.short_title = "Anemia in chr kidney dis"
mimicsql_data
CREATE TABLE table_55082 ( "Season" text, "Club" text, "National League" text, "National Cup" text, "European Cup" text )
What is the club that has the turkish basketball cup and fiba eurochallenge (3rd tier)?
SELECT "Club" FROM table_55082 WHERE "National Cup" = 'turkish basketball cup' AND "European Cup" = 'fiba eurochallenge (3rd tier)'
wikisql
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...
从2002年1月28日至2018年5月6日结束外地住院就诊记录在医疗机构8588386里有多少个?
SELECT COUNT(*) FROM zyjzjlb WHERE YLJGDM = '8588386' AND RYDJSJ BETWEEN '2002-01-28' AND '2018-05-06' AND WDBZ > 0
css
CREATE TABLE table_name_38 ( population INTEGER, name_of_city VARCHAR )
What is the population of Chimbote?
SELECT SUM(population) FROM table_name_38 WHERE name_of_city = "chimbote"
sql_create_context
CREATE TABLE table_name_51 ( winning_score VARCHAR, year VARCHAR )
What was the winning score in 1980?
SELECT winning_score FROM table_name_51 WHERE year = 1980
sql_create_context
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostHistoryTypes ( Id number, Name te...
How many questions & answers last edited by Mat(635608) in a time range.
SELECT COUNT(*) FROM Posts WHERE LastEditorUserId = 635608 AND OwnerUserId != 635608 AND LastEditDate > '2013-05-03 12:00:00 AM'
sede
CREATE TABLE table_14062 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Points" real )
What is the total number of positions having 1 loss and more than 9 conceded?
SELECT COUNT("Position") FROM table_14062 WHERE "Losses" = '1' AND "Conceded" > '9'
wikisql
CREATE TABLE table_3594 ( "Team" text, "Manager" text, "Chairman" text, "Team captain" text, "Kit maker" text, "Sponsor" text )
Who is the chairman of Mark Robins team?
SELECT "Chairman" FROM table_3594 WHERE "Manager" = 'Mark Robins'
wikisql
CREATE TABLE table_62794 ( "Name" text, "Population (2011)" real, "Population (2006)" real, "Change (%)" real, "Land area (km\u00b2)" real, "Population density (per km\u00b2)" real )
Which Land area (km ) has a Population density (per km ) larger than 112.6, and a Population (2006) larger than 785, and a Name of pinehouse?
SELECT MAX("Land area (km\u00b2)") FROM table_62794 WHERE "Population density (per km\u00b2)" > '112.6' AND "Population (2006)" > '785' AND "Name" = 'pinehouse'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime ti...
what percentile is red blood cells 3.61 among patients of the same age as patient 15209 during their current hospital visit?
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'red blood cells') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissio...
mimic_iii
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREA...
how many times did patient 005-46456 receive surgery consultation in 2104?
SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-46456')) AND treatment.treatmentname = 'surgery consultation' AND STRFTIME('...
eicu
CREATE TABLE table_name_14 ( record VARCHAR, location VARCHAR, visitor VARCHAR )
What record has montreal, qc as the location, with boston bruins as the visitor?
SELECT record FROM table_name_14 WHERE location = "montreal, qc" AND visitor = "boston bruins"
sql_create_context
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId num...
Find coincident activity between two users.
WITH Interesting(UserId) AS (SELECT 342852 UNION ALL SELECT 57611) SELECT PostId = p.Id, QuestionId = COALESCE(a.Id, p.Id), AnswerId = CASE WHEN p.PostTypeId = 2 THEN p.Id ELSE NULL END FROM Posts AS p LEFT JOIN Posts AS a ON p.PostTypeId = 2 AND p.ParentId = a.Id WHERE EXISTS(SELECT * FROM Interesting AS i WHERE p.Own...
sede
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
how many patients with primary disease bowel obstruction died in or before 2174?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BOWEL OBSTRUCTION" AND demographic.dod_year <= "2174.0"
mimicsql_data
CREATE TABLE table_21020 ( "Model number" text, "sSpec number" text, "Frequency" text, "GPU frequency" text, "L2 cache" text, "I/O bus" text, "Memory" text, "Voltage" text, "TDP" text, "Socket" text, "Release date" text, "Part number(s)" text, "Release price ( USD )" ...
Name the memory for meodel number for atom e640t
SELECT "Memory" FROM table_21020 WHERE "Model number" = 'Atom E640T'
wikisql
CREATE TABLE person_info_hz_info ( RYBH text, KH number, KLX number, YLJGDM number ) 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, J...
列出在医院8360401中患者喻浩岚名称不包含整形科的出院科室有哪些住院就诊记录?
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 Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Plays_Games ( StuID INTEGER, GameID INTEGER, Hours_Played INTEGER ) CREATE TABLE Video_Games ( Ga...
Visualize a bar chart for how many students play each sport?, and show total number from low to high order.
SELECT SportName, COUNT(*) FROM SportsInfo GROUP BY SportName ORDER BY COUNT(*)
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 ) ...
how many patients have anemia in chronic kidney disease as their diagnosis long title?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Anemia in chronic kidney disease"
mimicsql_data
CREATE TABLE table_77441 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game site" text )
What is the Game site week 1?
SELECT "Game site" FROM table_77441 WHERE "Week" = '1'
wikisql
CREATE TABLE table_name_70 ( rank INTEGER, gold INTEGER )
What is the rank where the gold is 0?
SELECT AVG(rank) FROM table_name_70 WHERE gold < 0
sql_create_context
CREATE TABLE table_name_72 ( sample_size INTEGER, date VARCHAR, margin_of_error VARCHAR )
What was the sample size for the poll from Nov 9-11, 2007 with a margin of error less than 4.3?
SELECT MAX(sample_size) FROM table_name_72 WHERE date = "nov 9-11, 2007" AND margin_of_error < 4.3
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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
what is patient 22295's yearly maximum level of glucose?
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22295) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'glucose') GROUP BY STRFTIME('%y', labevents.charttime)
mimic_iii
CREATE TABLE table_name_73 ( score VARCHAR, player VARCHAR )
What is the score for Billy Andrade?
SELECT score FROM table_name_73 WHERE player = "billy andrade"
sql_create_context
CREATE TABLE table_64419 ( "School" text, "Location" text, "Mascot" text, "Size" real, "IHSAA Class" text, "IHSAA Football Class" text, "County" text )
Which IHSAA class has a mascot of the Raiders?
SELECT "IHSAA Class" FROM table_64419 WHERE "Mascot" = 'raiders'
wikisql
CREATE TABLE table_20032 ( "Position" real, "Team" text, "Points" real, "Played" real, "Won" real, "Drawn" real, "Lost" real, "For" real, "Against" real, "Difference" real )
How many under the category of Against have a Difference of 11
SELECT COUNT("Against") FROM table_20032 WHERE "Difference" = '11'
wikisql
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, ...
Users by Downvotes (top 100).
SELECT * FROM Users ORDER BY DownVotes DESC LIMIT 100
sede
CREATE TABLE table_18820 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
what's the game with date being march 7
SELECT "Game" FROM table_18820 WHERE "Date" = 'March 7'
wikisql
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABL...
what are the four most frequently ordered laboratory tests for patients of age 20s?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 20 AND 29) GROUP BY labevents.itemid) AS ...
mimic_iii
CREATE TABLE table_2155 ( "Country" text, "1948/49 ($ millions)" real, "1949/50 ($ millions)" real, "1950/51 ($ millions)" real, "Cumulative ($ millions)" real )
What's the 1949/50 expenditure (in $ millions) in the country where the 1948/49 expenditure was 232$ millions?
SELECT MAX("1949/50 ($ millions)") FROM table_2155 WHERE "1948/49 ($ millions)" = '232'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
What is the number of patients who died on or before 2148 that had complete heart block as their primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COMPLETE HEART BLOCK" AND demographic.dod_year <= "2148.0"
mimicsql_data
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, ...
what were the five most frequent drugs that were prescribed within 2 months to the hypotension / pressor dependent female patients with age 30s after they have been diagnosed with hypotension / pressor dependent, this year?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hypotension / pressor dependent' AND DATETIME(diag...
eicu
CREATE TABLE table_name_10 ( second_member VARCHAR, year VARCHAR, first_member VARCHAR )
Who is the second member more recently than 1790 when John Williams is the first member?
SELECT second_member FROM table_name_10 WHERE year > 1790 AND first_member = "john williams"
sql_create_context
CREATE TABLE table_16493961_1 ( miles__km_ VARCHAR, date VARCHAR )
Name the miles for june 7
SELECT miles__km_ FROM table_16493961_1 WHERE date = "June 7"
sql_create_context
CREATE TABLE table_67166 ( "Team" text, "Constructor" text, "Motorcycle" text, "Tyre" text, "Rider" text, "Rounds" text )
Anthony West ride which Motorcyle?
SELECT "Motorcycle" FROM table_67166 WHERE "Rider" = 'anthony west'
wikisql
CREATE TABLE table_1507423_5 ( top_10 VARCHAR, position VARCHAR )
How many entries arr there for the top 10 for the 78th position?
SELECT COUNT(top_10) FROM table_1507423_5 WHERE position = "78th"
sql_create_context
CREATE TABLE table_74984 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real )
What is the mean year number where there are more than 0 wins, the class is 250cc, and the points are 95?
SELECT AVG("Year") FROM table_74984 WHERE "Wins" > '0' AND "Class" = '250cc' AND "Points" = '95'
wikisql
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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...
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, could you sort X from high to low order please?
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID DESC
nvbench
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, ...
what is the name of the drug prescribed to patient 66015 in the same hospital encounter after having been diagnosed with hypertension nos during the last month?
SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 66015 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.s...
mimic_iii
CREATE TABLE table_72574 ( "Position" text, "Number" real, "Name" text, "Height" text, "Weight" text, "Class" text, "Hometown" text, "Games\u2191" real )
How many players were 6'1' and from Columbia, South Carolina?
SELECT COUNT("Position") FROM table_72574 WHERE "Height" = '6''1' AND "Hometown" = 'Columbia, South Carolina'
wikisql
CREATE TABLE table_204_710 ( id number, "model" text, "origin" text, "type" text, "versions" text, "in service" text, "notes" text )
what is the only model of these aircraft to originate in canada ?
SELECT "model" FROM table_204_710 WHERE "origin" = 'canada'
squall
CREATE TABLE table_21370 ( "Official Name" text, "Status" text, "Area km 2" text, "Population" real, "Census Ranking" text )
What are the census ranking(s) for a population of 284?
SELECT "Census Ranking" FROM table_21370 WHERE "Population" = '284'
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...
查一下给患者云学博开315832这个药的医院有哪些
SELECT qtb.MED_SER_ORG_NO FROM qtb WHERE qtb.PERSON_NM = '云学博' AND qtb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_CD = '315832') UNION SELECT gyb.MED_SER_ORG_NO FROM gyb WHERE gyb.PERSON_NM = '云学博' AND gyb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SO...
css
CREATE TABLE table_71643 ( "Year" real, "English title" text, "Original title" text, "Country" text, "Director(s)" text )
What is the original title of the film from Japan/Taiwan before 2003?
SELECT "Original title" FROM table_71643 WHERE "Year" < '2003' AND "Country" = 'japan/taiwan'
wikisql
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int...
Find the minimum gpa of all students in each department with a pie chart.
SELECT DEPT_CODE, MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE
nvbench
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...
哪些名称相同的药品医疗是就诊74972041144和医疗就诊38400798086中开出的?列出这些药品的名称和金额都是多少?对应的医疗就诊ID是多少?
SELECT SOC_SRT_DIRE_NM, AMOUNT, MED_CLINIC_ID FROM t_kc22 WHERE (MED_CLINIC_ID = '74972041144' OR MED_CLINIC_ID = '38400798086') AND SOC_SRT_DIRE_NM IN ((SELECT SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '74972041144') INTERSECT (SELECT SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '38400798086'))
css
CREATE TABLE Accounts ( Account_ID INTEGER, Statement_ID INTEGER, Account_Details VARCHAR(255) ) CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255) ) CREATE TABLE Statements ( Statement_ID INTEGER, Statement_Details VARCHAR(255) ) CREATE TABLE Documents_with_Expenses...
Give me a bar chart for the total number of each budget type code, and rank from high to low by the X please.
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code ORDER BY Budget_Type_Code DESC
nvbench
CREATE TABLE table_58453 ( "NGC number" real, "Object type" text, "Constellation" text, "Right ascension ( J2000 )" text, "Declination ( J2000 )" text )
what is the declination (j2000) when the ngc number is higher than 3593?
SELECT "Declination ( J2000 )" FROM table_58453 WHERE "NGC number" > '3593'
wikisql
CREATE TABLE table_41012 ( "Bowl Game" text, "Date" text, "Stadium" text, "City" text, "Television" text, "Conference Matchups" text, "Payout ( US$ )" text )
What was the payout in US dollars at the Insight Bowl?
SELECT "Payout ( US$ )" FROM table_41012 WHERE "Bowl Game" = 'insight bowl'
wikisql
CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num_Employees real ) CREATE TABLE head ( head_ID int, name text, born_state text, age real ) CREATE TABLE management ( department_ID int, head_ID int, tempor...
Plot the average of budget in billions over creation in a line chart, and order by the Creation in descending.
SELECT Creation, AVG(Budget_in_Billions) FROM department GROUP BY Creation ORDER BY Creation DESC
nvbench