context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_86 ( school VARCHAR, year_joined VARCHAR, mascot VARCHAR )
Which School has a Year Joined larger than 1926, and a Mascot of vikings?
SELECT school FROM table_name_86 WHERE year_joined > 1926 AND mascot = "vikings"
sql_create_context
CREATE TABLE table_21186 ( "Episode number" real, "Episode" text, "Rating" text, "Share" real, "Rating/Share (18-49)" text, "Viewers (millions)" text, "Rank (Overall)" text )
What was the rating of episode titled '110'?
SELECT "Rating" FROM table_21186 WHERE "Episode" = '110'
wikisql
CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) 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 Faculty_Participates_in ( FacID INTEGER...
Show the number of male and female assistant professors Plot them as bar chart, display in descending by the X-axis.
SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex ORDER BY Sex DESC
nvbench
CREATE TABLE table_75306 ( "Source" text, "Date" text, "Blagojevich (D)" text, "Topinka (R)" text, "Remainder" text )
Which Topinka happened on january 22, 2006?
SELECT "Topinka (R)" FROM table_75306 WHERE "Date" = 'january 22, 2006'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
in 05/last year was lasix prescribed to patient 021-32860?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-32860')) AND medication.drugname = 'lasix' AND DATETIME(medication.dru...
eicu
CREATE TABLE mzb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
定点医疗机构中医疗就诊65701713769的编码是多少?
SELECT qtb.FLX_MED_ORG_ID FROM qtb WHERE qtb.MED_CLINIC_ID = '65701713769' UNION SELECT gyb.FLX_MED_ORG_ID FROM gyb WHERE gyb.MED_CLINIC_ID = '65701713769' UNION SELECT zyb.FLX_MED_ORG_ID FROM zyb WHERE zyb.MED_CLINIC_ID = '65701713769' UNION SELECT mzb.FLX_MED_ORG_ID FROM mzb WHERE mzb.MED_CLINIC_ID = '65701713769'
css
CREATE TABLE Catalog_Structure ( catalog_level_number INTEGER, catalog_id INTEGER, catalog_level_name VARCHAR(50) ) CREATE TABLE Catalog_Contents_Additional_Attributes ( catalog_entry_id INTEGER, catalog_level_number INTEGER, attribute_id INTEGER, attribute_value VARCHAR(255) ) CREATE TABL...
A bar chart for finding the number of the names of catalog entries with level number 8, and I want to show x-axis in desc order.
SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY catalog_entry_name DESC
nvbench
CREATE TABLE table_16934 ( "Date" text, "Tournament" text, "Location" text, "Purse( $ )" real, "Winner" text, "Score" text, "1st Prize( $ )" real )
what's the winner with purse( $ ) value of bigger than 964017.2297960471 and date value of may 28
SELECT "Winner" FROM table_16934 WHERE "Purse( $ )" > '964017.2297960471' AND "Date" = 'May 28'
wikisql
CREATE TABLE table_name_99 ( team_1 VARCHAR, team_2 VARCHAR )
What is team 1 if Renova is team 2?
SELECT team_1 FROM table_name_99 WHERE team_2 = "renova"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
during their last hospital visit when did patient 025-51835 first receive the chloride test?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-51835' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala...
eicu
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, ...
count the number of patients whose admission location is trsf within this facility and drug code is ketr30i?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.formulary_drug_cd = "KETR30I"
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...
患者14484033在被门诊诊断为患有帕金森病性痴呆(震颤麻痹性痴呆)的时候其检测指标353555的结果定量及其单位都是什么?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jybgb_jyjgzbb.Y...
css
CREATE TABLE Product_Categories ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19,4) ) CREATE TABLE Financial_Transactions ( transaction_id INTEGER, account_id INTEGER, invoice_number INTEGER, transaction_type VARCHAR(15), transaction_date D...
Show the relationship between number of accounts and customer id in a scatter chart.
SELECT T1.customer_id, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
nvbench
CREATE TABLE table_45873 ( "Region" text, "Host" text, "Venue" text, "City" text, "State" text )
Which region has Stanford University as host?
SELECT "Region" FROM table_45873 WHERE "Host" = 'stanford university'
wikisql
CREATE TABLE table_4595 ( "Name" text, "Bullet" text, "Length" text, "Base" text, "Shoulder" text, "Neck" text )
Which length has a Bullet of 6.5 (.257)?
SELECT "Length" FROM table_4595 WHERE "Bullet" = '6.5 (.257)'
wikisql
CREATE TABLE table_36784 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Which Surface has an Opponent of kerry melville reid, and a Score of 6 3, 2 6, 3 6?
SELECT "Surface" FROM table_36784 WHERE "Opponent" = 'kerry melville reid' AND "Score" = '6–3, 2–6, 3–6'
wikisql
CREATE TABLE table_name_41 ( teams VARCHAR, season VARCHAR )
Which teams were in the 2006-07 season?
SELECT teams FROM table_name_41 WHERE season = "2006-07"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, pa...
how many hours have elapsed since the first time on their current hospital visit patient 012-31752 was diagnosed with nutritional deficiency?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnosis.diagnosistime)) FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-31752...
eicu
CREATE TABLE table_name_43 ( years VARCHAR, name VARCHAR, decile VARCHAR, authority VARCHAR )
Which years have a Decile of 4, an Authority of state, and a Name of mapiu school?
SELECT years FROM table_name_43 WHERE decile = 4 AND authority = "state" AND name = "mapiu school"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
out of total number of patients with unspecified/unknown ethnic origin, calculate the number of those who were divorced
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.ethnicity = "UNKNOWN/NOT SPECIFIED"
mimicsql_data
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 cost ( costid num...
on their first hospital visit was patient 002-17195 prescribed famotidine?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-17195' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient....
eicu
CREATE TABLE table_20184 ( "Class" text, "Wheel Arrangement" text, "Railway" text, "Number at Doncaster" real, "Number at Pyewipe" real, "Number at March" real )
Name the number of wheel arrangement when class is d14
SELECT COUNT("Wheel Arrangement") FROM table_20184 WHERE "Class" = 'D14'
wikisql
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
What is the proportion of average weights for each sex?
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex
nvbench
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )...
flights from BOSTON to PITTSBURGH
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBU...
atis
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
how many patients who died were procedured for implant of pulsation balloon?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "1" AND procedures.long_title = "Implant of pulsation balloon"
mimicsql_data
CREATE TABLE table_53117 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What was the date of the game when the Lightning had a record of 9 8 1?
SELECT "Date" FROM table_53117 WHERE "Record" = '9–8–1'
wikisql
CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15), unit_price DECIMAL(19,4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20) ) CREATE TABLE Financial_Transactions ( transaction_id INTEGER, account_id...
Show the relationship between account id and the number of transactions for each account in a scatter chart.
SELECT T1.account_id, COUNT(*) FROM Financial_Transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id
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 ) ...
What is the minimum age of patients whose admission type is new born and have medicare insurance?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.insurance = "Medicare"
mimicsql_data
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE EN...
Return a bar chart on how many departments are in each school?, display in ascending by the names.
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY SCHOOL_CODE
nvbench
CREATE TABLE table_21387 ( "Year (Ceremony)" text, "Film title used in nomination" text, "Original title" text, "Language(s)" text, "Director" text, "Result" text )
Who was the director of the film with the original title of 'The Patience Stone'?
SELECT "Director" FROM table_21387 WHERE "Original title" = 'The Patience Stone'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text,...
patient 013-21980 received a alpha/beta blocker - carvedilol procedure?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-21980')) AND treatment.treatmentname = 'alpha/beta blocker - carvedilol'
eicu
CREATE TABLE table_204_556 ( id number, "rank" number, "athlete" text, "country" text, "time" text, "notes" text )
how long did karin enke took to finish the race ?
SELECT "time" FROM table_204_556 WHERE "athlete" = 'karin enke'
squall
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, ...
Bluemix post count, view count, view/post ratio per day.
SELECT DATE(p.CreationDate) AS pdate, COUNT(*) AS nposts_per_day, SUM(p.ViewCount) AS nviews_per_day, SUM(p.ViewCount) / COUNT(*) AS view_post_ratio FROM Tags JOIN PostTags AS pt ON Tags.Id = pt.TagId JOIN Posts AS p ON pt.PostId = p.Id WHERE Tags.TagName = @TagName GROUP BY DATE(p.CreationDate) ORDER BY pdate DESC LIM...
sede
CREATE TABLE member_attendance ( Member_ID int, Performance_ID int, Num_of_Pieces int ) CREATE TABLE performance ( Performance_ID real, Date text, Host text, Location text, Attendance int ) CREATE TABLE member ( Member_ID text, Name text, Nationality text, Role text )
Show the number of the dates of performances with attending members whose roles are 'Violin', and could you display x-axis in asc order?
SELECT Date, COUNT(Date) FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin" GROUP BY Date ORDER BY Date
nvbench
CREATE TABLE table_63652 ( "Round" text, "Clubs remaining" real, "Clubs involved" real, "Winners from previous round" text, "New entries this round" text, "Leagues entering at this round" text )
How many new entries when the leagues entering in the round are tff third league & turkish regional amateur league?
SELECT "New entries this round" FROM table_63652 WHERE "Leagues entering at this round" = 'tff third league & turkish regional amateur league'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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 te...
葛心怡这个患者之前在哪个医院看病啊
SELECT hz_info_mzjzjlb.YLJGDM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YL...
css
CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pre...
Bar chart x axis date y axis the number of date, and list in asc by the y-axis.
SELECT date, COUNT(date) FROM weather ORDER BY COUNT(date)
nvbench
CREATE TABLE table_78717 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
What is Score, when Venue is Riyadh, Saudi Arabia, and when Result is 'Win'?
SELECT "Score" FROM table_78717 WHERE "Venue" = 'riyadh, saudi arabia' AND "Result" = 'win'
wikisql
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCH...
Show the number of professors who is in office DRE 102 hired in each weekday with a bar chart.
SELECT EMP_HIREDATE, COUNT(EMP_HIREDATE) FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM WHERE T2.PROF_OFFICE = 'DRE 102' GROUP BY EMP_LNAME
nvbench
CREATE TABLE table_name_12 ( location VARCHAR, fatalities VARCHAR, aircraft VARCHAR )
In what location were the fatalities unknown for the Ju-52 aircraft?
SELECT location FROM table_name_12 WHERE fatalities = "unknown" AND aircraft = "ju-52"
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 Tags ( Id number, TagName text, C...
Collect all answer Ids for the Given Question Id.
SELECT Id, Score FROM Posts WHERE ParentId = 2158
sede
CREATE TABLE table_name_91 ( year INTEGER, rank INTEGER )
What's the average year with a rank less than 3?
SELECT AVG(year) FROM table_name_91 WHERE rank < 3
sql_create_context
CREATE TABLE table_name_17 ( population INTEGER, area__km_2__ VARCHAR, code VARCHAR )
What is the average population for an area less than 433.7km and a 23013 code?
SELECT AVG(population) FROM table_name_17 WHERE area__km_2__ < 433.7 AND code = 23013
sql_create_context
CREATE TABLE table_12012 ( "Rider" text, "Horse" text, "Faults" text, "Round 1 + 2A Points" text, "Total" real )
Tell me the horse with faults of 0 when the total is 4.1
SELECT "Horse" FROM table_12012 WHERE "Faults" = '0' AND "Total" = '4.1'
wikisql
CREATE TABLE table_17350255_1 ( year__ceremony_ VARCHAR, original_title VARCHAR )
What was the year when Ch nqi Ch sh ( ) was submitted?
SELECT year__ceremony_ FROM table_17350255_1 WHERE original_title = "Chūnqiū cháshì (春秋茶室)"
sql_create_context
CREATE TABLE table_70591 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Series" text )
Can you tell me the Opponent that has the Series of 4-2?
SELECT "Opponent" FROM table_70591 WHERE "Series" = '4-2'
wikisql
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_...
how much is a LIMOUSINE between DALLAS/FORT WORTH INTERNATIONAL international airport and DALLAS
SELECT DISTINCT ground_service.ground_fare FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND airport.airport_name LIKE 'DALLAS/FORT WORTH INTERNATIONAL' AND city.city_code = airport_service.city_code AND city.city_name = 'DALLAS' AND ground_service.airport...
atis
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number, PostId number, Sc...
Questions That Have An Answer With A Score Higher Than The Accepted Answer.
SELECT q.Id AS QuestionId, q.Title, aa.Score AS AcceptedAnswerScore, Topscore.Maxscore AS HighestAnswerScore, Topscore.Maxscore - aa.Score AS ScoreDifference FROM Posts AS q JOIN Posts AS aa ON q.AcceptedAnswerId = aa.Id JOIN (SELECT a.ParentId, MAX(a.Score) AS Maxscore FROM Posts AS a JOIN Posts AS p ON a.ParentId = p...
sede
CREATE TABLE table_23805 ( "BSE Code" text, "Company" text, "City" text, "GICS Sector" text, "Free float" text, "Index weighting (%" text )
What is every GICS sector for free float of 0.3180?
SELECT "GICS Sector" FROM table_23805 WHERE "Free float" = '0.3180'
wikisql
CREATE TABLE person ( name text, age number, city text, gender text, job text ) CREATE TABLE personfriend ( name text, friend text, year number )
What are the names of all of Bob's friends?
SELECT T1.name FROM person AS T1 JOIN personfriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'
spider
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 patient ( uniquep...
is the value of rbc of patient 009-5001 last measured on the current hospital visit greater than the value first measured on the current hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-5001' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'rbc' O...
eicu
CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_Percentage real ) CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE game ( ...
List the number of games for each away team and group by home team in a stacked bar chart The x-axis is away team, and sort X-axis in desc order.
SELECT Away_team, COUNT(Away_team) FROM game GROUP BY Home_team, Away_team ORDER BY Away_team DESC
nvbench
CREATE TABLE table_79024 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
What is the wins number when the points were smaller than 27, and goals against was 41?
SELECT SUM("Wins") FROM table_79024 WHERE "Points" < '27' AND "Goals against" = '41'
wikisql
CREATE TABLE table_73416 ( "Season no." real, "Series no." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. Viewers (millions)" text )
who are the writers when the production code is 8011?
SELECT "Written by" FROM table_73416 WHERE "Production code" = '8011'
wikisql
CREATE TABLE table_2668378_18 ( party VARCHAR, incumbent VARCHAR )
What party represents the district with john g. jackson?
SELECT party FROM table_2668378_18 WHERE incumbent = "John G. Jackson"
sql_create_context
CREATE TABLE wedding ( male_id VARCHAR, female_id VARCHAR, church_id VARCHAR ) CREATE TABLE people ( people_id VARCHAR, age VARCHAR ) CREATE TABLE church ( name VARCHAR, church_id VARCHAR )
Show the church names for the weddings of all people older than 30.
SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id JOIN church AS T4 ON T4.church_id = T1.church_id WHERE T2.age > 30 OR T3.age > 30
sql_create_context
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 bdmzjzjlb ( CYBQDM text, CYBQ...
王清俊病患的检验报告单对应的检验结果指标均正常的一共有哪些?其检验报告单号是多少?
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '王清俊' AND NOT ...
css
CREATE TABLE table_name_71 ( builder VARCHAR, date VARCHAR )
What is Builder, when Date is 1953?
SELECT builder FROM table_name_71 WHERE date = "1953"
sql_create_context
CREATE TABLE table_10335 ( "Year" real, "Park" text, "Artist" text, "Mintage" real, "Issue Price" text )
What is the sum of all mintage created by Pierre Leduc?
SELECT SUM("Mintage") FROM table_10335 WHERE "Artist" = 'pierre leduc'
wikisql
CREATE TABLE table_name_99 ( event VARCHAR )
WHich in 2010 11 has an Event of autumn gold?
SELECT 2010 AS _11 FROM table_name_99 WHERE event = "autumn gold"
sql_create_context
CREATE TABLE table_name_51 ( team VARCHAR, best VARCHAR )
What Team had a 1:24.152 Best?
SELECT team FROM table_name_51 WHERE best = "1:24.152"
sql_create_context
CREATE TABLE table_33860 ( "Name" text, "Caps" real, "Goals" real, "First cap" text, "Latest cap" text )
Name of rivelino had how many highest caps?
SELECT MAX("Caps") FROM table_33860 WHERE "Name" = 'rivelino'
wikisql
CREATE TABLE table_29364 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text )
Name the replaced by for slaven belupo
SELECT "Replaced by" FROM table_29364 WHERE "Team" = 'Slaven Belupo'
wikisql
CREATE TABLE table_10812938_5 ( player VARCHAR, college VARCHAR )
What player went to Ohio State College?
SELECT player FROM table_10812938_5 WHERE college = "Ohio State"
sql_create_context
CREATE TABLE table_56022 ( "NGC number" real, "Object type" text, "Constellation" text, "Right ascension ( J2000 )" text, "Declination ( J2000 )" text, "Apparent magnitude" real )
Tell me the object type which has an apparent magnitude more than 10.6 and declination of 44 07
SELECT "Object type" FROM table_56022 WHERE "Apparent magnitude" > '10.6' AND "Declination ( J2000 )" = '°44′07″'
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_CLINIC_ID text, MED_DIRE_CD tex...
在06年4月21日到13年11月4日期间这个4162567号医院有几个科室收取的医疗费总额高于6541.72元的啊?
SELECT COUNT(*) FROM (SELECT qtb.MED_ORG_DEPT_CD FROM qtb JOIN t_kc24 ON qtb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '4162567' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2006-04-21' AND '2013-11-04' GROUP BY qtb.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) > 6541.72 UNION SELECT gyb.MED_ORG_DEPT_CD FRO...
css
CREATE TABLE table_203_148 ( id number, "date" text, "name" text, "nationality" text, "tonnage\n(grt)" number, "fate" text )
what was the top -lrb- most frequent -rrb- fate reported for losses ?
SELECT "fate" FROM table_203_148 GROUP BY "fate" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, ...
how many days has elapsed since the last time in their current hospital encounter patient 24132 had received a po2 lab test?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'po2') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24132 AND admissions.disc...
mimic_iii
CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER...
What is the last name of each student who is not allergic to any type of food? Count them with a bar chart, I want to rank in ascending by the bar.
SELECT LName, COUNT(LName) FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = "food") GROUP BY LName ORDER BY LName
nvbench
CREATE TABLE table_9922 ( "Date" text, "Favorable" real, "No Opinion" real, "Unfavorable" real, "Net Favorable" text )
What is the average no opinion score during 1954 November that is more favorable than 35?
SELECT AVG("No Opinion") FROM table_9922 WHERE "Date" = '1954 november' AND "Favorable" > '35'
wikisql
CREATE TABLE table_name_8 ( score VARCHAR, high_assists VARCHAR )
What was the score of the game when Maurice Williams (7) had the high assists?
SELECT score FROM table_name_8 WHERE high_assists = "maurice williams (7)"
sql_create_context
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE patients ( ...
how many times was patient 49176 prescribed erythromycin on the current hospital encounter?
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49176 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'erythromycin'
mimic_iii
CREATE TABLE table_name_38 ( pens VARCHAR, conv VARCHAR, tries VARCHAR, player VARCHAR )
Which pens has 1 tries and matt alexander as a player with conv of 4?
SELECT pens FROM table_name_38 WHERE tries = "1" AND player = "matt alexander" AND conv = "4"
sql_create_context
CREATE TABLE table_name_80 ( extra VARCHAR, year VARCHAR, result VARCHAR )
What event (Extra) in 2002 did the competitor compete in and place 8th?
SELECT extra FROM table_name_80 WHERE year = 2002 AND result = "8th"
sql_create_context
CREATE TABLE table_22297140_3 ( team VARCHAR, replaced_by VARCHAR )
Which team had a manager replaced by Ebrahim Talebi?
SELECT team FROM table_22297140_3 WHERE replaced_by = "Ebrahim Talebi"
sql_create_context
CREATE TABLE table_57295 ( "Rank" real, "Rider" text, "Team" text, "Speed" text, "Time" text )
Name the total number of rank for 348cc petty manx
SELECT COUNT("Rank") FROM table_57295 WHERE "Team" = '348cc petty manx'
wikisql
CREATE TABLE gyb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
把科室6118从一0年二月五日到一九年十二月三日因疾病W66.043需要住院治疗的平均费用查看一下
SELECT AVG(zyb.MED_CLINIC_ID) FROM zyb WHERE zyb.MED_ORG_DEPT_NM = '6118' AND zyb.IN_HOSP_DAYS BETWEEN '2010-02-05' AND '2019-12-03' AND zyb.IN_DIAG_DIS_NM = 'W66.043'
css
CREATE TABLE table_name_80 ( goals INTEGER, name VARCHAR )
How many goals did coe get?
SELECT MIN(goals) FROM table_name_80 WHERE name = "coe"
sql_create_context
CREATE TABLE table_204_526 ( id number, "name" text, "#" number, "position" text, "height" text, "weight" number, "year" text, "home town" text, "high school" text )
how many players are not a junior ?
SELECT COUNT("name") FROM table_204_526 WHERE "year" <> 'junior'
squall
CREATE TABLE table_51067 ( "Round" real, "Pick" real, "Player" text, "Position" text, "College" text )
Which Round has a Player of damon jones?
SELECT SUM("Round") FROM table_51067 WHERE "Player" = 'damon jones'
wikisql
CREATE TABLE table_22355_20 ( nation VARCHAR, olympics VARCHAR, bronze VARCHAR )
What is the nation who won 1 bronze in the Olympics during 1924 1928?
SELECT nation FROM table_22355_20 WHERE olympics = "1924–1928" AND bronze = 1
sql_create_context
CREATE TABLE table_203_215 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text )
what year was itoh 's only victory at the 10,000 m distance .
SELECT "year" FROM table_203_215 WHERE "position" = 1 AND "event" = '10,000m'
squall
CREATE TABLE table_name_12 ( fa_cup_goals INTEGER, total_apps VARCHAR )
what is the fa cup goals when total apps is 10 (4)?
SELECT SUM(fa_cup_goals) FROM table_name_12 WHERE total_apps = "10 (4)"
sql_create_context
CREATE TABLE loan ( loan_id text, loan_type text, cust_id text, branch_id text, amount number ) CREATE TABLE customer ( cust_id text, cust_name text, acc_type text, acc_bal number, no_of_loans number, credit_score number, branch_id number, state text ) CREATE TABLE ...
In how many different cities are banks located?
SELECT COUNT(DISTINCT city) FROM bank
spider
CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cine...
Show me a pie chart for what is total number of show times per dat for each cinema?
SELECT Name, SUM(T1.Show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.Cinema_ID = T2.Cinema_ID GROUP BY T1.Cinema_ID
nvbench
CREATE TABLE nuclear_power_plants ( id text, name text, latitude text, longitude text, country text, status text, reactortype text, reactormodel text, constructionstartat text, operationalfrom text, operationalto text, capacity text, lastupdatedat text, source tex...
What are the planed nuclear power plants and their located countries?
SELECT name, country FROM nuclear_power_plants WHERE status = "Planned"
geonucleardata
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name te...
how many patients were prescribed the drug 0.9% sodium chloride within 2 months after having been diagnosed with diarrhea a year before?
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 = 'diarrhea') AND DAT...
mimic_iii
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
give me the number of patients whose primary disease is abdominal pain and year of death is less than or equal to 2186?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.dod_year <= "2186.0"
mimicsql_data
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NA...
For those employees who was hired before 2002-06-21, show me about the distribution of hire_date and the average of salary bin hire_date by weekday in a bar chart, and display in descending by the Y-axis please.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(SALARY) DESC
nvbench
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE p...
What courses can I take in the Spring or Summer semester to satisfy my MDE requirement ?
SELECT DISTINCT COURSEalias0.department, COURSEalias0.name, COURSEalias0.number, SEMESTERalias0.semester 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, program_course AS PROGRAM_COURSEalias0...
advising
CREATE TABLE table_58614 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
I want the sum of gold for silver being less than 0
SELECT SUM("Gold") FROM table_58614 WHERE "Silver" < '0'
wikisql
CREATE TABLE table_name_37 ( opponent VARCHAR, round VARCHAR, time VARCHAR )
Name the opponent with round of 1 and time of n/a
SELECT opponent FROM table_name_37 WHERE round = "1" AND time = "n/a"
sql_create_context
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...
2020年5月1日到2020年11月26日,编号为3006208的医院的小儿肛肠外科科室涉及到多少医疗费
SELECT SUM(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE MED_SER_ORG_NO = '3006208' AND MED_ORG_DEPT_NM = '小儿肛肠外科') AND CLINIC_SLT_DATE BETWEEN '2020-05-01' AND '2020-11-26'
css
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimme...
Bar graph to show meter_100 from different meter 700, list meter_100 in asc order.
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_100
nvbench
CREATE TABLE table_68603 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
What is the score of the game that resulted in a 15-9 record?
SELECT "Score" FROM table_68603 WHERE "Record" = '15-9'
wikisql
CREATE TABLE customers ( customer_name VARCHAR, customer_id VARCHAR ) CREATE TABLE customer_orders ( customer_id VARCHAR, order_status_code VARCHAR )
Show the names of customers who have both an order in completed status and an order in part status.
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part'
sql_create_context
CREATE TABLE table_33452 ( "Game" real, "Date" text, "Location" text, "Time" text, "Attendance" real )
What was the attendance for the game played at 3:31?
SELECT "Attendance" FROM table_33452 WHERE "Time" = '3:31'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) 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 ) ...
what were the four most frequently ordered lab tests for patients who had previously received cv cath plcmt w guidance in the same month, until 2104?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_i...
mimic_iii
CREATE TABLE table_46142 ( "Title" text, "Author" text, "ISBN UK" text, "ISBN US" text, "TV companions featured" text )
What is Title, when TV Companions Featured is 'K-9'?
SELECT "Title" FROM table_46142 WHERE "TV companions featured" = 'k-9'
wikisql
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE ...
all flights from LONG BEACH to PHOENIX
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'LONG BEACH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHO...
atis