context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_52252 ( "Race" text, "Date" text, "Location" text, "Pole Position" text, "Fastest Lap" text, "Race Winner" text, "Constructor" text, "Report" text )
What was the race with nigel mansell winning in estoril?
SELECT "Race" FROM table_52252 WHERE "Race Winner" = 'nigel mansell' AND "Location" = 'estoril'
wikisql
CREATE TABLE table_name_5 ( grid INTEGER, laps INTEGER )
For Laps smaller than 6, what does the Grid add up to?
SELECT SUM(grid) FROM table_name_5 WHERE laps < 6
sql_create_context
CREATE TABLE table_name_79 ( no_3 VARCHAR, no_7 VARCHAR, no_4 VARCHAR )
What is No. 3, when No. 7 is Abigail, and when No. 4 is Ava?
SELECT no_3 FROM table_name_79 WHERE no_7 = "abigail" AND no_4 = "ava"
sql_create_context
CREATE TABLE table_65883 ( "Source" text, "Chrome" text, "Internet Explorer" text, "Firefox" text, "Safari" text, "Opera" text, "Other" text )
What percentage of users were using Firefox according to the source that reported 21.70% used Internet Explorer?
SELECT "Firefox" FROM table_65883 WHERE "Internet Explorer" = '21.70%'
wikisql
CREATE TABLE table_42991 ( "Pos." text, "Player" text, "Team" text, "Height" text, "Weight" real )
What player plays for the Dakota Wizards?
SELECT "Player" FROM table_42991 WHERE "Team" = 'dakota wizards'
wikisql
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by weekday, and list in ascending by the y axis.
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(DEPARTMENT_ID)
nvbench
CREATE TABLE table_74288 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What position does allister brown play.
SELECT "Position" FROM table_74288 WHERE "Player" = 'Allister Brown'
wikisql
CREATE TABLE table_1908049_1 ( league VARCHAR, year VARCHAR )
in the year 1998/99 what was the league
SELECT league FROM table_1908049_1 WHERE year = "1998/99"
sql_create_context
CREATE TABLE table_1644857_2 ( skip VARCHAR, pf VARCHAR )
Who was skip for the country whose points for (PF) was 73?
SELECT skip FROM table_1644857_2 WHERE pf = 73
sql_create_context
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For all employees who have the letters D or S in their first name, show me about the distribution of job_id and the sum of department_id , and group by attribute job_id in a bar chart, and sort by the total number in asc.
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(DEPARTMENT_ID)
nvbench
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( uniquepid text, ...
is heartrate of patient 021-95970 last measured on the current icu visit greater than second to last measured on the current icu visit?
SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-95970') AND patient.unitdischargetime IS NULL...
eicu
CREATE TABLE protein ( common_name text, protein_name text, divergence_from_human_lineage real, accession_number text, sequence_length real, sequence_identity_to_human_protein text, Institution_id text ) CREATE TABLE Institution ( Institution_id text, Institution text, Location ...
Show the names and heights of buildings with at least two institutions founded after 1880 Plot them as bar chart, and list by the Y in ascending.
SELECT Name, Height_feet FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id WHERE T2.Founded > 1880 ORDER BY Height_feet
nvbench
CREATE TABLE table_name_81 ( joined INTEGER, city VARCHAR, conference_championships VARCHAR )
What is the lowest year joined in the city of College Park at the Conference championships smaller than 0?
SELECT MIN(joined) FROM table_name_81 WHERE city = "college park" AND conference_championships < 0
sql_create_context
CREATE TABLE table_75521 ( "S.No." real, "Name of janapada" text, "Name of King" text, "No. of villages" real, "Capital" text )
What king has an S. number over 1 and a number of villages of 600?
SELECT "Name of King" FROM table_75521 WHERE "S.No." > '1' AND "No. of villages" = '600'
wikisql
CREATE TABLE table_13955 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in final" text, "Score" text, "Prize Money" text )
What is the Date of the Tournament against Anastasiya Yakimova?
SELECT "Date" FROM table_13955 WHERE "Opponent in final" = 'anastasiya yakimova'
wikisql
CREATE TABLE table_14817 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real )
What was the rank in 1955?
SELECT "Rank" FROM table_14817 WHERE "Year" = '1955'
wikisql
CREATE TABLE table_61792 ( "Sign" text, "Domicile" text, "Detriment" text, "Exaltation" text, "Fall" text )
Which exaltation has a detriment of Saturn and Cancer as a sign?
SELECT "Exaltation" FROM table_61792 WHERE "Detriment" = 'saturn' AND "Sign" = 'cancer'
wikisql
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE cours...
For the upper-level courses is the instuctor ever Bradley Hinesman ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.ins...
advising
CREATE TABLE table_5619 ( "Crop" text, "Area" text, "Output (2007)" text, "% of national" text, "Main location(s)" text )
What Main Location(s) has an Area of 19,800 HA?
SELECT "Main location(s)" FROM table_5619 WHERE "Area" = '19,800 ha'
wikisql
CREATE TABLE table_name_16 ( goals_conceded INTEGER, draws VARCHAR, points VARCHAR, wins VARCHAR )
How many total goals conceded are there when the points are greater than 58, less than 27 wins, and less than 1 draws?
SELECT SUM(goals_conceded) FROM table_name_16 WHERE points > 58 AND wins < 27 AND draws < 1
sql_create_context
CREATE TABLE table_26766 ( "Borough" text, "County" text, "Franchise type" text, "Members" real, "Voters in 1800" real, "Times contested" real, "Fate in 1832" text )
Name the fate in 1832 for pembrokeshire
SELECT "Fate in 1832" FROM table_26766 WHERE "County" = 'Pembrokeshire'
wikisql
CREATE TABLE table_77129 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School/Club Team" text )
Which Round has a School/Club Team of indiana, and a Pick smaller than 198?
SELECT AVG("Round") FROM table_77129 WHERE "School/Club Team" = 'indiana' AND "Pick" < '198'
wikisql
CREATE TABLE table_39572 ( "Score" text, "Opposition" text, "Venue" text, "City" text, "Year" real )
How many years had a score of 734-5d?
SELECT COUNT("Year") FROM table_39572 WHERE "Score" = '734-5d'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Give me the comparison about the average of Team_ID over the ACC_Road , and group by attribute ACC_Road by a bar chart.
SELECT ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road
nvbench
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text...
Open Community Wiki Questions with the most Answers and Favorites.
SELECT P.Title, P.Id AS "post_link", P.Score AS Score, P.FavoriteCount AS Favorites, P.ViewCount AS "views" FROM Posts AS P WHERE NOT P.CommunityOwnedDate IS NULL AND NOT P.Title IS NULL ORDER BY Score DESC LIMIT 100
sede
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Show me team_id by all road in a histogram, and rank by the y-axis in ascending.
SELECT All_Road, Team_ID FROM basketball_match ORDER BY Team_ID
nvbench
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, ...
从2010年9月11日直到19年6月8日医疗机构1793987的入院诊断疾病结果与出院诊断疾病结果有多少次不一样?
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1793987' AND t_kc21.IN_HOSP_DATE BETWEEN '2010-09-11' AND '2019-06-08' AND t_kc21.IN_DIAG_DIS_CD <> t_kc21.OUT_DIAG_DIS_CD
css
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varcha...
which flights from MEMPHIS to TACOMA also stop in LOS ANGELES
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TACOMA' AND CITY_2.cit...
atis
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time...
when was the first time patient 015-23047 took per iv flush: wrist l 20 gauge, today?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-23047')) AND intakeoutput.cellpath LIKE '%intake%...
eicu
CREATE TABLE table_name_65 ( player VARCHAR, year_s__won VARCHAR )
What player won 1985?
SELECT player FROM table_name_65 WHERE year_s__won = "1985"
sql_create_context
CREATE TABLE table_name_5 ( date VARCHAR, score VARCHAR )
What's the date the score was 379?
SELECT date FROM table_name_5 WHERE score = "379"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
count the number of patients whose insurance is government and procedure icd9 code is 3727?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.icd9_code = "3727"
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...
provide the number of patients whose ethnicity is american indian/alaska native?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE"
mimicsql_data
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 hours have passed since first time that patient 013-30085 stayed in ward 550 in their current hospital visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '013-30085' AND patient.wardid = 550 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE table_56212 ( "Number" real, "Locomotive type" text, "Wheel arrangement" text, "Builder" text, "Entered Service" real, "Withdrawn" real )
When did the tom smith built train enter service with a number under 7007?
SELECT AVG("Entered Service") FROM table_56212 WHERE "Builder" = 'tom smith' AND "Number" < '7007'
wikisql
CREATE TABLE table_name_33 ( visitor VARCHAR, date VARCHAR )
What is the Visitor of the game on January 24?
SELECT visitor FROM table_name_33 WHERE date = "january 24"
sql_create_context
CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, product_category_code VARCHAR(20), date_product_first_available DATETIME, date_product_discontinued DATETIME, product_name VARCHAR(80), product_description VARCHAR(255), product_price DECIMAL(19,4) ) CREATE TABLE Sta...
List the name of all products along with the number of complaints that they have received, and order from low to high by the X-axis.
SELECT product_name, COUNT(*) FROM Products AS t1 JOIN Complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name ORDER BY product_name
nvbench
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId numb...
Feature-requests by the delay of becoming [status-completed].
WITH Raw AS (SELECT Id, PostId, Text, LAG(Text) OVER (PARTITION BY PostId ORDER BY Id) AS PrevText FROM PostHistory WHERE PostHistoryTypeId = 6), Raw2 AS (SELECT MIN(Id) AS Id, PostId FROM Raw WHERE (PrevText IS NULL OR NOT PrevText LIKE '%<status-completed>%') AND Text LIKE '%<status-completed>%' AND Text LIKE '%<feat...
sede
CREATE TABLE table_name_96 ( cerclis_id VARCHAR, county VARCHAR, deleted VARCHAR )
What is the CERCLIS ID of the site in Polk County, with the date 08/04/2009?
SELECT cerclis_id FROM table_name_96 WHERE county = "polk" AND deleted = "08/04/2009"
sql_create_context
CREATE TABLE table_204_475 ( id number, "home team" text, "score" text, "away team" text, "date" text, "agg" text )
during the second leg , what number of matches ended in a draw ?
SELECT COUNT(*) FROM table_204_475 WHERE "score" = "score"
squall
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what is the maximum amount of the total hospital cost which involves intracranial injury - with concussion since 5 years ago?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'intracranial injury - with concussion')) AND...
eicu
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
give me the number of patients whose diagnoses long title is personal history of malignant neoplasm of other gastrointestinal tract and lab test abnormal status is abnormal?
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 = "Personal history of malignant neoplasm of other gastrointestinal tract" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE table_29438 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text )
when was the episode with production code '2arg01' originally aired?
SELECT "Original air date" FROM table_29438 WHERE "Production code" = '2ARG01'
wikisql
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId n...
Distribution of post frequency by users.
SELECT c.post_count, c.cum_posts, 100.0 * c.cum_posts / MAX(c.cum_posts) OVER (ORDER BY c.post_count DESC) AS cum_posts_pctg, c.cum_users, 100.0 * c.cum_users / MAX(c.cum_users) OVER (ORDER BY c.post_count DESC) AS cum_users_pctg FROM (SELECT b.post_count, 1.0 * SUM(b.post_count) OVER (ORDER BY b.post_count DESC) AS cu...
sede
CREATE TABLE table_name_95 ( country VARCHAR, player VARCHAR )
What country id Bob Rosburg from?
SELECT country FROM table_name_95 WHERE player = "bob rosburg"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
specify birthdate and icd9 code of patient jerry deberry
SELECT demographic.dob, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Jerry Deberry"
mimicsql_data
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, ...
find the age and status of death for patient with patient id 8323.
SELECT demographic.age, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "8323"
mimicsql_data
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...
编号为23981403团伙成员有哪些药是其最常开的排一下序?
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_ID = '23981403' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC
css
CREATE TABLE table_name_65 ( transfer_window VARCHAR, status VARCHAR, country VARCHAR )
What is the transfer window with a status of transfer from the country of Wal?
SELECT transfer_window FROM table_name_65 WHERE status = "transfer" AND country = "wal"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ...
in 2103, what are the four most frequent medications prescribed to stroke - ischemic stroke male patients of 20s after they have been diagnosed with stroke - ischemic stroke within 2 months?
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 = 'stroke - ischemic stroke' AND STRFTIME('%y', diagn...
eicu
CREATE TABLE Accounts ( statement_id VARCHAR, account_details VARCHAR ) CREATE TABLE Statements ( statement_details VARCHAR, statement_id VARCHAR )
Show statement id, statement detail, account detail for accounts.
SELECT T1.statement_id, T2.statement_details, T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id
sql_create_context
CREATE TABLE table_58214 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the away team score for the game played at MCG?
SELECT "Away team score" FROM table_58214 WHERE "Venue" = 'mcg'
wikisql
CREATE TABLE table_10335_1 ( occupied_territory VARCHAR, estimated_deaths VARCHAR )
what's the occupied territory with estimated deaths of 600,000
SELECT occupied_territory FROM table_10335_1 WHERE estimated_deaths = "600,000"
sql_create_context
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, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
what is average age of patients whose days of hospital stay is 1 and admission year is greater than or equal to 2146?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.days_stay = "1" AND demographic.admityear >= "2146"
mimicsql_data
CREATE TABLE table_10007452_3 ( manufacturer VARCHAR, order_year VARCHAR )
who is the manufacturer for the order year 1998?
SELECT manufacturer FROM table_10007452_3 WHERE order_year = "1998"
sql_create_context
CREATE TABLE table_80299 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real )
What was the finish place with a qual of 123.660?
SELECT "Finish" FROM table_80299 WHERE "Qual" = '123.660'
wikisql
CREATE TABLE table_name_16 ( date VARCHAR, away_team VARCHAR )
what is the date that the away team is aldershot?
SELECT date FROM table_name_16 WHERE away_team = "aldershot"
sql_create_context
CREATE TABLE table_name_83 ( location VARCHAR, tail_number VARCHAR )
In what location was the tail number ZS-SPF?
SELECT location FROM table_name_83 WHERE tail_number = "zs-spf"
sql_create_context
CREATE TABLE table_name_70 ( city VARCHAR, year VARCHAR, conference VARCHAR )
Which city has a conference of LCC2 and a year earlier than 2009?
SELECT city FROM table_name_70 WHERE year < 2009 AND conference = "lcc2"
sql_create_context
CREATE TABLE table_name_77 ( ihsaa_class VARCHAR, mascot VARCHAR )
What's the IHSAA class of the Red Devils?
SELECT ihsaa_class FROM table_name_77 WHERE mascot = "red devils"
sql_create_context
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_ins...
What classes do not have sessions in the lab ?
SELECT DISTINCT name, number FROM course WHERE department = 'EECS' AND has_lab = 'N'
advising
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 INTEGER, city_code VARCHAR(3) ) CREATE TABLE Lives_in ( stuid INTEGER, dormid INTE...
Visualize a bar chart for what is the average age for each dorm and what are the names of each dorm?
SELECT dorm_name, AVG(T1.Age) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
count the number of patients whose diagnoses short title is abn react-surg proc nec and lab test category is chemistry?
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.short_title = "Abn react-surg proc NEC" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime ti...
what's the last test patient 64881 has had until 04/2104?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64881) AND STRFTIME('%y-%m', labevents.charttime) <= '2104-04' ORDER BY labevents.charttime DESC LIMIT 1)
mimic_iii
CREATE TABLE table_54277 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Record" text )
What is the visiting team of the game with the home team Grizzlies on 13 November 2007?
SELECT "Visitor" FROM table_54277 WHERE "Home" = 'grizzlies' AND "Date" = '13 november 2007'
wikisql
CREATE TABLE table_24096813_15 ( frequency VARCHAR, part_number_s_ VARCHAR )
What's the frequency of the model with part number TT80503300?
SELECT frequency FROM table_24096813_15 WHERE part_number_s_ = "TT80503300"
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
what number of hours have passed since patient 55281 last received a potassium lab test during their current hospital encounter?
SELECT 24 * (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 = 'potassium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55281 AND admissio...
mimic_iii
CREATE TABLE table_17095 ( "Year" text, "Player" text, "School" text, "Hometown" text, "College" text, "NBA Draft" text )
What is the nba draft for the player from the hometown of virginia beach, va?
SELECT "NBA Draft" FROM table_17095 WHERE "Hometown" = 'Virginia Beach, VA'
wikisql
CREATE TABLE table_12884 ( "Engine" text, "Cyl." text, "Power" text, "Torque" text, "Engine code" text, "0\u2013100km/h (sec.)" text )
Which engine has a code of m113.980?
SELECT "Engine" FROM table_12884 WHERE "Engine code" = 'm113.980'
wikisql
CREATE TABLE table_4828 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the date of the game where Footscray was the away team?
SELECT "Date" FROM table_4828 WHERE "Away team" = 'footscray'
wikisql
CREATE TABLE table_55974 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the largest amount of spectators when the home team scored 13.11 (89)?
SELECT MAX("Crowd") FROM table_55974 WHERE "Home team score" = '13.11 (89)'
wikisql
CREATE TABLE table_1342331_5 ( incumbent VARCHAR, first_elected VARCHAR )
how many incumbent with first elected being 1932
SELECT COUNT(incumbent) FROM table_1342331_5 WHERE first_elected = 1932
sql_create_context
CREATE TABLE table_67235 ( "Date" text, "Course" text, "Distance" text, "Winner" text, "Race Leader" text )
How long was the course from Naples to Foggia?
SELECT "Distance" FROM table_67235 WHERE "Course" = 'naples to foggia'
wikisql
CREATE TABLE table_59627 ( "Player" text, "Team" text, "Matches" real, "Overs" real, "Runs" real, "Wickets" real, "Best" text, "Econ" real, "S/Rate" real, "4/inns" real, "5+/inns" real, "Average" real )
How many 5+/inns have tyron henderson as the player, with wickets less than 21?
SELECT COUNT("5+/inns") FROM table_59627 WHERE "Player" = 'tyron henderson' AND "Wickets" < '21'
wikisql
CREATE TABLE gwyjzb ( 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, ...
看看参保人褚子琪住院发生的费用是整数金额的次数
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.PERSON_NM = '褚子琪' AND gwyjzb.CLINIC_TYPE = '住院' AND MOD(gwyjzb.MED_AMOUT, 1) = 0 UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '褚子琪' AND fgwyjzb.CLINIC_TYPE = '住院' AND MOD(fgwyjzb.MED_AMOUT, 1) = 0
css
CREATE TABLE climber ( climber_id number, name text, country text, time text, points number, mountain_id number ) CREATE TABLE mountain ( mountain_id number, name text, height number, prominence number, range text, country text )
Give the names of mountains in alphabetical order.
SELECT name FROM mountain ORDER BY name
spider
CREATE TABLE table_name_50 ( population INTEGER, rank VARCHAR, median_house__hold_income VARCHAR )
What is the population where the rank is higher than 51 and the Median House-hold income is $25,250?
SELECT SUM(population) FROM table_name_50 WHERE rank > 51 AND median_house__hold_income = "$25,250"
sql_create_context
CREATE TABLE table_72487 ( "N" real, "P" text, "Name" text, "EU" text, "Country" text, "Age" real, "Type" text, "Moving from" text, "Transfer window" text, "Ends" text, "Transfer fee" text, "Source" text )
How many numbers are ending in 1 year?
SELECT COUNT("N") FROM table_72487 WHERE "Ends" = '1 year'
wikisql
CREATE TABLE player ( Player_ID int, Player text, Years_Played text, Total_WL text, Singles_WL text, Doubles_WL text, Team int ) CREATE TABLE match_season ( Season real, Player text, Position text, Country int, Team int, Draft_Pick_Number int, Draft_Class text, ...
Give me a bar chart for the total number of each position
SELECT Position, COUNT(*) FROM match_season GROUP BY Position
nvbench
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE presc...
how many patients was given lap gastric restric proc in 2101 for two times?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'lap gastric restric p...
mimic_iii
CREATE TABLE table_26360 ( "1 January 2010" text, "DF" text, "Adam Hinshelwood" text, "Aldershot Town" text, "Wycombe Wanderers" text, "Undisclosed" text )
What are the Wycombe Wanderers when 1 January 2010 is 23 July 2009 and df is gk?
SELECT "Wycombe Wanderers" FROM table_26360 WHERE "1 January 2010" = '23 July 2009' AND "DF" = 'GK'
wikisql
CREATE TABLE table_name_48 ( affiliation VARCHAR, institution VARCHAR )
What is Southern Illinois University Edwardsville's affiliation?
SELECT affiliation FROM table_name_48 WHERE institution = "southern illinois university edwardsville"
sql_create_context
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,...
所有费用明细项目是否都已结算完成,在医疗就诊66095385712中的?
SELECT (SELECT SUM(t_kc22.STA_FLG) 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 = '66095385712') = (SELECT COUNT(*) FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID = '66095385712')
css
CREATE TABLE table_67368 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many totals have a Bronze of 0, and a Gold smaller than 0?
SELECT SUM("Total") FROM table_67368 WHERE "Bronze" = '0' AND "Gold" < '0'
wikisql
CREATE TABLE table_17906 ( "Series number" text, "Episode number" real, "Date of first broadcast" text, "Total viewers" real, "Series average" real )
what is the series number where the date of first broadcast is 16 october 2008?
SELECT "Series number" FROM table_17906 WHERE "Date of first broadcast" = '16 October 2008'
wikisql
CREATE TABLE table_name_20 ( quantity VARCHAR, year_s__of_manufacture VARCHAR, class VARCHAR )
what is the quantity when the year of manufacture is 1900 and the class is mc?
SELECT quantity FROM table_name_20 WHERE year_s__of_manufacture = "1900" AND class = "mc"
sql_create_context
CREATE TABLE table_60077 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What is the team 2 with turnovo as team 1?
SELECT "Team 2" FROM table_60077 WHERE "Team 1" = 'turnovo'
wikisql
CREATE TABLE table_20455 ( "S No" real, "Team (A)" text, "Team (B)" text, "Winner" text, "Margin" text, "Match Date" text )
Name the numbers for date of feb 27, 1996
SELECT "S No" FROM table_20455 WHERE "Match Date" = 'Feb 27, 1996'
wikisql
CREATE TABLE table_34956 ( "Year" real, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
How many years did pia pajunen nina sundberg win women's doubles?
SELECT COUNT("Year") FROM table_34956 WHERE "Women's doubles" = 'pia pajunen nina sundberg'
wikisql
CREATE TABLE table_32759 ( "Name" text, "Release date" text, "Latest version" text, "Status support" text, "Source model" text, "Architecture" text, "Target market" text )
Which of the Latest version had a 16-bit Architecture and was released on Release date 1985-11-20?
SELECT "Latest version" FROM table_32759 WHERE "Architecture" = '16-bit' AND "Release date" = '1985-11-20'
wikisql
CREATE TABLE table_72896 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text )
Name who directed the episode for the series number 236
SELECT "Directed by" FROM table_72896 WHERE "Series #" = '236'
wikisql
CREATE TABLE table_name_92 ( snatch VARCHAR, total VARCHAR )
What was the Snatch weight for the year that had a total of 409kg?
SELECT snatch FROM table_name_92 WHERE total = "409kg"
sql_create_context
CREATE TABLE table_42414 ( "City of license" text, "Identifier" text, "Frequency" text, "Power" text, "Class" text, "RECNet" text )
What is City of License, when Frequency is 101.1?
SELECT "City of license" FROM table_42414 WHERE "Frequency" = '101.1'
wikisql
CREATE TABLE table_name_62 ( nets_points INTEGER, game VARCHAR, opponents VARCHAR )
What was the average point total for the nets in games before game 9 where the opponents scored less than 95?
SELECT AVG(nets_points) FROM table_name_62 WHERE game < 9 AND opponents < 95
sql_create_context
CREATE TABLE table_2553861_1 ( league VARCHAR, year VARCHAR )
Name the league for 2000
SELECT league FROM table_2553861_1 WHERE year = 2000
sql_create_context
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE course_offering ( offering_id int, course_id int, ...
Can I do AOSS 421 immediately ?
SELECT COUNT(*) > 0 FROM course, course_offering, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'AOSS' AND course.number = 421 AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'WN' AND semester.semester_id = course_offer...
advising
CREATE TABLE table_name_75 ( pop_¹ INTEGER, region VARCHAR, prefecture VARCHAR )
Name the average pop for ch goku and prefecture of okayama
SELECT AVG(pop_¹) FROM table_name_75 WHERE region = "chūgoku" AND prefecture = "okayama"
sql_create_context
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE outputevents ( row_id number, subject_...
what are the five most commonly prescribed microbiology tests for patients who had previously received opn/oth rep mtrl vlv-tis within 2 months in 2103?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, 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_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
mimic_iii
CREATE TABLE table_14034 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
How many years have a Position of 17th (q)?
SELECT COUNT("Year") FROM table_14034 WHERE "Position" = '17th (q)'
wikisql
CREATE TABLE table_203_608 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
which country has the most number of medals ?
SELECT "nation" FROM table_203_608 ORDER BY "total" DESC LIMIT 1
squall