context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, Cr...
accept rate, for positive-scoring q/a, users with rep from elsewhere.
SELECT CAST(SUM(hasAccepted) AS FLOAT) / COUNT(acc.Id) AS ratio, COUNT(acc.Id) AS numQuestions, SUM(hasAccepted) AS numAccepts FROM (SELECT fq.Id AS id, CASE WHEN SUM(CASE WHEN a.Score > 0 THEN 1 ELSE 0 END) > 0 THEN 1 ELSE 0 END AS hasPositiveAnswer, CASE WHEN COUNT(fq.accepted) > 0 THEN 1 ELSE 0 END AS hasAccepted FR...
sede
CREATE TABLE table_21022 ( "Date" text, "Time" text, "ACC Team" text, "Big Ten Team" text, "Location" text, "Television" text, "Attendance" real, "Winner" text, "Challenge Leader" text )
Who won the game where the Challenge Leader is ACC (2-1)?
SELECT "Winner" FROM table_21022 WHERE "Challenge Leader" = 'ACC (2-1)'
wikisql
CREATE TABLE table_54911 ( "Rd #" real, "Pick #" real, "Player" text, "Team (League)" text, "Reg GP" real, "Pl GP" real )
Which Player has a PI GP over 0 and a Rd # of 1?
SELECT "Player" FROM table_54911 WHERE "Pl GP" > '0' AND "Rd #" = '1'
wikisql
CREATE TABLE table_name_46 ( previous_conference VARCHAR, year_joined VARCHAR, mascot VARCHAR )
what is the previous conference when the year joined is 1932 and the mascot is tigers?
SELECT previous_conference FROM table_name_46 WHERE year_joined = "1932" AND mascot = "tigers"
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, show me about the distribution of founder and the amount of founder , and group by attribute founder in a bar chart, and sort by the X from high to low.
SELECT Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder DESC
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is age and discharge time of subject id 74032?
SELECT demographic.age, demographic.dischtime FROM demographic WHERE demographic.subject_id = "74032"
mimicsql_data
CREATE TABLE table_204_601 ( id number, "area served" text, "city of license" text, "vc" number, "rf" number, "callsign" text, "network" text, "notes" text )
how many areas have at least 5 stations ?
SELECT COUNT(*) FROM (SELECT "area served" FROM table_204_601 GROUP BY "area served" HAVING COUNT(*) >= 5)
squall
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
has patient 004-54892 received a antihypertensive drug - labetalol procedure at other hospitals?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '004-54892' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '004-54892' AND patient.hospitaldischargetime IS NULL)) AND tr...
eicu
CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) CREATE TABLE Documents ( Document_ID INTEGER, Document_Type_Code CHAR(15), Project_ID INTEGER, Document_Date DATETIME, Document_Name VARCHAR(255), ...
Show the number of document type for different document type description in a bar chart, and show y-axis in ascending order.
SELECT Document_Type_Description, COUNT(Document_Type_Description) FROM Ref_Document_Types GROUP BY Document_Type_Description ORDER BY COUNT(Document_Type_Description)
nvbench
CREATE TABLE table_16724844_1 ( mens_40 VARCHAR, mens_u20 VARCHAR )
What were the results for mens 40 when the mens u20 was Southern Suns def Gold Coast Sharks?
SELECT mens_40 FROM table_16724844_1 WHERE mens_u20 = "Southern Suns def Gold Coast Sharks"
sql_create_context
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 minimum age of patients whose marital status is divorced and primary disease is angioedema?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.diagnosis = "ANGIOEDEMA"
mimicsql_data
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, ...
Find user pairs who accepted answers from each other.
WITH accepter_acceptee(a, b) AS (SELECT q.OwnerUserId, a.OwnerUserId FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE q.PostTypeId = 1 AND q.OwnerUserId != a.OwnerUserId), collaborations(a, b, type) AS (SELECT a, b, '>' FROM accepter_acceptee UNION ALL SELECT b, a, '<' FROM accepter_acceptee) SE...
sede
CREATE TABLE t_kc21 ( 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, ...
列出编号16771614711的医疗就诊中,所有开出的药品里自付金额高于5485.87元的那些药品
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '16771614711' AND t_kc22.OVE_SELF_AMO > 5485.87
css
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 COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE DEPARTME...
How many departments are in each school Show bar chart, and show y-axis in ascending order.
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY COUNT(DISTINCT DEPT_NAME)
nvbench
CREATE TABLE payments ( payment_id number, settlement_id number, payment_method_code text, date_payment_made time, amount_payment number ) CREATE TABLE claims ( claim_id number, policy_id number, date_claim_made time, date_claim_settled time, amount_claimed number, amount_se...
Which kind of policy type was chosen by the most customers?
SELECT policy_type_code FROM customer_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
give me the number of patients whose primary disease is hypertension;rule out coronary artery disease\cardiac cath and year of birth is less than 2110?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH" AND demographic.dob_year < "2110"
mimicsql_data
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE cost ( row_id number, ...
how much does diagnosing long-term use of insulin cost?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'long-term use of insulin'))
mimic_iii
CREATE TABLE accounts ( account_id number, customer_id number, account_name text, other_account_details text ) CREATE TABLE customers_cards ( card_id number, customer_id number, card_type_code text, card_number text, date_valid_from time, date_valid_to time, other_card_detai...
What are the account ids, customer ids, and account names for all the accounts?
SELECT account_id, customer_id, account_name FROM accounts
spider
CREATE TABLE table_203_830 ( id number, "year" number, "song" text, "chart positions\nus country" number, "chart positions\ncan country" number, "album" text )
which song had the highest us country position ?
SELECT "song" FROM table_203_830 ORDER BY "chart positions\nus country" LIMIT 1
squall
CREATE TABLE table_name_85 ( home_team VARCHAR, game VARCHAR )
Which Home team has a Game of game 5?
SELECT home_team FROM table_name_85 WHERE game = "game 5"
sql_create_context
CREATE TABLE table_name_81 ( peak INTEGER, track VARCHAR, year VARCHAR )
What number did Mo o Negro peak at before 1996?
SELECT MAX(peak) FROM table_name_81 WHERE track = "moño negro" AND year < 1996
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
what is lab test fluid of subject name kelly gallardo?
SELECT lab.fluid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Kelly Gallardo"
mimicsql_data
CREATE TABLE table_27374004_4 ( date_of_appointment VARCHAR, replaced_by VARCHAR )
When was the date of appointment by Hugo Broos?
SELECT date_of_appointment FROM table_27374004_4 WHERE replaced_by = "Hugo Broos"
sql_create_context
CREATE TABLE table_name_2 ( date VARCHAR, home_team VARCHAR )
On which date was St Kilda the home team?
SELECT date FROM table_name_2 WHERE home_team = "st kilda"
sql_create_context
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE month ( ...
how about a flight from MILWAUKEE to ST. LOUIS that leaves monday night
SELECT DISTINCT flight_id FROM flight WHERE (((((departure_time <= 2400 AND departure_time >= 1800) AND 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 = 21 AND DATE_DAYalias0...
atis
CREATE TABLE table_13241993_3 ( title VARCHAR, part_3 VARCHAR )
What's the name of the episode whose part 3 aired on February 7, 2008?
SELECT title FROM table_13241993_3 WHERE part_3 = "February 7, 2008"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
give me the number of patients with drug code lido2/5j who had urine lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "LIDO2/5J" AND lab.fluid = "Urine"
mimicsql_data
CREATE TABLE table_24110 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Black Knights points" real, "Opponents" real, "Record" text )
Name the date for game 8
SELECT "Date" FROM table_24110 WHERE "Game" = '8'
wikisql
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
what was the last hospital admissions type of patient 4288 during this year?
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 4288 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE table_name_17 ( position VARCHAR, round VARCHAR, school_club_team VARCHAR )
What is the position of the player with a round less than 20 from the school/club Washington?
SELECT position FROM table_name_17 WHERE round < 20 AND school_club_team = "washington"
sql_create_context
CREATE TABLE table_24399615_8 ( airdate VARCHAR, bbc_three_weekly_ranking VARCHAR )
When 3 is the bbc three weekly ranking what is the airdate?
SELECT airdate FROM table_24399615_8 WHERE bbc_three_weekly_ranking = "3"
sql_create_context
CREATE TABLE table_28068063_2 ( aggregate_score VARCHAR, winners VARCHAR )
What was the aggregate score for the match won by Brive?
SELECT aggregate_score FROM table_28068063_2 WHERE winners = "Brive"
sql_create_context
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE prescriptions ( row_id number, subject_id number,...
how many times patient 1902 has had tpn d17.0 taken on this month/30?
SELECT COUNT(*) 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 = 1902)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tpn d17.0' AN...
mimic_iii
CREATE TABLE table_66051 ( "Round (Leg)" text, "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
What date has 3 as the round (leg)?
SELECT "Date" FROM table_66051 WHERE "Round (Leg)" = '3'
wikisql
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_40...
Give me the comparison about meter_100 over the Time by a bar chart.
SELECT Time, meter_100 FROM swimmer
nvbench
CREATE TABLE table_204_448 ( id number, "team" text, "winners" number, "runners-up" number, "years won" text, "years runner-up" text )
what 's the number of teams that won the cup four times ?
SELECT COUNT("team") FROM table_204_448 WHERE "winners" = 4
squall
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
从零五年二月九日到一七年二月九日的这几年来,共有多少患者在医疗机构3982250外地门诊就诊
SELECT COUNT(*) FROM mzjzjlb JOIN hz_info_mzjzjlb JOIN hz_info ON hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.mzjzjlb_id = mzjzjlb.mzjzjlb_id AND hz_info_mzjzjlb.YLJGDM = hz_info.YLJGDM WHERE hz_info.YLJGDM = '39...
css
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) ...
Show id from each meter 300, and I want to show from low to high by the y axis please.
SELECT meter_300, ID FROM swimmer ORDER BY ID
nvbench
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE icustays ( row_id number, s...
how many patients received fiber-optic bronchoscopy during the same month after having been diagnosed with acidosis, the last year?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'acidosis') AND DAT...
mimic_iii
CREATE TABLE table_name_9 ( position VARCHAR, nationality VARCHAR, player VARCHAR )
Which position has a Nationality of united states, and a Player of roger powell?
SELECT position FROM table_name_9 WHERE nationality = "united states" AND player = "roger powell"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
how many patients underwent oxygen therapy (40% to 60%) within 2 months after they were diagnosed with pneumonia?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pneumonia') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON tre...
eicu
CREATE TABLE table_69608 ( "Rank" real, "City" text, "Titles" real, "Winning Clubs" text, "Last victory" real )
What is the number of titles for the city of gy r with a rank larger than 4?
SELECT SUM("Titles") FROM table_69608 WHERE "City" = 'győr' AND "Rank" > '4'
wikisql
CREATE TABLE table_name_98 ( opponent VARCHAR, week VARCHAR )
In Week 13, who was the opponent?
SELECT opponent FROM table_name_98 WHERE week = 13
sql_create_context
CREATE TABLE table_name_78 ( round INTEGER, player VARCHAR, pick VARCHAR, position VARCHAR )
What is the highest round of Ed Smith, who had a pick higher than 261 and played halfback?
SELECT MAX(round) FROM table_name_78 WHERE pick < 261 AND position = "halfback" AND player = "ed smith"
sql_create_context
CREATE TABLE table_73570 ( "Rank by average" real, "Place" real, "Couple" text, "Number Of Dances" real, "Total Points Earned" real, "Average" text )
What is the name of the couple if the total points earned is 161?
SELECT "Couple" FROM table_73570 WHERE "Total Points Earned" = '161'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
get the number of patients younger than 36 years who were discharged to home health care.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.age < "36"
mimicsql_data
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, ...
has there ever been any type of microbiology test done on patient 99080's staph aureus screen until 95 months ago?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99080) AND microbiologyevents.spec_type_desc = 'staph aureus screen' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-95 month')
mimic_iii
CREATE TABLE table_name_54 ( series VARCHAR, winning_team VARCHAR, sport VARCHAR )
Which Series has a Winning team of iowa state and a Sport of w basketball?
SELECT series FROM table_name_54 WHERE winning_team = "iowa state" AND sport = "w basketball"
sql_create_context
CREATE TABLE table_74481 ( "Date" text, "Track" text, "Event Name" text, "Pole Winner" text, "Race Winner" text )
Tell me the track for june 9
SELECT "Track" FROM table_74481 WHERE "Date" = 'june 9'
wikisql
CREATE TABLE table_38826 ( "Make/ Model" text, "Length" text, "Year" real, "Numbers (Quantity Ordered)" text, "Fuel Propulsion" text, "Year Retired" text )
What year was the diesel fuel propulsion, with a length of 40', and numbers (quanity ordered) of 3701-3729 (29 buses), retired?
SELECT "Year Retired" FROM table_38826 WHERE "Fuel Propulsion" = 'diesel' AND "Length" = '40' AND "Numbers (Quantity Ordered)" = '3701-3729 (29 buses)'
wikisql
CREATE TABLE table_name_30 ( score VARCHAR, series VARCHAR, opponent VARCHAR, game VARCHAR )
Opponent of @ edmonton oilers, and a Game larger than 1, and a Series of oilers lead 3 2 had what score?
SELECT score FROM table_name_30 WHERE opponent = "@ edmonton oilers" AND game > 1 AND series = "oilers lead 3–2"
sql_create_context
CREATE TABLE performance ( songid number, bandmate number, stageposition text ) CREATE TABLE songs ( songid number, title text ) CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE instruments ( songid number, bandmateid numb...
Hom many musicians performed in the song 'Flash'?
SELECT COUNT(*) FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T3.title = "Flash"
spider
CREATE TABLE type_of_restaurant ( resid number, restypeid number ) CREATE TABLE restaurant_type ( restypeid number, restypename text, restypedescription text ) CREATE TABLE visits_restaurant ( stuid number, resid number, time time, spent number ) CREATE TABLE restaurant ( resi...
How long does student Linda Smith spend on the restaurant in total?
SELECT SUM(spent) FROM student JOIN visits_restaurant ON student.stuid = visits_restaurant.stuid WHERE student.fname = "Linda" AND student.lname = "Smith"
spider
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId num...
Question States over Time (Percent).
WITH Batches AS (SELECT DATEADD(mm, DATEPART(mm, Post.CreationDate) - 1, DATEADD(yy, DATEPART(yyyy, Post.CreationDate) - 1900, 0)) AS "date", COUNT(*) AS Total, SUM(CASE WHEN NOT Post.LastEditorUserId IS NULL THEN 1 ELSE 0 END) AS "edited" FROM Posts AS Post GROUP BY DATEPART(yyyy, Post.CreationDate), DATEPART(mm, Post...
sede
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, ...
How many JavaScript questions are answered by jsfiddle or jsbin.
SELECT COUNT(*) FROM Posts AS q JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE q.Tags LIKE '%javascript%' AND (a.Body LIKE '%http://jsbin.com/%' OR a.Body LIKE '%http://jsfiddle.net/%')
sede
CREATE TABLE membership_register_branch ( Member_ID int, Branch_ID text, Register_Year text ) CREATE TABLE branch ( Branch_ID int, Name text, Open_year text, Address_road text, City text, membership_amount text ) CREATE TABLE purchase ( Member_ID int, Branch_ID text, Ye...
Show me the proportion of cities of the branch table with a pie chart.
SELECT City, COUNT(City) FROM branch GROUP BY City
nvbench
CREATE TABLE SportsInfo ( StuID INTEGER, SportName VARCHAR(32), HoursPerWeek INTEGER, GamesPlayed INTEGER, OnScholarship VARCHAR(1) ) CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), F...
How many students play each sport. Show bar chart.
SELECT SportName, COUNT(*) FROM SportsInfo GROUP BY SportName
nvbench
CREATE TABLE table_976 ( "Quarter" text, "Android" text, "iOS" text, "Symbian" text, "BlackBerry OS" text, "Linux" text, "Windows Phone" text, "Other" text, "Total" text )
How man 'other' millions of smartphones were shipped when 181.1 million total were shipped?
SELECT COUNT("Other") FROM table_976 WHERE "Total" = '181.1'
wikisql
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
what is average age of patients whose gender is f and admission type is emergency?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.admission_type = "EMERGENCY"
mimicsql_data
CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_des...
A bar chart shows the distribution of personal_name and author_id .
SELECT personal_name, author_id FROM Course_Authors_and_Tutors ORDER BY personal_name
nvbench
CREATE TABLE table_27040 ( "\u2116" real, "#" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
What is the title of the episode directed by Charles Beeson?
SELECT "Title" FROM table_27040 WHERE "Directed by" = 'Charles Beeson'
wikisql
CREATE TABLE country ( country_id number, country_name text, capital text, official_native_language text ) CREATE TABLE match_season ( season number, player text, position text, country number, team number, draft_pick_number number, draft_class text, college text ) CREA...
How many distinct official languages are there among countries of players whose positions are defenders.
SELECT COUNT(DISTINCT T1.official_native_language) FROM country AS T1 JOIN match_season AS T2 ON T1.country_id = T2.country WHERE T2.position = "Defender"
spider
CREATE TABLE table_204_772 ( id number, "team" text, "county" text, "wins" number, "years won" number )
what is the years won for each team
SELECT "years won" FROM table_204_772
squall
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 ) ...
look for the primary disease and diagnoses icd9 code for patient ida cook.
SELECT demographic.diagnosis, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Ida Cook"
mimicsql_data
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
Are there 4 -credit courses that are BIOLCHEM ?
SELECT DISTINCT name, number FROM course WHERE department = 'BIOLCHEM' AND credits = 4
advising
CREATE TABLE table_name_5 ( away_team VARCHAR, home_team VARCHAR )
What was the away teams score when Hawthorn played as the home team?
SELECT away_team AS score FROM table_name_5 WHERE home_team = "hawthorn"
sql_create_context
CREATE TABLE table_name_19 ( entrant VARCHAR, year VARCHAR, chassis VARCHAR )
What is the entrant earlier than 1956 with a Vanwall Special chassis?
SELECT entrant FROM table_name_19 WHERE year < 1956 AND chassis = "vanwall special"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
how many patients whose diagnoses long title is other and unspecified noninfectious gastroenteritis and colitis and lab test abnormal status is delta?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Other and unspecified noninfectious gastroenteritis and colitis" AND lab.flag = "delta"
mimicsql_data
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...
count the number of patients whose procedure long title is thoracentesis.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Thoracentesis"
mimicsql_data
CREATE TABLE table_name_31 ( format VARCHAR, city_of_license VARCHAR, frequency VARCHAR )
Which format is in St. George with a frequency of 0 107.3 fm?
SELECT format FROM table_name_31 WHERE city_of_license = "st. george" AND frequency = "0 107.3 fm"
sql_create_context
CREATE TABLE table_19527 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
Which title did Neil Affleck direct?
SELECT "Title" FROM table_19527 WHERE "Directed by" = 'Neil Affleck'
wikisql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE...
For all employees who have the letters D or S in their first name, show me the trend about manager_id over hire_date with a line chart, show by the x-axis in descending.
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE table_9844 ( "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 on october 23?
SELECT "Score" FROM table_9844 WHERE "Date" = 'october 23'
wikisql
CREATE TABLE table_61054 ( "Role" text, "Original Broadway cast" text, "Closing Broadway cast" text, "Original US Tour cast" text, "Original NonEquity Tour cast" text, "Original S\u00e3o Paulo cast" text, "Original Lima cast" text )
Which role had a closing broadway cast of Adam Grupper?
SELECT "Role" FROM table_61054 WHERE "Closing Broadway cast" = 'adam grupper'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
列出编码为5675709的医院中根据入院诊断疾病编码,不同疾病的平均患者年龄都是多大?
SELECT t_kc21.IN_DIAG_DIS_CD, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5675709' GROUP BY t_kc21.IN_DIAG_DIS_CD
css
CREATE TABLE t_kc21 ( 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, ...
在医院7830669中,根据出院诊断疾病编码列出不同疾病的患者平均年龄是多少岁
SELECT t_kc21.OUT_DIAG_DIS_CD, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '7830669' GROUP BY t_kc21.OUT_DIAG_DIS_CD
css
CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(10), customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80) ) CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INT...
List the order id, customer id for orders in Cancelled status, ordered by their order dates with a scatter chart.
SELECT order_id, customer_id FROM Customer_Orders WHERE order_status_code = "Cancelled" ORDER BY order_date
nvbench
CREATE TABLE table_name_91 ( week VARCHAR, result VARCHAR )
Which week had a result of L 38-21?
SELECT week FROM table_name_91 WHERE result = "l 38-21"
sql_create_context
CREATE TABLE table_70419 ( "Name" text, "Born" text, "Age at first step" text, "Mission" text, "Lunar EVA dates" text, "Service" text )
Pete Conrad was on the Apollo 12 mission but also had what Lunar EVA dates?
SELECT "Lunar EVA dates" FROM table_70419 WHERE "Mission" = 'apollo 12' AND "Name" = 'pete conrad'
wikisql
CREATE TABLE table_1862 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
When 'c'est la vinnie' is the title what is the air date?
SELECT "Original air date" FROM table_1862 WHERE "Title" = 'C''est la Vinnie'
wikisql
CREATE TABLE table_name_73 ( sales__billion_ INTEGER, company VARCHAR )
What is BP's lowest sales?
SELECT MIN(sales__billion_) AS $_ FROM table_name_73 WHERE company = "bp"
sql_create_context
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(4...
For those employees who was hired before 2002-06-21, a line chart shows the change of employee_id over hire_date
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
nvbench
CREATE TABLE table_7050 ( "English country name" text, "Arabic romanised country name" text, "Arabic country name" text, "English capital name" text, "Arabic romanised capital name" text, "Arabic capital name" text )
What is the name of the country in Arabic that has Moroni as the name of its capital in English?
SELECT "Arabic country name" FROM table_7050 WHERE "English capital name" = 'moroni'
wikisql
CREATE TABLE table_27772 ( "City/ municipality" text, "Type" text, "No. of Barangays" real, "Population (2010)" real, "Area (km\u00b2)" text, "Pop. density (per km\u00b2)" real, "Income Class" text, "Zip Code" real )
What is the area where population in 2010 is 38062?
SELECT "Area (km\u00b2)" FROM table_27772 WHERE "Population (2010)" = '38062'
wikisql
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...
what is average age of patients whose discharge location is home health care and primary disease is gastrointestinal bleed?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.diagnosis = "GASTROINTESTINAL BLEED"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
provide the number of patients whose admission location is emergency room admit and days of hospital stay is greater than 3?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.days_stay > "3"
mimicsql_data
CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_ci...
Show first name and id for all customers with at least 2 accounts in a bar chart, and could you rank by the customer_first_name in asc?
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.customer_first_name
nvbench
CREATE TABLE table_43578 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Box Score" text, "Report" text )
What is the box score type for the game that has a score of 103-101?
SELECT "Box Score" FROM table_43578 WHERE "Score" = '103-101'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
连花清瘟胶囊的剂型和规格在医疗就诊04201709947中是哪一种?
SELECT t_kc22.DOSE_FORM, t_kc22.SPEC FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '04201709947' AND t_kc22.SOC_SRT_DIRE_NM = '连花清瘟胶囊'
css
CREATE TABLE table_61306 ( "Team" text, "2003\u201304 Pts" text, "2004\u201305 Pts" text, "2005\u201306 Pts" real, "Total Pts" real, "Total Pld" real )
Which Total Pld has a 2005 06 Pts of 27?
SELECT MAX("Total Pld") FROM table_61306 WHERE "2005\u201306 Pts" = '27'
wikisql
CREATE TABLE table_18304058_2 ( nickname_s_ VARCHAR, enrollment__2013_14_ VARCHAR )
What is the nickname of the team whose 2013/2014 enrollment is 436?
SELECT nickname_s_ FROM table_18304058_2 WHERE enrollment__2013_14_ = 436
sql_create_context
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...
在2009-05-30到2018-11-28的这几年里,查一下医疗机构8228050开出多少检验报告单
SELECT COUNT(*) FROM jybgb WHERE YLJGDM = '8228050' AND BGRQ BETWEEN '2009-05-30' AND '2018-11-28'
css
CREATE TABLE table_name_14 ( route VARCHAR, distance VARCHAR )
Name the route for 170.8km distance
SELECT route FROM table_name_14 WHERE distance = "170.8km"
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
during their current hospital encounter, patient 013-33898 has been allergic to any substance?
SELECT COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-33898' AND patient.hospitaldischargetime IS NULL))
eicu
CREATE TABLE table_name_25 ( bronze INTEGER, total VARCHAR, silver VARCHAR )
What's the average bronze with a total number of medals being 1, with more than 0 silvers?
SELECT AVG(bronze) FROM table_name_25 WHERE total = 1 AND silver > 0
sql_create_context
CREATE TABLE table_44964 ( "Name" text, "Built" text, "Listed" text, "Location" text, "County" text )
When was the historic place listed that's in canyon county?
SELECT "Listed" FROM table_44964 WHERE "County" = 'canyon'
wikisql
CREATE TABLE table_26951 ( "Name" text, "Position" text, "Period" text, "Appearances\u00b9" real, "Goals\u00b9" real, "Nationality\u00b2" text )
Name the goals for daniel sanchez
SELECT "Goals\u00b9" FROM table_26951 WHERE "Name" = 'Daniel Sanchez'
wikisql
CREATE TABLE zzmzjzjlb ( 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, MZZYZDZ...
看看零六年十月三十一日到一四年六月十九日医疗机构5872925外地门诊有多少次就诊记录
SELECT COUNT(*) FROM zzmzjzjlb WHERE zzmzjzjlb.YLJGDM = '5872925' AND zzmzjzjlb.JZKSRQ BETWEEN '2006-10-31' AND '2014-06-19' AND zzmzjzjlb.WDBZ > 0 UNION SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '5872925' AND fzzmzjzjlb.JZKSRQ BETWEEN '2006-10-31' AND '2014-06-19' AND fzzmzjzjlb.WDBZ > 0
css
CREATE TABLE table_name_44 ( area_president__quorum_ VARCHAR, area_name VARCHAR )
Name the area president when the area name is south america south
SELECT area_president__quorum_ FROM table_name_44 WHERE area_name = "south america south"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
provide the admission location of tracy farmer.
SELECT demographic.admission_location FROM demographic WHERE demographic.name = "Tracy Farmer"
mimicsql_data