context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_62254 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text )
What district was a republican first elected in 2000?
SELECT "District" FROM table_62254 WHERE "First elected" = '2000' AND "Party" = 'republican'
wikisql
CREATE TABLE table_65390 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What was the place when the score was 65-70-72=207?
SELECT "Place" FROM table_65390 WHERE "Score" = '65-70-72=207'
wikisql
CREATE TABLE table_2268216_1 ( average_speed__mph_ VARCHAR, year VARCHAR )
How many average speeds are listed in the year 2003?
SELECT COUNT(average_speed__mph_) FROM table_2268216_1 WHERE year = "2003"
sql_create_context
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 demographic ( subject_id text, hadm_id t...
provide the number of patients whose gender is m and diagnoses short title is cong skin pigment anomal?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.short_title = "Cong skin pigment anomal"
mimicsql_data
CREATE TABLE Financial_transactions ( transaction_amount INTEGER )
What is the average and total transaction amount?
SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions
sql_create_context
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense...
Number of users with activity in the last year.
SELECT COUNT(*) FROM Users WHERE LastAccessDate > DATEADD(year, -1, GETDATE()) AND Reputation > 10
sede
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 demographic ( subject_id text, hadm_id t...
give me the number of patients whose procedure icd9 code is 3804?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "3804"
mimicsql_data
CREATE TABLE table_name_30 ( away_team VARCHAR, venue VARCHAR )
What was the score of the away team at princes park?
SELECT away_team AS score FROM table_name_30 WHERE venue = "princes park"
sql_create_context
CREATE TABLE table_64255 ( "Year" real, "A-side" text, "B-side" text, "Catalog number" text, "Label" text )
What year did the B-Side of Just Squeeze Me come out?
SELECT "Year" FROM table_64255 WHERE "B-side" = 'just squeeze me'
wikisql
CREATE TABLE table_23292220_3 ( first_broadcast VARCHAR, daves_team VARCHAR )
What is the first broadcast date of the episode in which Dave's team is made up of Dave Johns and Sally Lindsay?
SELECT first_broadcast FROM table_23292220_3 WHERE daves_team = "Dave Johns and Sally Lindsay"
sql_create_context
CREATE TABLE table_48259 ( "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponent in the final" text, "Score" text )
What is the Date of the Vigo Tournament?
SELECT "Date" FROM table_48259 WHERE "Tournament" = 'vigo'
wikisql
CREATE TABLE table_69561 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real )
What's the Qual listed with a Rank of 27?
SELECT "Qual" FROM table_69561 WHERE "Rank" = '27'
wikisql
CREATE TABLE table_55975 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
How many spectators were at the away team Carlton?
SELECT "Crowd" FROM table_55975 WHERE "Away team" = 'carlton'
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLO...
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the sum of department_id bin hire_date by time in a bar chart.
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
nvbench
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...
was the heartrate normal for patient 017-59454 on the first intensive care unit visit?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-59454') AND NOT patient.unitdischargetime IS NULL ORDER BY patie...
eicu
CREATE TABLE table_203_665 ( id number, "name" text, "municipality" text, "established" number, "tower height\nin meters (ft)" text, "focal plane\nin meters (ft)" text, "current status" text, "current condition" text )
cardona island light and caja de muertos light are both located in what municipality ?
SELECT "municipality" FROM table_203_665 WHERE "name" IN ('cardona island light', 'caja de muertos light')
squall
CREATE TABLE table_name_30 ( winners VARCHAR, season VARCHAR )
Who is the winner in 2011?
SELECT winners FROM table_name_30 WHERE season = 2011
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 Users ( Id number, Reputation number,...
The longest answers by an user.. To find those that required a lot of work. :-) Or a copy/paste. :-(
SELECT Id AS "post_link", LENGTH(Body) AS Length, LastActivityDate AS "last_activity_date" FROM Posts WHERE PostTypeId = 2 AND OwnerUserId = '##UserId##' ORDER BY Length DESC LIMIT 1000
sede
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 diagnoses ( ...
what is the number of patients whose diagnoses short title is ac/chr syst/dia hrt fail and lab test fluid is joint fluid?
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 = "Ac/chr syst/dia hrt fail" AND lab.fluid = "Joint Fluid"
mimicsql_data
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 ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
Calculate the number of patients with diagnoses icd9 code v4281 who had a cerebrospinal fluid lab test.
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.icd9_code = "V4281" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE table_3936 ( "Round" real, "Race" text, "Pole position" text, "Fastest lap" text, "Most laps led" text, "Driver" text, "Team" text, "Manufacturer" text, "Report" text )
What race did Simon Pagenaud have the most laps in?
SELECT "Race" FROM table_3936 WHERE "Most laps led" = 'Simon Pagenaud'
wikisql
CREATE TABLE table_2796 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Name the least game for score of l 93 109 (ot)
SELECT MIN("Game") FROM table_2796 WHERE "Score" = 'L 93–109 (OT)'
wikisql
CREATE TABLE tracks ( name VARCHAR, genre_id VARCHAR ) CREATE TABLE albums ( id VARCHAR, title VARCHAR )
List name of all tracks in Balls to the Wall.
SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = "Balls to the Wall"
sql_create_context
CREATE TABLE table_54557 ( "Environment" text, "Realization" text, "Example" text, "Pronunciation" text, "Gloss" text )
Name the realization for 'to be, to do
SELECT "Realization" FROM table_54557 WHERE "Gloss" = 'to be, to do'
wikisql
CREATE TABLE table_5647 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
What is the score of the tournament on 25 July 1994 with a clay surface and Patricia Tarabini as the partner?
SELECT "Score" FROM table_5647 WHERE "Surface" = 'clay' AND "Partner" = 'patricia tarabini' AND "Date" = '25 july 1994'
wikisql
CREATE TABLE journal ( homepage varchar, jid int, name varchar ) CREATE TABLE domain ( did int, name varchar ) CREATE TABLE domain_author ( aid int, did int ) CREATE TABLE author ( aid int, homepage varchar, name varchar, oid int ) CREATE TABLE writes ( aid int, p...
return me the paper after 2000 with more than 200 citations .
SELECT title FROM publication WHERE citation_num > 200 AND year > 2000
academic
CREATE TABLE table_69327 ( "Name" text, "Seasons" text, "Matches" real, "Inns" real, "Runs" real )
Runs smaller than 6106, and Inns smaller than 146 has what total number of matches?
SELECT COUNT("Matches") FROM table_69327 WHERE "Runs" < '6106' AND "Inns" < '146'
wikisql
CREATE TABLE table_name_30 ( date VARCHAR, winning_score VARCHAR )
On what Date was the Winning score of 72-67-68-67=274?
SELECT date FROM table_name_30 WHERE winning_score = 72 - 67 - 68 - 67 = 274
sql_create_context
CREATE TABLE table_47051 ( "Volume:Issue" text, "Issue Date(s)" text, "Weeks on Top" text, "Song" text, "Artist" text )
What is the name of the artist of ' bang bang boom '?
SELECT "Artist" FROM table_47051 WHERE "Song" = ' bang bang boom '
wikisql
CREATE TABLE table_26410 ( "Season" text, "Name" text, "Teams" real, "Relegated to league" text, "Promoted to league" text, "Promoted from league" text, "Relegated from league" text )
How many teams participated (maximum) when Cornish All Blacks Pertemps Bees were relegated to the league?
SELECT MAX("Teams") FROM table_26410 WHERE "Relegated to league" = 'Cornish All Blacks Pertemps Bees'
wikisql
CREATE TABLE table_name_82 ( opponent VARCHAR, week VARCHAR )
Who was the opponent on week 7?
SELECT opponent FROM table_name_82 WHERE week = "7"
sql_create_context
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, Deletio...
Top 100 questions by tags in the last year (sorted by viewcount).
SELECT Id, Title, CreationDate, Tags, ClosedDate, FavoriteCount, ViewCount, Score FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '%##TagName1##%' AND Tags LIKE '%##TagName2##%' AND NOT Tags LIKE '%##ExcludedTag##%' AND Posts.CreationDate > CURRENT_TIMESTAMP() - 365 ORDER BY ViewCount DESC, FavoriteCount DESC, Score DESC...
sede
CREATE TABLE table_59272 ( "Position" real, "Club" text, "Games played" real, "Wins" real, "Draws" real, "Loses" real, "Goals scored" real, "Goals conceded" real, "Points" real )
What is the smallest number of wins where goals conceded are below 26, draws are 1 and goals scored are below 74?
SELECT MIN("Wins") FROM table_59272 WHERE "Goals conceded" < '26' AND "Draws" = '1' AND "Goals scored" < '74'
wikisql
CREATE TABLE table_name_60 ( team VARCHAR, race_title VARCHAR )
Name the team for launceston
SELECT team FROM table_name_60 WHERE race_title = "launceston"
sql_create_context
CREATE TABLE table_64905 ( "School" text, "City" text, "Team Name" text, "County" text, "Year Joined" text, "Year Left" text )
Which city has a school of North Vernon and a county of 40 Jennings?
SELECT "City" FROM table_64905 WHERE "County" = '40 jennings' AND "School" = 'north vernon'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeou...
what is the intake method of the trandate?
SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'trandate'
eicu
CREATE TABLE film ( film_id number, title text, description text, release_year time, language_id number, original_language_id number, rental_duration number, rental_rate number, length number, replacement_cost number, rating text, special_features text, last_update ti...
Return the full name of the customer who made the first rental.
SELECT T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date LIMIT 1
spider
CREATE TABLE table_29398373_2 ( captain VARCHAR, team VARCHAR )
Name the number of captains for barcelona
SELECT COUNT(captain) FROM table_29398373_2 WHERE team = "Barcelona"
sql_create_context
CREATE TABLE farm_competition ( Competition_ID int, Year int, Theme text, Host_city_ID int, Hosts text ) CREATE TABLE competition_record ( Competition_ID int, Farm_ID int, Rank int ) CREATE TABLE farm ( Farm_ID int, Year int, Total_Horses real, Working_Horses real, ...
Give me a histogram for what are the statuses and average populations of each city?
SELECT Status, AVG(Population) FROM city GROUP BY Status
nvbench
CREATE TABLE table_17693171_1 ( laps INTEGER, time_retired VARCHAR )
If the time/retired is +1 lap, what is the amount of maximum laps?
SELECT MAX(laps) FROM table_17693171_1 WHERE time_retired = "+1 lap"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperio...
how many patients were diagnosed with ards and didn't return back to the hospital within 2 months until 3 years ago?
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'ards' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-3 year')) AS t1) - (SELECT...
eicu
CREATE TABLE table_38880 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text )
What is the score at game 31?
SELECT "Score" FROM table_38880 WHERE "Game" = '31'
wikisql
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 allergy ( allergy...
what is the yearly maximum output (ml)-nephrostomy right 10 fr. output that patient 015-16479 has had since 32 months ago?
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-16479')) AND intakeoutput.celllabel = 'outpu...
eicu
CREATE TABLE table_train_82 ( "id" int, "mini_mental_state_examination_mmse" int, "systolic_blood_pressure_sbp" int, "diastolic_blood_pressure_dbp" int, "body_mass_index_bmi" float, "hypertension" bool, "age" float, "NOUSE" float )
mini mental state examination ( mmse ) total score < 27
SELECT * FROM table_train_82 WHERE mini_mental_state_examination_mmse < 27
criteria2sql
CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) ) CREATE TABLE Student...
List the number of completion students in each day and group by date of completion in a line chart.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment GROUP BY date_of_completion
nvbench
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, ...
Comments that have imgur images.
SELECT Id AS "comment_link", Text FROM Comments WHERE LOWER(Text) LIKE '%i.stack.imgur.com%' LIMIT 100
sede
CREATE TABLE table_name_94 ( model VARCHAR, engine_make_capacity VARCHAR, gcm__kg__technical_capacity VARCHAR, gvm__kg__technical_capacity VARCHAR )
Which Model has a GCM (kg) Technical Capacity of 35000, a GVM (kg) Technical Capacity of 16000, and Cummins Interact 6.0-euro III (turbo intercooler) for the Engine?
SELECT model FROM table_name_94 WHERE gcm__kg__technical_capacity = "35000" AND gvm__kg__technical_capacity = "16000" AND engine_make_capacity = "cummins interact 6.0-euro iii (turbo intercooler)"
sql_create_context
CREATE TABLE table_9892 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text )
What is the average number of games with a record of 20-12?
SELECT AVG("Game") FROM table_9892 WHERE "Record" = '20-12'
wikisql
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
患者16242595642的身高、体重、收缩压、舒张压、心率、呼吸频率、体温、脉率在门诊就诊过程中记录为多少?
SELECT txmzjzjlb.SG, txmzjzjlb.TZ, txmzjzjlb.TW, txmzjzjlb.SSY, txmzjzjlb.SZY, txmzjzjlb.XL, txmzjzjlb.HXPLC, txmzjzjlb.ML FROM txmzjzjlb WHERE txmzjzjlb.JZLSH = '16242595642' UNION SELECT ftxmzjzjlb.SG, ftxmzjzjlb.TZ, ftxmzjzjlb.TW, ftxmzjzjlb.SSY, ftxmzjzjlb.SZY, ftxmzjzjlb.XL, ftxmzjzjlb.HXPLC, ftxmzjzjlb.ML FROM ft...
css
CREATE TABLE table_33762 ( "Team" text, "Chassis" text, "Engine" text, "Driver(s)" text, "Sponsor(s)" text, "Rounds" text )
What team was Tom Sneva on in rounds 1-9?
SELECT "Team" FROM table_33762 WHERE "Driver(s)" = 'tom sneva' AND "Rounds" = '1-9'
wikisql
CREATE TABLE table_17948 ( "Season" text, "Airdate" text, "The Mole" text, "Winner" text, "Runner-up" text, "Prize money" text, "International destination" text )
what's the mole with airdate being 8 january 2009
SELECT "The Mole" FROM table_17948 WHERE "Airdate" = '8 January 2009'
wikisql
CREATE TABLE Customer_Addresses ( customer_id INTEGER, address_id INTEGER, date_address_from DATETIME, address_type VARCHAR(15), date_address_to DATETIME ) CREATE TABLE Customer_Contact_Channels ( customer_id INTEGER, channel_code VARCHAR(15), active_from_date DATETIME, active_to_da...
How many orders in each weekday? Return a bar chart to show.
SELECT order_date, COUNT(order_date) FROM Customers AS t1 JOIN Customer_Orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered"
nvbench
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...
看看这位患者入院时诊断出来的疾病编号和名称,编号是01456680839的医疗就诊
SELECT qtb.IN_DIAG_DIS_CD, qtb.IN_DIAG_DIS_NM FROM qtb WHERE qtb.MED_CLINIC_ID = '01456680839' UNION SELECT gyb.IN_DIAG_DIS_CD, gyb.IN_DIAG_DIS_NM FROM gyb WHERE gyb.MED_CLINIC_ID = '01456680839' UNION SELECT zyb.IN_DIAG_DIS_CD, zyb.IN_DIAG_DIS_NM FROM zyb WHERE zyb.MED_CLINIC_ID = '01456680839' UNION SELECT mzb.IN_DIA...
css
CREATE TABLE table_51380 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the lowest number of Gold the Nation of Italy had when it ranked other than 1, and had more than 0 Silver?
SELECT MIN("Gold") FROM table_51380 WHERE "Rank" > '1' AND "Nation" = 'italy' AND "Silver" > '0'
wikisql
CREATE TABLE team ( team_id number, name text ) 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_numb...
What are the different positions for match season?
SELECT DISTINCT position FROM match_season
spider
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients (...
when was the first time that patient 70645 was admitted to the hospital during the last year?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 70645 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE table_name_31 ( completed VARCHAR, laid_down VARCHAR )
when was the ship completed that was laid down on 23 march 1926?
SELECT completed FROM table_name_31 WHERE laid_down = "23 march 1926"
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 diagnoses ( ...
what is minimum age of patients whose admission type is emergency and primary disease is pneumonia;human immunodefiency virus;rule out tuberculosis?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.diagnosis = "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS"
mimicsql_data
CREATE TABLE qtb ( 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...
在患者云乐人的医疗记录中,查一下医疗费总额高过1367.6元的入院诊断疾病编码和名称
SELECT qtb.IN_DIAG_DIS_CD, qtb.IN_DIAG_DIS_NM FROM qtb WHERE qtb.PERSON_NM = '云乐人' AND qtb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 1367.6) UNION SELECT gyb.IN_DIAG_DIS_CD, gyb.IN_DIAG_DIS_NM FROM gyb WHERE gyb.PERSON_NM = '云乐人' AND gyb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINI...
css
CREATE TABLE table_3914 ( "#" real, "Date" text, "Opponent" text, "Site/Stadium" text, "Score" text, "Win" text, "Loss" text, "Save" text, "Attendance" real, "Overall Record" text, "Pac-10 Record" text )
What was the PAC-10 record of the game played on April 20?
SELECT "Pac-10 Record" FROM table_3914 WHERE "Date" = 'April 20'
wikisql
CREATE TABLE table_1342359_17 ( candidates VARCHAR, first_elected VARCHAR )
How many people were elected in 1929
SELECT COUNT(candidates) FROM table_1342359_17 WHERE first_elected = 1929
sql_create_context
CREATE TABLE table_19903 ( "Series Ep." text, "Episode" real, "Netflix" text, "Segment A" text, "Segment B" text, "Segment C" text, "Segment D" text )
What is the netflix episode number where Segment D is high-performance engines?
SELECT "Netflix" FROM table_19903 WHERE "Segment D" = 'High-Performance Engines'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
how many married patients had the procedure long title percutaneous abdominal drainage?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "MARRIED" AND procedures.long_title = "Percutaneous abdominal drainage"
mimicsql_data
CREATE TABLE table_34914 ( "Country" text, "Skip" text, "Third" text, "Second" text, "Lead" text )
Which country has a Lead of sarah wazney?
SELECT "Country" FROM table_34914 WHERE "Lead" = 'sarah wazney'
wikisql
CREATE TABLE table_42784 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
What is the Score of the game with arsenal win 4-2 on penalties in the attendance field?
SELECT "Score" FROM table_42784 WHERE "Attendance" = 'arsenal win 4-2 on penalties'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_...
what are the three most frequently ordered procedures for patients that have previously been diagnosed with tracheostomy status in the same hospital encounter during the previous year?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_i...
mimic_iii
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
when the last time patient 031-4987 received a microbiology test on the last hospital visit?
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-4987' AND NOT patient.hospitaldischargetime IS NULL ORDER BY ...
eicu
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
姓名为苏清华的团伙成员,他最常开的药品排序都是什么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '苏清华' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID...
css
CREATE TABLE table_40762 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponents in the final" text, "Score" text )
Who's the Opponents in the final with a Date of june 10, 1996?
SELECT "Opponents in the final" FROM table_40762 WHERE "Date" = 'june 10, 1996'
wikisql
CREATE TABLE department ( dept_name varchar(20), building varchar(15), budget numeric(12,2) ) CREATE TABLE advisor ( s_ID varchar(5), i_ID varchar(5) ) CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade...
Find the average capacity among rooms in each building with a bar chart, and order in ascending by the y axis please.
SELECT building, AVG(capacity) FROM classroom GROUP BY building ORDER BY AVG(capacity)
nvbench
CREATE TABLE table_79321 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
What was the result of the game that was played on february 27, 2000?
SELECT "Result" FROM table_79321 WHERE "Date" = 'february 27, 2000'
wikisql
CREATE TABLE table_name_24 ( played VARCHAR, ga VARCHAR )
What is the total played games of a 22 G.A.?
SELECT COUNT(played) FROM table_name_24 WHERE ga = "22"
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) 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 ReviewT...
unique posttypes for software languages.
SELECT * FROM PostTypes
sede
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...
give me the number of patients whose days of hospital stay is greater than 6 and drug name is collagenase ointment?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "6" AND prescriptions.drug = "Collagenase Ointment"
mimicsql_data
CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE paperdataset ( paperid ...
How many papers was published in nature communications in 2015
SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE paper.year = 2015 AND venue.venueid = paper.venueid AND venue.venuename = 'nature communications'
scholar
CREATE TABLE table_6271 ( "Tournament" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "Career Win-Loss" text )
What is in 2002 has a 2001 score 1 0, and a 2000 of 3 0?
SELECT "2002" FROM table_6271 WHERE "2001" = '1–0' AND "2000" = '3–0'
wikisql
CREATE TABLE table_10618 ( "Entrant" text, "Constructor" text, "Chassis" text, "Engine" text, "Tyre" text, "Driver" text, "Rounds" text )
In what rounds did the P15 Chassis and tyre D participate?
SELECT "Rounds" FROM table_10618 WHERE "Tyre" = 'd' AND "Chassis" = 'p15'
wikisql
CREATE TABLE table_10174 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Tell me the driver for 58 laps
SELECT "Driver" FROM table_10174 WHERE "Laps" = '58'
wikisql
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 demographic (...
provide the number of patients whose admission type is elective and lab test name is basophils?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Basophils"
mimicsql_data
CREATE TABLE table_name_89 ( constructor VARCHAR, year VARCHAR, driver VARCHAR )
What was the constructor of the car that Hermann Lang drove after 1935?
SELECT constructor FROM table_name_89 WHERE year > 1935 AND driver = "hermann lang"
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PendingFlags ( Id nu...
WordPress Related Questions - 8 Months.
SELECT DISTINCT p.Id AS "ID", p.CreationDate AS "Date", p.Tags AS "Tags" FROM Posts AS p WHERE p.CreationDate BETWEEN '2019-01-01' AND '2019-08-28' AND (p.Tags LIKE '%wordpress%' OR p.Tags LIKE 'yoast%' OR p.Tags LIKE '%woocommerce%' OR p.Tags LIKE 'buddypress%' OR p.Tags LIKE 'bbpress%' OR p.Tags LIKE 'contact-form-7%...
sede
CREATE TABLE table_18245 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
Which party is associated with the person who was first elected in 1982?
SELECT "Party" FROM table_18245 WHERE "First elected" = '1982'
wikisql
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 prescriptions ( subject_id text, hadm_id...
provide the number of patients whose marital status is single and gender is f?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.gender = "F"
mimicsql_data
CREATE TABLE table_72292 ( "Season" text, "League" text, "Rank" real, "Games" real, "Points" real, "GF" real, "GA" real, "Manager" text, "Top Scorer" text, "Goals" real )
How many seasons had a rank of 16?
SELECT COUNT("Season") FROM table_72292 WHERE "Rank" = '16'
wikisql
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text,...
Write a query that will return the Website URL for the User called Mat Mannion..
SELECT b.Text, b.CreationDate FROM Users AS a INNER JOIN Comments AS b ON a.Id = b.UserId WHERE a.DisplayName = 'Mat Mannion' ORDER BY b.CreationDate DESC
sede
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 demographic (...
count the number of patients whose admission type was newborn and discharge location was home.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.discharge_location = "HOME"
mimicsql_data
CREATE TABLE table_33685 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the largest crowd for North Melbourne
SELECT MAX("Crowd") FROM table_33685 WHERE "Home team" = 'north melbourne'
wikisql
CREATE TABLE table_1341640_11 ( candidates VARCHAR, first_elected VARCHAR )
How many candidates were first elected in 1972?
SELECT COUNT(candidates) FROM table_1341640_11 WHERE first_elected = 1972
sql_create_context
CREATE TABLE table_name_50 ( year_opened VARCHAR, state VARCHAR, capacity VARCHAR )
What was the year opened for North Carolina with a smaller than 21,500 capacity?
SELECT year_opened FROM table_name_50 WHERE state = "north carolina" AND capacity < 21 OFFSET 500
sql_create_context
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, ...
the last year, what were the three most frequent medications prescribed within 2 months to the female patients with age 60 or above after being diagnosed with septic shock?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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 ...
mimic_iii
CREATE TABLE table_name_8 ( writer VARCHAR, actual_title VARCHAR )
What is the Writer with an Actual Title that is mork & mindy?
SELECT writer FROM table_name_8 WHERE actual_title = "mork & mindy"
sql_create_context
CREATE TABLE table_33315 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the average size of the crowd for matches held at Corio Oval?
SELECT AVG("Crowd") FROM table_33315 WHERE "Venue" = 'corio oval'
wikisql
CREATE TABLE table_name_78 ( date VARCHAR, votes VARCHAR )
On what date were there 50,324 votes?
SELECT date FROM table_name_78 WHERE votes = "50,324"
sql_create_context
CREATE TABLE table_14995 ( "Wrestler" text, "Reigns" text, "Days held" real, "Location" text, "Successful defenses" text, "Event" text )
Which Reigns has 92 days held?
SELECT "Reigns" FROM table_14995 WHERE "Days held" = '92'
wikisql
CREATE TABLE table_44799 ( "Date" text, "Venue" text, "Opponents" text, "Score" text, "Comp" text, "Attendance" text )
Which Venue has a Opponents of halmstad and a Score of 1-1?
SELECT "Venue" FROM table_44799 WHERE "Opponents" = 'halmstad' AND "Score" = '1-1'
wikisql
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 cost of a diagnosis for an acute respiratory failure - due to increased co2 production?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to increased co2 production')
eicu
CREATE TABLE table_26375386_28 ( rank_by_average VARCHAR, couple VARCHAR )
How many ranks by average when Keiron & Brianne are the couple?
SELECT COUNT(rank_by_average) FROM table_26375386_28 WHERE couple = "Keiron & Brianne"
sql_create_context
CREATE TABLE table_55671 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Date" text )
When the game was played at the EMCG venue, who was the away team?
SELECT "Away team" FROM table_55671 WHERE "Venue" = 'emcg'
wikisql
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...
零三年八月三日至一五年十一月二十一日,药品173729-a在小儿胃肠外科有多少开药量
SELECT COUNT(*) FROM t_kc22 WHERE MED_ORG_DEPT_NM = '小儿胃肠外科' AND STA_DATE BETWEEN '2003-08-03' AND '2015-11-21' AND SOC_SRT_DIRE_CD = '173729-a'
css
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 prescription...
what is the lab test name for the patient kelly gallardo?
SELECT lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Kelly Gallardo"
mimicsql_data