context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE patients ( row_id number, subject_...
what were the top five most frequent diagnoses among the patients in the age 30s in 2104?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
mimic_iii
CREATE TABLE table_24285393_1 ( country_or_region VARCHAR, highest_point VARCHAR )
What country has the most height in the northwestern peak of rysy?
SELECT country_or_region FROM table_24285393_1 WHERE highest_point = "Northwestern peak of Rysy"
sql_create_context
CREATE TABLE table_11622255_1 ( tournament VARCHAR, winner VARCHAR )
what's the tournament where winner is raymond floyd (1)
SELECT tournament FROM table_11622255_1 WHERE winner = "Raymond Floyd (1)"
sql_create_context
CREATE TABLE table_39131 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What date was Montreal the visitor?
SELECT "Date" FROM table_39131 WHERE "Visitor" = 'montreal'
wikisql
CREATE TABLE table_21789 ( "Poll Source" text, "Dates administered" text, "Democrat: John Lynch" text, "Republican: Joe Kenney" text, "Lead Margin" real )
Name the most lead margin for republican joe kenney being 23%
SELECT MAX("Lead Margin") FROM table_21789 WHERE "Republican: Joe Kenney" = '23%'
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 were the five most commonly prescribed drugs at the same time in this year for patients who were prescribed famotidine (pf) 20 mg/2 ml iv soln?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'famotidine (pf) 20 mg/2 ml iv soln' AND DATETIME(me...
eicu
CREATE TABLE table_name_70 ( bronze INTEGER, gold VARCHAR, silver VARCHAR )
What is the lowest number of bronze medals for a country with less than 1 gold and 0 silver?
SELECT MIN(bronze) FROM table_name_70 WHERE gold = 1 AND silver < 0
sql_create_context
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...
患者43179204有哪些检验报告的结果指标全部正常?看看这些检验报告的单号
SELECT jybgb.BGDH FROM hz_info JOIN zzmzjzjlb JOIN jybgb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '43179204' AND NOT jybgb.BGDH IN (SELECT jyjgzbb.BGDH FRO...
css
CREATE TABLE table_name_53 ( basikal VARCHAR, ikut VARCHAR, mana VARCHAR, pergi VARCHAR )
what is basikal when mana is mano, pergi is gi and Ikut is turuk?
SELECT basikal FROM table_name_53 WHERE mana = "mano" AND pergi = "gi" AND ikut = "turuk"
sql_create_context
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
07375083的参保人住院整数金额有多少次
SELECT COUNT(*) FROM t_kc21 WHERE PERSON_ID = '07375083' AND CLINIC_TYPE = '住院' AND MOD(MED_AMOUT, 1) = 0
css
CREATE TABLE table_41959 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Record" text )
What Leading scorer had a Score of 80 112?
SELECT "Leading scorer" FROM table_41959 WHERE "Score" = '80–112'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, ...
what test was given to patient 10855 the first time this month?
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 = 10855) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month...
mimic_iii
CREATE TABLE table_18380 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
Which district elected incumbent Earle Cabell?
SELECT "District" FROM table_18380 WHERE "Incumbent" = 'Earle Cabell'
wikisql
CREATE TABLE table_name_66 ( date VARCHAR, record VARCHAR )
When did the Indians play a game with a record of 28-41?
SELECT date FROM table_name_66 WHERE record = "28-41"
sql_create_context
CREATE TABLE table_78380 ( "Season" text, "1st Division" text, "Relegated" text, "2nd Division" text, "Promoted" text )
What was relegated in the 2nd division of middlesex?
SELECT "Relegated" FROM table_78380 WHERE "2nd Division" = 'middlesex'
wikisql
CREATE TABLE table_77029 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What is the decision of the game on January 13?
SELECT "Decision" FROM table_77029 WHERE "Date" = 'january 13'
wikisql
CREATE TABLE table_name_21 ( city VARCHAR, group VARCHAR )
WHat kind of 2009 season has a City of panama city, and a Group of group b?
SELECT 2009 AS _season FROM table_name_21 WHERE city = "panama city" AND group = "group b"
sql_create_context
CREATE TABLE party_host ( Party_ID int, Host_ID int, Is_Main_in_Charge bool ) CREATE TABLE party ( Party_ID int, Party_Theme text, Location text, First_year text, Last_year text, Number_of_hosts int ) CREATE TABLE host ( Host_ID int, Name text, Nationality text, Age...
How many hosts does each nationality have? List the nationality and the count with a bar chart, display by the Y in ascending.
SELECT Nationality, COUNT(*) FROM host GROUP BY Nationality ORDER BY COUNT(*)
nvbench
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
find tags with tag dot tag not dot.
SELECT t.TagName, t2.TagName FROM Tags AS t, Tags AS t2 WHERE t.TagName = REPLACE(t2.TagName, '.', '') AND t.Id != t2.Id
sede
CREATE TABLE table_name_50 ( lost VARCHAR, try_bp VARCHAR, club VARCHAR )
Can you tell the Lost that has the Try BP of 10, and the Club of uwic rfc?
SELECT lost FROM table_name_50 WHERE try_bp = "10" AND club = "uwic rfc"
sql_create_context
CREATE TABLE table_56033 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What team owns the Venue of western oval?
SELECT "Home team" FROM table_56033 WHERE "Venue" = 'western oval'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( ...
tell me the percentile of the sodium value of 136.0 among patients of the same age as patient 012-4131 in their first hospital encounter?
SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'sodium' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '012-4131' AND NOT patient...
eicu
CREATE TABLE table_65334 ( "Vessel" text, "Origin" text, "Type" text, "In service" real, "Unit" text )
What is the type for a vessel of lublin class?
SELECT "Type" FROM table_65334 WHERE "Vessel" = 'lublin class'
wikisql
CREATE TABLE table_6815 ( "Position" real, "Club" text, "Games played" real, "Wins" real, "Draws" real, "Loses" real, "Goals scored" real, "Goals conceded" real, "Points" real )
What is the highest number of losses for teams with under 3 draws and 51 points?
SELECT MAX("Loses") FROM table_6815 WHERE "Draws" < '3' AND "Points" = '51'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CRE...
has patient 028-42654 had a lab test until 54 months ago.
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-42654')) AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-54 month')
eicu
CREATE TABLE table_5979 ( "Year" text, "Total matches" real, "Total W-L-H" text, "Singles W-L-H" text, "Points won" real, "Points %" text )
Which Total matches is the highest one that has Points % of 70%?
SELECT MAX("Total matches") FROM table_5979 WHERE "Points %" = '70%'
wikisql
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE VoteTypes ( Id number, Name text...
What are the top 10 tags associated with posts created in 2017?.
SELECT Tags.TagName, Tags.Count FROM Tags WHERE Tags.Id IN (SELECT PostTags.TagId FROM PostTags WHERE PostTags.PostId IN (SELECT Posts.Id FROM Posts WHERE YEAR(Posts.CreationDate) = 2017)) ORDER BY (Tags.Count) DESC LIMIT 10
sede
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, ...
count the number of people that died after being diagnosed with ac dvt/emb prox low ext in the same month until 2102.
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime 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_di...
mimic_iii
CREATE TABLE table_25376 ( "No." real, "Player" text, "Hometown" text, "Class" text, "Position" text, "Height" text, "Weight" real )
What is every number for the hometown of Canton, Illinois?
SELECT "No." FROM table_25376 WHERE "Hometown" = 'Canton, Illinois'
wikisql
CREATE TABLE table_74335 ( "Team" text, "Stadium" text, "Home Games" real, "Average Attendance" real, "Total Attendance" real, "Capacity Percentage" text )
What was the capacity for the Denver Broncos?
SELECT "Capacity Percentage" FROM table_74335 WHERE "Team" = 'Denver Broncos'
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 was the number of patients who had a tobramycin - random lab test since 2103?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'tobramycin - random' AND STRFTIME('%y', lab.labresulttime) >= '2103')
eicu
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
how many patients of asian ethnicity are admitted before the year 2110?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.admityear < "2110"
mimicsql_data
CREATE TABLE reservations ( code number, room text, checkin text, checkout text, rate number, lastname text, firstname text, adults number, kids number ) CREATE TABLE rooms ( roomid text, roomname text, beds number, bedtype text, maxoccupancy number, basepric...
What kind of decor has the least number of reservations?
SELECT T2.decor FROM reservations AS T1 JOIN rooms AS T2 ON T1.room = T2.roomid GROUP BY T2.decor ORDER BY COUNT(T2.decor) LIMIT 1
spider
CREATE TABLE table_62449 ( "Date" text, "Result" text, "Competition" text, "Venue" text, "Attendance" real )
What date was the competition of the Emerging Nations Tournament and a result of Scotland 34-9 Russia?
SELECT "Date" FROM table_62449 WHERE "Competition" = 'emerging nations tournament' AND "Result" = 'scotland 34-9 russia'
wikisql
CREATE TABLE table_name_31 ( assist_pass VARCHAR, goal VARCHAR )
Which Assist/pass has a Goal of 5?
SELECT assist_pass FROM table_name_31 WHERE goal = "5"
sql_create_context
CREATE TABLE table_33070 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Who was the away team when the home team scored 9.16 (70)?
SELECT "Away team" FROM table_33070 WHERE "Home team score" = '9.16 (70)'
wikisql
CREATE TABLE table_name_12 ( date VARCHAR, venue VARCHAR )
On what date was the venue of Glenferrie Oval?
SELECT date FROM table_name_12 WHERE venue = "glenferrie oval"
sql_create_context
CREATE TABLE table_57036 ( "Date" text, "Tournament" text, "Location" text, "Purse( $ )" real, "Winner" text, "Score" text, "1st Prize( $ )" real )
On what date was the gte north classic tournament?
SELECT "Date" FROM table_57036 WHERE "Tournament" = 'gte north classic'
wikisql
CREATE TABLE Students ( student_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), date_first_rental DATETIME, date_left_university DATETIME, other_student_details VARC...
A bar chart shows the distribution of other_details and the average of monthly_rental , and group by attribute other_details.
SELECT other_details, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_48145 ( "Season" text, "GP\u2013GS" text, "Comp\u2013Att" text, "Pct." text, "Yards" text, "Long" text, "Avg/G" text )
What is the long value for the year with an average/game of 160.9?
SELECT "Long" FROM table_48145 WHERE "Avg/G" = '160.9'
wikisql
CREATE TABLE table_10166 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the fewest number of attendees at Kardinia Park?
SELECT MIN("Crowd") FROM table_10166 WHERE "Venue" = 'kardinia park'
wikisql
CREATE TABLE table_name_49 ( block_a VARCHAR, prince_devitt VARCHAR )
What is Block A when Prince Devitt is Devitt (9:53)?
SELECT block_a FROM table_name_49 WHERE prince_devitt = "devitt (9:53)"
sql_create_context
CREATE TABLE table_12419515_4 ( directed_by VARCHAR, written_by VARCHAR )
Who directed the title that was written by Adam Milch?
SELECT directed_by FROM table_12419515_4 WHERE written_by = "Adam Milch"
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...
give me the number of patients whose admission year is less than 2200 and drug route is pr?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2200" AND prescriptions.route = "PR"
mimicsql_data
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, sy...
how much does a drug called glucagen cost.
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'glucagen')
eicu
CREATE TABLE table_name_15 ( date VARCHAR, winners VARCHAR )
When did Motherwell win?
SELECT date FROM table_name_15 WHERE winners = "motherwell"
sql_create_context
CREATE TABLE table_204_693 ( id number, "place" text, "total" number, "men" number, "women" number, "children" number, "elderly" number, "serbs" number, "jews" number, "romani" number, "rusyns" number, "hungarians" number, "russians" number )
how many total women were victims ?
SELECT SUM("women") FROM table_204_693
squall
CREATE TABLE table_64135 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the fewest number of golds for teams with a total of 3 and fewer than 2 silvers?
SELECT MIN("Gold") FROM table_64135 WHERE "Total" = '3' AND "Silver" < '2'
wikisql
CREATE TABLE table_204_110 ( id number, "year" number, "champion" text, "city" text, "llws" text, "record" text )
what year did the champions have a 3-0 record before 1983 ?
SELECT "year" FROM table_204_110 WHERE "record" = '3-0' AND "year" < 1983
squall
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 prescriptions ( subject_id text, hadm_id...
provide the age and religion of subject id 65652.
SELECT demographic.age, demographic.religion FROM demographic WHERE demographic.subject_id = "65652"
mimicsql_data
CREATE TABLE table_64999 ( "Date" text, "Venue" text, "Score" text, "Comp" text, "Report" text )
What Report is on June 3, 2000?
SELECT "Report" FROM table_64999 WHERE "Date" = 'june 3, 2000'
wikisql
CREATE TABLE table_name_58 ( episode_no VARCHAR, region_no VARCHAR, no_of_dvds VARCHAR )
WHAT EPISODE HAS A REGION NUMBER BIGGER THAN 1, AND 32 DVDS?
SELECT episode_no FROM table_name_58 WHERE region_no > 1 AND no_of_dvds = "32"
sql_create_context
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 Posts ( Id number, PostTypeId number, AcceptedAnswer...
Average quality of answers by users. Average votes of answers for users with at least MinAnswers answers
SELECT ROUND(CAST(Votes AS FLOAT) / Posts, 2) AS "votes", ROUND(CAST(Upvotes AS FLOAT) / Posts, 2) AS "upvotes", ROUND(CAST(Downvotes AS FLOAT) / Posts, 2) AS "downvotes", ROUND(CAST(Upvotes AS FLOAT) / Downvotes, 2) AS "up/down_ratio" FROM (SELECT COUNT(DISTINCT v.PostId) AS "posts", COUNT(*) AS "votes", COUNT(CASE v....
sede
CREATE TABLE table_name_66 ( final VARCHAR, team VARCHAR )
What is Final, when Team is United States (USA) USA I?
SELECT final FROM table_name_66 WHERE team = "united states (usa) usa i"
sql_create_context
CREATE TABLE table_18329 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
Who were the candidates when Shirley Chisholm was the incumbent?
SELECT "Candidates" FROM table_18329 WHERE "Incumbent" = 'Shirley Chisholm'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
从08年2月22到09年5-23医疗机构1037880接诊公务员的就诊记录数
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '1037880' AND gwyjzb.IN_HOSP_DATE BETWEEN '2008-02-22' AND '2009-05-23'
css
CREATE TABLE table_18278508_2 ( position VARCHAR, co_contestant__yaar_vs_pyaar_ VARCHAR )
What position did Pranita Sahu's team get?
SELECT position FROM table_18278508_2 WHERE co_contestant__yaar_vs_pyaar_ = "Pranita Sahu"
sql_create_context
CREATE TABLE table_31768 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
Tell me the result for attendance of 54,462
SELECT "Result" FROM table_31768 WHERE "Attendance" = '54,462'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
how many of the patients with intraoperative cardiac pacemaker had clinical chemistry lab tests?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Intraoperative cardiac pacemaker" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
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 TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_...
and flights leaving from ATLANTA to OAKLAND leaving after 1700
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.departure_time > 1700 AND flight.to_airport = AIRPORT_SERVICE_1.airpo...
atis
CREATE TABLE wrestler ( Wrestler_ID int, Name text, Reign text, Days_held text, Location text, Event text ) CREATE TABLE Elimination ( Elimination_ID text, Wrestler_ID text, Team text, Eliminated_By text, Elimination_Move text, Time text )
Show different teams in eliminations and the number of eliminations from each team Visualize by bar chart, and order by the the total number from high to low please.
SELECT Team, COUNT(*) FROM Elimination GROUP BY Team ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_train_84 ( "id" int, "gender" string, "mini_mental_state_examination_mmse" int, "modified_hachinski_ischemia_scale" int, "post_menopausal" bool, "allergy_to_rifaximin" bool, "surgically_sterilized" bool, "body_mass_index_bmi" float, "age" float, "NOUSE" float )
subject is a male or female between the ages of 50 and 80 with a body mass index ( bmi ) below 31 . female must be post _ menopausal at least 1 year or surgically sterilized.
SELECT * FROM table_train_84 WHERE (gender = 'male' OR (gender = 'female' AND (post_menopausal >= 1 OR surgically_sterilized = 1))) AND (age >= 50 AND age <= 80) AND body_mass_index_bmi < 31
criteria2sql
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, ...
医疗机构9923455使用次数前12名的项目有哪些
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.MED_SER_ORG_NO = '9923455' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 12
css
CREATE TABLE table_name_59 ( year VARCHAR, wins VARCHAR )
What year has 2 wins?
SELECT year FROM table_name_59 WHERE wins = "2"
sql_create_context
CREATE TABLE table_name_93 ( home_team VARCHAR )
What is richmond's score as the home team?
SELECT home_team AS score FROM table_name_93 WHERE home_team = "richmond"
sql_create_context
CREATE TABLE table_14006 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Points" real )
How many points are in the scored category for the team that played less than 18 games?
SELECT SUM("Scored") FROM table_14006 WHERE "Played" < '18'
wikisql
CREATE TABLE table_43426 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
In Week 7, what is the highest attendance number?
SELECT MAX("Attendance") FROM table_43426 WHERE "Week" = '7'
wikisql
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
在医院7400991就诊的病号尤安晏其就诊的科室名称包含肝胆科的全部门诊就诊记录的流水号是什么?
SELECT mzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN mzjzjlb 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 WHERE person_info.XM = '尤安晏' AND hz_info.YLJGDM = '7400991' AND mzjzjlb.JZKSMC LIKE '%肝胆科%'
css
CREATE TABLE table_name_49 ( attendance VARCHAR, game VARCHAR, date VARCHAR )
Which Attendance has a Game smaller than 3, and a Date of october 31?
SELECT COUNT(attendance) FROM table_name_49 WHERE game < 3 AND date = "october 31"
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_CLINIC_ID text, MED_DIRE_CD tex...
在病人鲁烨烨的医疗记录中开出了多少次价格不超过809.11元的药品?是多少就诊编号?
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '鲁烨烨' AND NOT gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 809.11) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '鲁烨烨' AND NOT fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM...
css
CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE L...
Bin all date of transactions into the weekday interval, and compute the average of the share count for each bin Return the result using a bar chart, and show by the Y in descending.
SELECT date_of_transaction, AVG(share_count) FROM Transactions ORDER BY AVG(share_count) DESC
nvbench
CREATE TABLE table_name_71 ( place VARCHAR, player VARCHAR, score VARCHAR )
What place does Fred Funk, who has a score of 69-69=138, have?
SELECT place FROM table_name_71 WHERE score = 69 - 69 = 138 AND player = "fred funk"
sql_create_context
CREATE TABLE table_name_79 ( circuit VARCHAR, round VARCHAR )
What circuit had 16 rounds?
SELECT circuit FROM table_name_79 WHERE round = 16
sql_create_context
CREATE TABLE table_56216 ( "Candidate" text, "Money Raised, 3Q" text, "Loans Received, 3Q" text, "Money Spent, 3Q" text, "Total Receipts" text, "Cash On Hand" text, "After Debt" text )
What After debt has raised 3Q of $5,358,585?
SELECT "After Debt" FROM table_56216 WHERE "Money Raised, 3Q" = '$5,358,585'
wikisql
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the average of revenue , and group by attribute name, and could you list by the x axis in ascending please?
SELECT T2.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name
nvbench
CREATE TABLE table_15306124_1 ( league_of_communists VARCHAR, municipality VARCHAR )
How many league of communists have the municipality of bar?
SELECT COUNT(league_of_communists) FROM table_15306124_1 WHERE municipality = "Bar"
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 prescriptions ( subject_id text, hadm_id...
Find out the number of patients with aortic valve disorder diagnoses who had an ascitic lab fluid 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.short_title = "Aortic valve disorder" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE table_name_27 ( race VARCHAR, winner_or_2nd VARCHAR )
What was the race when the winner of 2nd was Voleuse?
SELECT race FROM table_name_27 WHERE winner_or_2nd = "voleuse"
sql_create_context
CREATE TABLE table_name_54 ( intake INTEGER, faith VARCHAR, dcsf_number VARCHAR )
Can you tell me the sum of Intake that has the Faith of rc, and the DCSF number larger than 2428?
SELECT SUM(intake) FROM table_name_54 WHERE faith = "rc" AND dcsf_number > 2428
sql_create_context
CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT )
what is minimum age for different job title?
SELECT job, MIN(age) FROM Person GROUP BY job
nvbench
CREATE TABLE table_name_40 ( win__percentage INTEGER, manager VARCHAR, lost VARCHAR )
What is the highes win % that manager juan carlos ch vez's team had when they lost less than 4 times?
SELECT MAX(win__percentage) FROM table_name_40 WHERE manager = "juan carlos chávez" AND lost < 4
sql_create_context
CREATE TABLE table_6266 ( "Episode" text, "Title" text, "Writer(s)" text, "Preservation" text, "Original airdate" text )
Has Episode 1b-16 (42) been preserved?
SELECT "Preservation" FROM table_6266 WHERE "Episode" = '1b-16 (42)'
wikisql
CREATE TABLE table_56531 ( "Year" text, "Starts" real, "Cuts made" real, "Wins" real, "Top 10" real, "Top 25" real, "Earnings ($)" real, "Money list rank" text )
What is the highest number of Cuts made that has a Top 10 smaller than 8 and Wins larger than 0?
SELECT MAX("Cuts made") FROM table_56531 WHERE "Top 10" < '8' AND "Wins" > '0'
wikisql
CREATE TABLE table_54942 ( "Year" real, "Artist" text, "Composition" text, "Mintage" real, "Issue Price" text )
Which Artist has an Issue Price of $8,159.95?
SELECT "Artist" FROM table_54942 WHERE "Issue Price" = '$8,159.95'
wikisql
CREATE TABLE instruments ( instrument VARCHAR )
What is the most used instrument?
SELECT instrument FROM instruments GROUP BY instrument ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE table_47597 ( "Rank" text, "Team" text, "Run 1" text, "Run 2" text, "Run 3" text, "Final" text )
Which final has a run of 1:19.49?
SELECT "Final" FROM table_47597 WHERE "Run 3" = '1:19.49'
wikisql
CREATE TABLE table_1272844_2 ( reward VARCHAR, finish VARCHAR )
Who received the reward on the episode where the finish was '3rd voted out day 8'?
SELECT reward FROM table_1272844_2 WHERE finish = "3rd voted Out Day 8"
sql_create_context
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the average of manager_id over the hire_date bin hire_date by time by a bar chart, could you sort total number from high to low order please?
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(MANAGER_ID) DESC
nvbench
CREATE TABLE table_38215 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
Which competition was on August 11, 1996?
SELECT "Competition" FROM table_38215 WHERE "Date" = 'august 11, 1996'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
count the number of patients whose marital status is divorced and diagnoses short title is cardiogenic shock?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "DIVORCED" AND diagnoses.short_title = "Cardiogenic shock"
mimicsql_data
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Comments ( Id number, PostId number, ...
Top 20 Bounty hunters per # of bounties and rep.
SELECT Posts.OwnerUserId AS "user_link", COUNT(*) AS "bounties_won", SUM(Votes.BountyAmount) AS "rep_gained" FROM Votes INNER JOIN Posts ON Votes.PostId = Posts.Id WHERE VoteTypeId = 9 GROUP BY Posts.OwnerUserId ORDER BY 2 DESC LIMIT 20
sede
CREATE TABLE table_26914854_3 ( team VARCHAR, date_of_appointment VARCHAR )
what is the date of appointment 11 june 2010?
SELECT team FROM table_26914854_3 WHERE date_of_appointment = "11 June 2010"
sql_create_context
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), ...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize a line chart about the change of department_id over hire_date , rank HIRE_DATE in descending order.
SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE table_name_9 ( event VARCHAR, round VARCHAR, record VARCHAR )
What event had 1 round and a record of 6-2?
SELECT event FROM table_name_9 WHERE round = 1 AND record = "6-2"
sql_create_context
CREATE TABLE table_name_54 ( grid INTEGER, laps VARCHAR, rider VARCHAR )
Can you tell me the sum of Grid that has the Laps of 30, and the Rider of toni elias?
SELECT SUM(grid) FROM table_name_54 WHERE laps = 30 AND rider = "toni elias"
sql_create_context
CREATE TABLE table_22580855_1 ( written_by VARCHAR, directed_by VARCHAR )
How many writers write the episode whose director is Jonathan Herron?
SELECT COUNT(written_by) FROM table_22580855_1 WHERE directed_by = "Jonathan Herron"
sql_create_context
CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_seaso...
A bar chart showing the average of capacity of cinemas open for each year, and order in ascending by the the average of capacity.
SELECT Openning_year, AVG(Capacity) FROM cinema GROUP BY Openning_year ORDER BY AVG(Capacity)
nvbench
CREATE TABLE mountain ( mountain_id number, name text, height number, prominence number, range text, country text ) CREATE TABLE climber ( climber_id number, name text, country text, time text, points number, mountain_id number )
What are the names of mountains in ascending alphabetical order?
SELECT name FROM mountain ORDER BY name
spider
CREATE TABLE table_34990 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Record" text )
What's the date of the game that has the Bulls as a visiting team?
SELECT "Date" FROM table_34990 WHERE "Visitor" = 'bulls'
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 demographic ( subject_id text, hadm_id t...
how many patients categorized under chemistry lab test are less than 58 years?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "58" AND lab."CATEGORY" = "Chemistry"
mimicsql_data