context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE...
count the number of people diagnosed with chronic nephritis nec who did not come to the hospital in the same month.
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'chronic ne...
mimic_iii
CREATE TABLE table_24934 ( "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 (million)" text )
Name the title that got 1.54 viewers
SELECT "Title" FROM table_24934 WHERE "U.S. viewers (million)" = '1.54'
wikisql
CREATE TABLE table_13444 ( "Debut year" real, "Player" text, "Games" real, "Goals" real, "Years at club" text )
Which Goals have Games of 51, and a Debut year smaller than 1992?
SELECT MIN("Goals") FROM table_13444 WHERE "Games" = '51' AND "Debut year" < '1992'
wikisql
CREATE TABLE table_1353096_1 ( channel_tv___dt__ VARCHAR, station VARCHAR )
What channel has station kdfw ++?
SELECT channel_tv___dt__ FROM table_1353096_1 WHERE station = "KDFW ++"
sql_create_context
CREATE TABLE table_14460937_2 ( pos INTEGER, clubs VARCHAR )
what is the minimum pos with clubs being 16
SELECT MIN(pos) FROM table_14460937_2 WHERE clubs = "16"
sql_create_context
CREATE TABLE table_name_16 ( sport VARCHAR, name VARCHAR )
What sport did Miroslav Jambor Richard Csejtey participate in?
SELECT sport FROM table_name_16 WHERE name = "miroslav jambor richard csejtey"
sql_create_context
CREATE TABLE table_3608 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text )
The district North Carolina 10 have what candidates?
SELECT "Candidates" FROM table_3608 WHERE "District" = 'North Carolina 10'
wikisql
CREATE TABLE table_name_96 ( owner VARCHAR )
What is the owner of the channel that has a 2012 rating of 5.42?
SELECT owner FROM table_name_96 WHERE 2012 = "5.42"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetake...
what was the yearly maximum value of weight for patient 015-56556 until 2104?
SELECT MAX(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-56556') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) <= '2104' GROUP BY STRFTIME('%y', patient.unitadmitt...
eicu
CREATE TABLE table_54772 ( "Rd #" real, "Pick #" real, "Player" text, "Team (League)" text, "Reg GP" real, "Pl GP" real )
What is the total of PI GP played by Anton Rodin with a Reg GP less than 0?
SELECT COUNT("Pl GP") FROM table_54772 WHERE "Player" = 'anton rodin' AND "Reg GP" < '0'
wikisql
CREATE TABLE geographic ( city_name varchar, county varchar, region varchar ) CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_n...
give me some restaurants good for french food ?
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
restaurants
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 have been prescribed the drug with code hald5i?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "HALD5I"
mimicsql_data
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is the number of patients whose ethnicity is black/cape verdean and age is less than 86?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.age < "86"
mimicsql_data
CREATE TABLE table_68607 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
What were the highest points before the year 1974?
SELECT MAX("Points") FROM table_68607 WHERE "Year" < '1974'
wikisql
CREATE TABLE table_62844 ( "Tournament" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
What's the 2012 when 2009 was 205?
SELECT "2012" FROM table_62844 WHERE "2009" = '205'
wikisql
CREATE TABLE table_204_78 ( id number, "no." number, "train no." text, "origin" text, "destination" text, "train name" text )
what are the number of times bangalore is listed as the destination ?
SELECT COUNT(*) FROM table_204_78 WHERE "destination" = 'bangalore'
squall
CREATE TABLE table_50508 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
Where was the game where the senators scored 80 points?
SELECT "Location" FROM table_50508 WHERE "Points" = '80'
wikisql
CREATE TABLE table_name_20 ( region VARCHAR, format VARCHAR )
Which region had a release format of CD Maxi?
SELECT region FROM table_name_20 WHERE format = "cd maxi"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREA...
until 09/10/2105, what was the daily average dose of enteral formula volume/bolus amt (ml) of patient 004-13672?
SELECT AVG(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 = '004-13672')) AND intakeoutput.celllabel = 'enter...
eicu
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 (...
how many of the patients with item id 51181 had an unobtainable religious belief?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "UNOBTAINABLE" AND lab.itemid = "51181"
mimicsql_data
CREATE TABLE sampledata15 ( sample_pk number, state text, year text, month text, day text, site text, commod text, source_id text, variety text, origin text, country text, disttype text, commtype text, claim text, quantity number, growst text, packst t...
What's the unit of measure for sample 3879?
SELECT conunit FROM resultsdata15 WHERE sample_pk = 3879
pesticide
CREATE TABLE table_74580 ( "Lane" real, "Name" text, "Nationality" text, "Split (50m)" real, "Time" real )
What is the total sum of 50m splits for josefin lillhage in lanes above 8?
SELECT SUM("Split (50m)") FROM table_74580 WHERE "Name" = 'josefin lillhage' AND "Lane" > '8'
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...
二零零七年十月二十一日到二零一一年七月十一日,4553878医院的4597科室涉及到多少医疗费用
SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '4553878' AND gwyjzb.MED_ORG_DEPT_CD = '4597' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '4553878' AND fgwyjzb.MED_ORG_DEPT_CD = '4597') AND t...
css
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
Bar chart x axis job y axis the average of age, list by the y-axis in desc.
SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY AVG(age) DESC
nvbench
CREATE TABLE Affiliated_With ( Physician INTEGER, Department INTEGER, PrimaryAffiliation BOOLEAN ) CREATE TABLE Appointment ( AppointmentID INTEGER, Patient INTEGER, PrepNurse INTEGER, Physician INTEGER, Start DATETIME, End DATETIME, ExaminationRoom TEXT ) CREATE TABLE Patient ...
Return the name of each physician and the number of patients he or she treats in a bar chart, and sort total number from high to low order.
SELECT T1.Name, COUNT(*) FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP GROUP BY T1.EmployeeID ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE chartevents ( ro...
what was the first value of an mch lab test in patient 17953?
SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17953) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mch') ORDER BY labevents.charttime LIMIT 1
mimic_iii
CREATE TABLE table_20555 ( "Vehicle" text, "EPA rated All-electric range" text, "EPA rated combined fuel economy" text, "Alaska ( Juneau )" text, "California (San Francisco)" text, "Mid-Atlantic South (Washington, D.C.)" text, "U.S. national average electric mix" text, "Southeast (Atlant...
What was the emission rating in California for the vehicle that was rated 80 g/mi (50 g/km) in Alaska and 250 g/mi (155 g/km) in the Southeast ?
SELECT "California (San Francisco)" FROM table_20555 WHERE "Alaska ( Juneau )" = '80 g/mi (50 g/km)' AND "Southeast (Atlanta)" = '250 g/mi (155 g/km)'
wikisql
CREATE TABLE table_1302 ( "Date" text, "Cover model" text, "Centerfold model" text, "Interview subject" text, "20 Questions" text, "Pictorials" text )
Name the number of pictorials for 5-85
SELECT COUNT("Pictorials") FROM table_1302 WHERE "Date" = '5-85'
wikisql
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id...
what flights from CHICAGO to KANSAS CITY
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHICAGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'KANSAS...
atis
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswer...
Instances of 'sudo gedit'. 'sudo gedit' instead of 'gksudo gedit' or similar (common misadvice, can make root own dotfiles in home dir)
SELECT Id AS "post_link", Score, ViewCount AS Views FROM Posts WHERE PostTypeId = 2 AND Body LIKE '%sudo gedit%' AND NOT Body LIKE '%gksudo gedit%' ORDER BY Views DESC
sede
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
64287856这个患者以前就诊的地方是哪里?
(SELECT mzjzjlb.YLJGDM FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '64287856') UNION (SELECT zyjzjlb.YLJGDM FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.K...
css
CREATE TABLE table_54794 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
I want the driver for Laps more than 8 and ferrari with Grid of 8
SELECT "Driver" FROM table_54794 WHERE "Laps" > '8' AND "Constructor" = 'ferrari' AND "Grid" = '8'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE transfers ( row_id number...
what did patient 17286 receive for his or her first procedure?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17286) ORDER BY procedures_icd.charttime LIMIT 1)
mimic_iii
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...
give me the number of patients whose item id is 51214?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51214"
mimicsql_data
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
从13年5月11日到2020年4月11日这段时间,列出患者杨丹红所有检验报告单的审核日期时间吗?
SELECT zyjybgb.SHSJ FROM person_info JOIN hz_info JOIN mzjzjlb JOIN zyjybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB WHERE person_info.XM = '杨丹红' ...
css
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE cost ( r...
in 07/this year, is patient 19096's arterial bp [diastolic] ever greater than 58.0?
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19096)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [dias...
mimic_iii
CREATE TABLE table_1342233_32 ( first_elected VARCHAR, incumbent VARCHAR )
Name the total number of first elected for sol bloom
SELECT COUNT(first_elected) FROM table_1342233_32 WHERE incumbent = "Sol Bloom"
sql_create_context
CREATE TABLE table_61497 ( "Tournament" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text )
What's the 2013 result for the grand slam tournaments?
SELECT "2013" FROM table_61497 WHERE "Tournament" = 'grand slam tournaments'
wikisql
CREATE TABLE table_44342 ( "Class" text, "Wheel arrangement" text, "Fleet number(s)" text, "Manufacturer" text, "Year made" text, "Quantity made" text, "Quantity preserved" text )
What manufacturer has a year made of 1923?
SELECT "Manufacturer" FROM table_44342 WHERE "Year made" = '1923'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
负责医疗就诊41231928309的医疗机构科室的编码及医疗机构科室的名称都是什么?
SELECT gwyjzb.MED_ORG_DEPT_CD, gwyjzb.MED_ORG_DEPT_NM FROM gwyjzb WHERE gwyjzb.MED_CLINIC_ID = '41231928309' UNION SELECT fgwyjzb.MED_ORG_DEPT_CD, fgwyjzb.MED_ORG_DEPT_NM FROM fgwyjzb WHERE fgwyjzb.MED_CLINIC_ID = '41231928309'
css
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...
病号13405731在19年2月9日到20年11月19日内被开出过哪些检验报告单它们的检验报告单号都是啥?
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '13405731' AND jybgb.BGRQ BETWEEN '2019-02-09' AND '2020-11-19' UNION...
css
CREATE TABLE table_204_779 ( id number, "network name" text, "flagship" text, "programming type" text, "owner" text, "affiliates" number )
what is the difference between the number of affiliates galavision has and the number of affiliates azteca 13 has ?
SELECT ABS((SELECT "affiliates" FROM table_204_779 WHERE "network name" = 'galavision') - (SELECT "affiliates" FROM table_204_779 WHERE "network name" = 'azteca 13'))
squall
CREATE TABLE table_name_16 ( lane VARCHAR, heat VARCHAR, country VARCHAR, mark VARCHAR )
What is the total lane number for the United States when the mark is 6.62 and the heat is greater than 8?
SELECT COUNT(lane) FROM table_name_16 WHERE country = "united states" AND mark = "6.62" AND heat > 8
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...
病患14360011在06年2月17日到13年1月19日期间,主要看什么病?
SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '14360011' AND t_kc21.IN_HOSP_DATE BETWEEN '2006-02-17' AND '2013-01-19' GROUP BY t_kc21.IN_DIAG_DIS_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE table_30073089_2 ( date VARCHAR, location VARCHAR )
Name the date for s. valentino alla muta , italia
SELECT date FROM table_30073089_2 WHERE location = "S. Valentino Alla Muta , Italia"
sql_create_context
CREATE TABLE Aircraft ( aid VARCHAR, name VARCHAR ) CREATE TABLE Certificate ( eid VARCHAR, aid VARCHAR ) CREATE TABLE Employee ( name VARCHAR, eid VARCHAR )
Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800" INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Airbus A340-300"
sql_create_context
CREATE TABLE table_203_651 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text )
what was galina chistyakova 's last competition ?
SELECT "competition" FROM table_203_651 ORDER BY "year" DESC LIMIT 1
squall
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, ...
How close am I to the Self-learner badge? All self-answers to my own questions. For each answer to my own questions I have question score and answer score. To get the Self-learner badge I need at least 3 votes on an answer among these.
SELECT q.Id AS QuestionId, a.Id AS AnswerId, q.Id AS "post_link", q.Score AS QuestionScore, a.Score AS MyAnswerScore FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id INNER JOIN Users ON Users.Id = q.OwnerUserId WHERE q.OwnerUserId = a.OwnerUserId AND Users.Id = '##UserId##'
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...
count the number of patients whose year of birth is less than 2035 and drug name is oxycodone (immediate release) ?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2035" AND prescriptions.drug = "OxycoDONE (Immediate Release) "
mimicsql_data
CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number, stu_transfer number, dept_code text, stu_phone text, prof_num number ) CREATE TABLE department ( dept_code text, de...
What is the first name of each student enrolled in class ACCT-211?
SELECT T3.stu_fname FROM class AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'
spider
CREATE TABLE table_26542 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
How many production codes were in series 39?
SELECT COUNT("Production code") FROM table_26542 WHERE "No. in series" = '39'
wikisql
CREATE TABLE table_63570 ( "Song" text, "Performer" text, "Original artist" text, "Length" text, "Recorded" text )
Who is the original artist of 'Let's Dance'?
SELECT "Original artist" FROM table_63570 WHERE "Song" = 'let''s dance'
wikisql
CREATE TABLE table_64471 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location" text, "Record" text )
Who was the opponent for game 30?
SELECT "Opponent" FROM table_64471 WHERE "Game" = '30'
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, ...
列出患者55178621医疗记录中的入院诊断疾病编码和名称,主要针对医疗费总额高于9322.98元的
SELECT gwyjzb.IN_DIAG_DIS_CD, gwyjzb.IN_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.PERSON_ID = '55178621' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 9322.98) UNION SELECT fgwyjzb.IN_DIAG_DIS_CD, fgwyjzb.IN_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '55178621' AND fgw...
css
CREATE TABLE table_59914 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9:00 am" text, "11:00 am" text, "noon" text, "12:30 pm" text, "1:00 pm" text, "1:30 pm" text, "2:00 pm" text, "3:00 pm" text, "3:30 pm" text, "4:00 pm" text, "5:00 pm" text, "6:30 pm" ...
What is on at 1:30PM with 12:30 local programs, and Pinky and the Brain shows at 4:00pm?
SELECT "1:30 pm" FROM table_59914 WHERE "12:30 pm" = 'local programs' AND "4:00 pm" = 'pinky and the brain'
wikisql
CREATE TABLE table_name_47 ( scottish_cup INTEGER, position VARCHAR, league_cup VARCHAR, total VARCHAR )
What is the sum of the scottish cup of the forward player with less than 2 league cups and a total greater than 6?
SELECT SUM(scottish_cup) FROM table_name_47 WHERE league_cup < 2 AND total > 6 AND position = "forward"
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number...
tell me the total amount of chest tubes left pleural 1 output for patient 97330 in the previous day.
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97330)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'che...
mimic_iii
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
what is the number of patients whose marital status is married and procedure icd9 code is 3607?
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.icd9_code = "3607"
mimicsql_data
CREATE TABLE table_52380 ( "Player" text, "Tackles" real, "Solo" real, "Assisted" real, "Sack" real, "Yards" real, "TD's" real )
How many yards for the player with 1 solo tackle and over 0 sacks?
SELECT MAX("Yards") FROM table_52380 WHERE "Solo" = '1' AND "Sack" > '0'
wikisql
CREATE TABLE table_name_36 ( player VARCHAR, years_for_jazz VARCHAR )
Which player was active in Jazz in 1975-79?
SELECT player FROM table_name_36 WHERE years_for_jazz = "1975-79"
sql_create_context
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those products with a price between 60 and 120, draw a bar chart about the distribution of name and manufacturer , display by the X from low to high.
SELECT Name, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name
nvbench
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number...
select Id from Posts.
SELECT Id FROM Posts
sede
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
count the number of patients whose admission location is emergency room admit and diagnoses icd9 code is v5416?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.icd9_code = "V5416"
mimicsql_data
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH ...
在17年10月30日到18年12月8日期间,列出金宏茂患者所有检验结果指标记录中用的什么检测方法?
(SELECT jyjgzbb.JCFF FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy...
css
CREATE TABLE table_204_948 ( id number, "year" number, "award" text, "category" text, "film" text, "result" text )
what is the difference between the number times the result was won and the number of times the result was nominated ?
SELECT ABS((SELECT COUNT(*) FROM table_204_948 WHERE "result" = 'won') - (SELECT COUNT(*) FROM table_204_948 WHERE "result" = 'nominated'))
squall
CREATE TABLE table_2562572_20 ( largest_ethnic_group__2002_ VARCHAR, population__2011_ VARCHAR )
Name the largest ethnic group for 24112
SELECT largest_ethnic_group__2002_ FROM table_2562572_20 WHERE population__2011_ = 24112
sql_create_context
CREATE TABLE table_30830 ( "DrumSet Name" text, "Product Line" text, "Years Available" text, "Drum Module" text, "KickDrum Pad" text, "Snare Pad" text, "Tom-Tom Pads" text, "Hi-HatPad/ Controller" text, "CrashandRide CymbalPads" text, "DrumStand (oftenoptional)" text )
for the drumset name td-15k how many snare pads are
SELECT COUNT("Snare Pad") FROM table_30830 WHERE "DrumSet Name" = 'TD-15K'
wikisql
CREATE TABLE table_59555 ( "Season" real, "Year" real, "Mole" text, "Winner" text, "Runner-up" text, "Total prize money" text, "Potential prize money" text, "Destination" text )
Who was the runner-up after season 2 when the total prize money was $108,000?
SELECT "Runner-up" FROM table_59555 WHERE "Season" > '2' AND "Total prize money" = '$108,000'
wikisql
CREATE TABLE table_76971 ( "Result" text, "Race" text, "Distance" text, "Weight" real, "Winner or 2nd" text, "Pos'n" text )
What was the race when the winner of 2nd was Voleuse?
SELECT "Race" FROM table_76971 WHERE "Winner or 2nd" = 'voleuse'
wikisql
CREATE TABLE table_2624098_1 ( old_english_day_name VARCHAR, glossed_from_latin_day_name VARCHAR )
how mant different day names in old English were coined from the Latin day name 'dies iovis'?
SELECT COUNT(old_english_day_name) FROM table_2624098_1 WHERE glossed_from_latin_day_name = "Dies Iovis"
sql_create_context
CREATE TABLE table_name_63 ( mascot VARCHAR, enrollment VARCHAR )
Which Mascot has an Enrollment of 640?
SELECT mascot FROM table_name_63 WHERE enrollment = 640
sql_create_context
CREATE TABLE table_name_96 ( city_of_license__market VARCHAR, station VARCHAR )
Which city contains the KPIX station?
SELECT city_of_license__market FROM table_name_96 WHERE station = "kpix"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
provide the number of patients whose days of hospital stay is greater than 11 and lab test fluid is ascites?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "11" AND lab.fluid = "Ascites"
mimicsql_data
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
how many patients received a hemodialysis after the procedure of the hypothermia in the previous year within 2 months?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'hypothermia' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of yea...
eicu
CREATE TABLE table_name_49 ( finish VARCHAR, wins VARCHAR )
What is the Finish of 28 Wins?
SELECT finish FROM table_name_49 WHERE wins = "28"
sql_create_context
CREATE TABLE table_name_22 ( player VARCHAR, nhl_team VARCHAR, pick__number VARCHAR )
What is the name of the Player that shows the NHL team of new york rangers, and a Pick # of 31?
SELECT player FROM table_name_22 WHERE nhl_team = "new york rangers" AND pick__number = "31"
sql_create_context
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
在2009-10-09之前,患者吴映秋有多少门诊就诊的检验报告单?看一下门诊就诊的流水号
SELECT wdmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '吴映秋' AND NOT wdmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2009-10-0...
css
CREATE TABLE table_9989 ( "Year" real, "Film" text, "Song" text, "Composer" text, "Language" text )
What year was the composition by Mejo Joseph?
SELECT COUNT("Year") FROM table_9989 WHERE "Composer" = 'mejo joseph'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number...
what's the total dose of d10nss that patient 24547 had received since 1446 days ago?
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24547)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab...
mimic_iii
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE diagnoses_icd ( row_id number, ...
count how many times patient 19412 has gone to hospital in this year.
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 19412 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
mimic_iii
CREATE TABLE table_name_5 ( socialist_ticket VARCHAR, democratic_ticket VARCHAR )
Who's the Socialist ticket with a Democratic ticket of herbert h. lehman?
SELECT socialist_ticket FROM table_name_5 WHERE democratic_ticket = "herbert h. lehman"
sql_create_context
CREATE TABLE table_64744 ( "Rank" text, "Province" text, "Population (2011)" real, "Percentage" real, "Population Estimate (2013)" real )
What is the lowest 2013 population estimate of south africa, which has a percentage greater than 19.8 and a 2011 population greater than 51,770,561?
SELECT MIN("Population Estimate (2013)") FROM table_64744 WHERE "Percentage" > '19.8' AND "Province" = 'south africa' AND "Population (2011)" > '51,770,561'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE prescription...
list the patient identifications of those patients who were diagnosed with nasal bone fx-closed during the previous year.
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'nasal bone fx-closed') AND DATETIME(diagnoses_icd.charttime, 'start of yea...
mimic_iii
CREATE TABLE table_name_42 ( date_of_appointment VARCHAR, outgoing_manager VARCHAR )
What is Date of Appointment, when Outgoing Manager is 'Hakan Kutlu'?
SELECT date_of_appointment FROM table_name_42 WHERE outgoing_manager = "hakan kutlu"
sql_create_context
CREATE TABLE table_73689 ( "Series #" real, "Season #" text, "Episode" text, "Directed by" text, "Written by" text, "Original air date" text, "Viewers (in millions)" text )
What is the series minimum if the season number is 2.08?
SELECT MIN("Series #") FROM table_73689 WHERE "Season #" = '2.08'
wikisql
CREATE TABLE Document_Locations ( Document_ID INTEGER, Location_Code CHAR(15), Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME ) CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) CREATE TABLE...
Bar chart x axis role code y axis the total number
SELECT Role_Code, COUNT(*) FROM Employees GROUP BY Role_Code
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is the number of patients whose diagnoses icd9 code is 25040 and drug type is additive?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "25040" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE table_41453 ( "Rank" real, "Location" text, "Total Passengers" real, "Annual change" text, "Capacity" real, "Capacity in use" text )
What is the capacity in use of the airport in Rio de Janeiro with an annual change of 40.53%?
SELECT "Capacity in use" FROM table_41453 WHERE "Location" = 'rio de janeiro' AND "Annual change" = '40.53%'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
what is the number of patients whose admission type is urgent and insurance is medicaid?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.insurance = "Medicaid"
mimicsql_data
CREATE TABLE table_45635 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location/Attendance" text, "Record" text )
What were the high points on september 9?
SELECT "High points" FROM table_45635 WHERE "Date" = 'september 9'
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 elective hospital admission patients who have been diagnosed with other staphylococcus pneumonia.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.long_title = "Other Staphylococcus pneumonia"
mimicsql_data
CREATE TABLE table_1773908_3 ( provider VARCHAR, resale VARCHAR, up__up_to_kbit_s_ VARCHAR )
How many providers are there where the resale category is yes and bandwith is up is 1024?
SELECT COUNT(provider) FROM table_1773908_3 WHERE resale = "yes" AND up__up_to_kbit_s_ = 1024
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date...
Most popular tags during the last quarter.
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS LastQuarterRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsLastQuarter, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts....
sede
CREATE TABLE table_67883 ( "City" text, "Province/Region" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text )
In what city is RJSN located?
SELECT "City" FROM table_67883 WHERE "ICAO" = 'rjsn'
wikisql
CREATE TABLE table_name_15 ( score VARCHAR, opponent_in_the_final VARCHAR )
What score has wynne prakusya as the opponent in the final?
SELECT score FROM table_name_15 WHERE opponent_in_the_final = "wynne prakusya"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, pati...
count the number of patients who have been diagnosed with acute coronary syndrome and did not come back to the hospital within 2 months since 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 = 'acute coronary syndrome' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 year'...
eicu
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,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, show me about the distribution of job_id and the average of employee_id , and group by attribute job_id in a bar chart, and show total number in descending order.
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE rating ( rid number, mid number, stars number, ratingdate time ) CREATE TABLE reviewer ( rid number, name text ) CREATE TABLE movie ( mid number, title text, year number, director text )
What are the names and years of the movies that has the top 3 highest rating star?
SELECT T2.title, T2.year FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid ORDER BY T1.stars DESC LIMIT 3
spider
CREATE TABLE table_19561 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text )
How many class AA in the year 2002-03
SELECT COUNT("Class AA") FROM table_19561 WHERE "School Year" = '2002-03'
wikisql
CREATE TABLE table_47075 ( "Year" real, "Award" text, "Category" text, "Nominated Work" text, "Result" text )
What ward was she nominated at for her work, Flare Path for the category of best featured actress in a play?
SELECT "Award" FROM table_47075 WHERE "Nominated Work" = 'flare path' AND "Category" = 'best featured actress in a play'
wikisql