instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
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, INSU_TYPE text, IN_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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, FLX_MED_ORG_ID text, ILL_PAY number, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, LAS_OVE_PAY number, MED_AMOUT number, MED_SAFE_PAY_ID text, MED_TYPE number, OLDC_FUND_PAY number, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_ADD_PAY number, OVE_PAY number, PERSON_ID text, PER_ACC_PAY number, PER_EXP number, PER_SOL number, RECEIVER_DEAL_ID text, RECEIVER_OFFSET_ID text, RECEIVER_REVOKE_ID text, RECIPE_BILL_ID text, REF_SLT_FLG number, REIMBURS_FLG number, SENDER_DEAL_ID text, SENDER_OFFSET_ID text, SENDER_REVOKE_ID text, SPE_FUND_PAY number, SUP_ADD_PAY number, SYNC_TIME time, TRADE_TYPE number ) 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 text, MED_DIRE_NM text, MED_EXP_BILL_ID text, MED_EXP_DET_ID text, MED_INV_ITEM_TYPE text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_SELF_AMO number, PRESCRIPTION_CODE text, PRESCRIPTION_ID text, QTY number, RECIPE_BILL_ID text, REF_STA_FLG number, REIMBURS_TYPE number, REMOTE_SETTLE_FLG text, RER_SOL number, SELF_PAY_AMO number, SELF_PAY_PRO number, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, SPEC text, STA_DATE time, STA_FLG number, SYNC_TIME time, TRADE_TYPE number, UNIVALENT number, UP_LIMIT_AMO number, USE_FRE text, VAL_UNIT text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 3519597的医疗机构入院诊断疾病与出院诊断疾病出现过多少次不同的结果,时间是在二0一三年十二月二十三日到二0二0年十月二十二日
SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '3519597' AND t_kc21.IN_HOSP_DATE BETWEEN '2013-12-23' AND '2020-10-22' AND t_kc21.IN_DIAG_DIS_CD <> t_kc21.OUT_DIAG_DIS_CD
css
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) 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 int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) 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 fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) -- Using valid SQLite, answer the following questions for the tables provided above. -- i need information on flights leaving PHILADELPHIA on friday arriving in OAKLAND california
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
atis
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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear 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 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 ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many patients have been diagnosed with type 1 diabetes with neurological manifestations not stated as uncontrolled?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "DMI neuro nt st uncntrld"
mimicsql_data
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) 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, YQMC text, CKZFWDX text, CKZFWXX number, CKZFWSX number, JLDW text ) 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 mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ZZYSGH text, QTJZYSGH text, JZZDBM text, JZZDSM text, MZZYZDZZBM text, MZZYZDZZMC text, SG number, TZ number, TW number, SSY number, SZY number, XL number, HXPLC number, ML number, JLSJ time ) CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH text, SHRXM text, SHSJ time, SQKS text, SQKSMC text, JYKSBM text, JYKSMC text, BGJGDM text, BGJGMC text, SQRQ time, CJRQ time, JYRQ time, BGSJ time, BBDM text, BBMC text, JYBBH text, BBZT number, BBCJBW text, JSBBSJ time, JYXMMC text, JYXMDM text, JYSQJGMC text, JYJGMC text, JSBBRQSJ time, JYJSQM text, JYJSGH text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM text, CYBQMC text, CYCWH text, ZYBMLX number, ZYZDBM text, ZYZDMC text, ZYZYZDZZBM text, ZYZYZDZZMC text, MZBMLX number, MZZDBM text, MZZDMC text, MZZYZDZZBM text, RYSJ time, CYSJ time, CYZTDM number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 09年10月8日到13年11月23日期间,患者84974890的369859指标是怎样的
(SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = '84974890' AND jyjgzbb.JYRQ BETWEEN '2009-10-08' AND '2013-11-23' AND jyjgzbb.JCZBDM = '369859') UNION (SELECT * FROM hz_info JOIN zyjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND zyjzjlb.YLJGDM = jybgb.YLJGDM_ZYJZJLB AND zyjzjlb.JZLSH = jybgb.JZLSH_ZYJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = '84974890' AND jyjgzbb.JYRQ BETWEEN '2009-10-08' AND '2013-11-23' AND jyjgzbb.JCZBDM = '369859')
css
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE 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, SBBM text, SHRGH text, SHRXM text, YLJGDM text, YQBH text, YQMC text ) CREATE TABLE wdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM text, RYCWH text, RYDJSJ time, RYSJ time, RYTJDM number, RYTJMC text, RZBQDM text, RZBQMC text, YLJGDM number, ZYBMLX number, ZYZDBM text, ZYZDMC text, ZYZYZDZZBM text, ZYZYZDZZMC text ) 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, JYKSBM text, JYKSMC text, JYLX number, JYRQ time, JYSQJGMC text, JYXMDM text, JYXMMC text, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SHRGH text, SHRXM text, SHSJ time, SQKS text, SQKSMC text, SQRGH text, SQRQ time, SQRXM text, YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text ) CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC text, NLS number, NLY number, QTJZYSGH text, SG number, SSY number, SZY number, TW number, TXBZ number, TZ number, WDBZ number, XL number, YLJGDM text, ZSEBZ number, ZZBZ number, ZZYSGH text ) CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM text, RYCWH text, RYDJSJ time, RYSJ time, RYTJDM number, RYTJMC text, RZBQDM text, RZBQMC text, YLJGDM number, ZYBMLX number, ZYZDBM text, ZYZDMC text, ZYZYZDZZBM text, ZYZYZDZZMC text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 病员03874754的检测游离甲状腺素项目在2007年9月8日到16年8月20日期间是哪位医务人员做的员工号及姓名分别是什么?
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE jyjgzbb.JYRQ BETWEEN '2007-09-08' AND '2016-08-20' AND hz_info.RYBH = '03874754' AND jyjgzbb.JCZBMC = '游离甲状腺素' UNION SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_ZYJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_ZYJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE jyjgzbb.JYRQ BETWEEN '2007-09-08' AND '2016-08-20' AND hz_info.RYBH = '03874754' AND jyjgzbb.JCZBMC = '游离甲状腺素' UNION SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN bdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND hz_info.KH = bdmzjzjlb.KH AND hz_info.KLX = bdmzjzjlb.KLX AND bdmzjzjlb.YLJGDM = jybgb.YLJGDM_ZYJZJLB AND bdmzjzjlb.JZLSH = jybgb.JZLSH_ZYJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE jyjgzbb.JYRQ BETWEEN '2007-09-08' AND '2016-08-20' AND hz_info.RYBH = '03874754' AND jyjgzbb.JCZBMC = '游离甲状腺素'
css
CREATE TABLE table_1140080_2 ( rnd INTEGER, race VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what's the minimum rnd with race italian grand prix
SELECT MIN(rnd) FROM table_1140080_2 WHERE race = "Italian Grand Prix"
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 ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find the number of different products that are produced by companies at different headquarter cities Plot them as bar chart, I want to display by the name) in ascending.
SELECT Headquarter, COUNT(DISTINCT T1.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code ORDER BY COUNT(DISTINCT T1.Name)
nvbench
CREATE TABLE table_name_86 ( opponent VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the opponent on June 29?
SELECT opponent FROM table_name_86 WHERE date = "june 29"
sql_create_context
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 ) 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 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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is minimum age of patients whose admission type is elective and year of death is less than 2115?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.dod_year < "2115.0"
mimicsql_data
CREATE TABLE table_name_89 ( tamil_months VARCHAR, english_transliteration VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the months in Tamil that has an english transliteration of Mun-pani?
SELECT tamil_months FROM table_name_89 WHERE english_transliteration = "mun-pani"
sql_create_context
CREATE TABLE table_name_22 ( rating VARCHAR, air_date VARCHAR, share VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Rating(s), when Air Date is June 25, 2008, and when Share is greater than 3?
SELECT COUNT(rating) FROM table_name_22 WHERE air_date = "june 25, 2008" AND share > 3
sql_create_context
CREATE TABLE table_10547 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance at the game when the away team scored 21.14 (140)?
SELECT "Crowd" FROM table_10547 WHERE "Away team score" = '21.14 (140)'
wikisql
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar ) CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For NRE classes , are there any that do not meet on Friday ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.friday = 'N' AND course.department = 'NRE' AND semester.semester = 'WN' AND semester.year = 2016
advising
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 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 text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many female patients are lab tested under category blood gas?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "F" AND lab."CATEGORY" = "Blood Gas"
mimicsql_data
CREATE TABLE table_50192 ( "Player" text, "Country" text, "Year(s) won" real, "Total" real, "To par" real, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Year(s) Won, when Player is Arnold Palmer?
SELECT "Year(s) won" FROM table_50192 WHERE "Player" = 'arnold palmer'
wikisql
CREATE TABLE table_name_41 ( rowers VARCHAR, notes VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What rowers have FA as the notes?
SELECT rowers FROM table_name_41 WHERE notes = "fa"
sql_create_context
CREATE TABLE zyb ( 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_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID number, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) 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 text, MED_DIRE_NM text, MED_EXP_BILL_ID text, MED_EXP_DET_ID text, MED_INV_ITEM_TYPE text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_SELF_AMO number, PRESCRIPTION_CODE text, PRESCRIPTION_ID text, QTY number, RECIPE_BILL_ID text, REF_STA_FLG number, REIMBURS_TYPE number, REMOTE_SETTLE_FLG text, RER_SOL number, SELF_PAY_AMO number, SELF_PAY_PRO number, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, SPEC text, STA_DATE time, STA_FLG number, SYNC_TIME time, TRADE_TYPE number, UNIVALENT number, UP_LIMIT_AMO number, USE_FRE text, VAL_UNIT text ) 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, FLX_MED_ORG_ID text, ILL_PAY number, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, LAS_OVE_PAY number, MED_AMOUT number, MED_CLINIC_ID text, MED_SAFE_PAY_ID text, MED_TYPE number, OLDC_FUND_PAY number, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_ADD_PAY number, OVE_PAY number, PERSON_ID text, PER_ACC_PAY number, PER_EXP number, PER_SOL number, RECEIVER_DEAL_ID text, RECEIVER_OFFSET_ID text, RECEIVER_REVOKE_ID text, RECIPE_BILL_ID text, REF_SLT_FLG number, REIMBURS_FLG number, SENDER_DEAL_ID text, SENDER_OFFSET_ID text, SENDER_REVOKE_ID text, SPE_FUND_PAY number, SUP_ADD_PAY number, SYNC_TIME time, TRADE_TYPE number ) 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_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID number, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) 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_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID number, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) CREATE TABLE gyb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID number, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 38590585这个患者之前做了什么检查
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '38590585' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_ID = '38590585' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM zyb JOIN t_kc22 ON zyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE zyb.PERSON_ID = '38590585' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM mzb JOIN t_kc22 ON mzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE mzb.PERSON_ID = '38590585' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_10669 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the least laps for driver gerhard berger with a grid more than 6?
SELECT MIN("Laps") FROM table_10669 WHERE "Driver" = 'gerhard berger' AND "Grid" > '6'
wikisql
CREATE TABLE table_47756 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Date of the match with Opponent in the final of Filip Pol ek?
SELECT "Date" FROM table_47756 WHERE "Opponent in the final" = 'filip polášek'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) 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, intime time, outtime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom 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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- show me patient 28020's length of stay of the last hospital stay.
SELECT STRFTIME('%j', admissions.dischtime) - STRFTIME('%j', admissions.admittime) FROM admissions WHERE admissions.subject_id = 28020 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE table_44398 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team was the home team when Tottenham Hotspur is the away team?
SELECT "Home team" FROM table_44398 WHERE "Away team" = 'tottenham hotspur'
wikisql
CREATE TABLE room ( blockcode VARCHAR, unavailable VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the unique block codes that have available rooms?
SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
sql_create_context
CREATE TABLE table_18018 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What week did the Seahawks play at los angeles memorial coliseum?
SELECT MIN("Week") FROM table_18018 WHERE "Game site" = 'Los Angeles Memorial Coliseum'
wikisql
CREATE TABLE table_43687 ( "Nationality" text, "Position" text, "Gillingham career" text, "Apps." real, "Goals" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When did the mf from England play for Gillingham that made 0 goals and less than 37 appearances?
SELECT "Gillingham career" FROM table_43687 WHERE "Goals" = '0' AND "Apps." < '37' AND "Nationality" = 'england' AND "Position" = 'mf'
wikisql
CREATE TABLE table_62598 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Total for Seve Ballesteros?
SELECT SUM("Total") FROM table_62598 WHERE "Player" = 'seve ballesteros'
wikisql
CREATE TABLE fzzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC text, NLS number, NLY number, QTJZYSGH text, SG number, SSY number, SZY number, TW number, TXBZ number, TZ number, WDBZ number, XL number, YLJGDM number, ZSEBZ number, ZZYSGH text ) CREATE TABLE zzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC text, NLS number, NLY number, QTJZYSGH text, SG number, SSY number, SZY number, TW number, TXBZ number, TZ number, WDBZ number, XL number, YLJGDM number, ZSEBZ number, ZZYSGH text ) 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, SBBM text, SHRGH text, SHRXM text, YLJGDM text, YQBH text, YQMC text ) 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 text, RYCWH text, RYDJSJ time, RYSJ time, RYTJDM number, RYTJMC text, RZBQDM text, RZBQMC text, WDBZ number, YLJGDM text, ZYBMLX number, ZYZDBM text, ZYZDMC text, ZYZYZDZZBM text, ZYZYZDZZMC text ) CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, JYKSBM text, JYKSMC text, JYLX number, JYRQ time, JYSQJGMC text, JYXMDM text, JYXMMC text, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SHRGH text, SHRXM text, SHSJ time, SQKS text, SQKSMC text, SQRGH text, SQRQ time, SQRXM text, YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text ) CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 58661647患者被门诊诊断为疾病I06.952的降钙素原的结果定量是什么?单位都是什么?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb 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 AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDBM = 'I06.952' AND hz_info.RYBH = '58661647' AND jyjgzbb.JCZBMC = '降钙素原' UNION SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN fzzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = fzzmzjzjlb.YLJGDM AND hz_info.KH = fzzmzjzjlb.KH AND hz_info.KLX = fzzmzjzjlb.KLX AND fzzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND fzzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE fzzmzjzjlb.JZZDBM = 'I06.952' AND hz_info.RYBH = '58661647' AND jyjgzbb.JCZBMC = '降钙素原'
css
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) 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, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) -- Using valid SQLite, answer the following questions for the tables provided above. -- tell me the first ward id patient 005-47601 got during the last year?
SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-47601') AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY patient.unitadmittime LIMIT 1
eicu
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 ( 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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear 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 ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many patients whose marital status is divorced and procedure long title is small-to-small intestinal anastomosis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.long_title = "Small-to-small intestinal anastomosis"
mimicsql_data
CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE member ( Member_ID int, Member_Name text, Party_ID text, In_office text ) CREATE TABLE party_events ( Event_ID int, Event_Name text, Party_ID int, Member_in_charge_ID int ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show all ministers who do not belong to Progress Party, and count them by a pie chart
SELECT Minister, COUNT(Minister) FROM party WHERE Party_name <> 'Progress Party' GROUP BY Minister
nvbench
CREATE TABLE table_14300 ( "Name A[\u203a ]" text, "Dam or A[\u203a ] Reservoir" text, "GNIS Feature ID # Link A[\u203a ] B[\u203a ]" real, "Elevation A[\u203a ]" text, "Borough or A[\u203a ] Census area" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the name a[ ] when the borough or a[ ] census area is ketchikan gateway and the dam or a[ ] reservoir is reservoir?
SELECT "Name A[\u203a ]" FROM table_14300 WHERE "Borough or A[\u203a ] Census area" = 'ketchikan gateway' AND "Dam or A[\u203a ] Reservoir" = 'reservoir'
wikisql
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, INSU_TYPE text, IN_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) 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 text, MED_DIRE_NM text, MED_EXP_BILL_ID text, MED_EXP_DET_ID text, MED_INV_ITEM_TYPE text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_SELF_AMO number, PRESCRIPTION_CODE text, PRESCRIPTION_ID text, QTY number, RECIPE_BILL_ID text, REF_STA_FLG number, REIMBURS_TYPE number, REMOTE_SETTLE_FLG text, RER_SOL number, SELF_PAY_AMO number, SELF_PAY_PRO number, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, SPEC text, STA_DATE time, STA_FLG number, SYNC_TIME time, TRADE_TYPE number, UNIVALENT number, UP_LIMIT_AMO number, USE_FRE text, VAL_UNIT text ) CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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, FLX_MED_ORG_ID text, ILL_PAY number, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, LAS_OVE_PAY number, MED_AMOUT number, MED_SAFE_PAY_ID text, MED_TYPE number, OLDC_FUND_PAY number, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_ADD_PAY number, OVE_PAY number, PERSON_ID text, PER_ACC_PAY number, PER_EXP number, PER_SOL number, RECEIVER_DEAL_ID text, RECEIVER_OFFSET_ID text, RECEIVER_REVOKE_ID text, RECIPE_BILL_ID text, REF_SLT_FLG number, REIMBURS_FLG number, SENDER_DEAL_ID text, SENDER_OFFSET_ID text, SENDER_REVOKE_ID text, SPE_FUND_PAY number, SUP_ADD_PAY number, SYNC_TIME time, TRADE_TYPE number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 病患82923898在7620449号这个医院入院是其诊断的疾病名字没有震颤麻痹这几个字的医疗就诊记录编码有啥?
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '82923898' AND t_kc21.MED_SER_ORG_NO = '7620449' AND NOT t_kc21.IN_DIAG_DIS_NM LIKE '%震颤麻痹%'
css
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE 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, intime time, outtime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- when was the last time that until 09/2102 patient 3267 was prescribed a medicine via an subcut route?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3267) AND prescriptions.route = 'subcut' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2102-09' ORDER BY prescriptions.startdate DESC LIMIT 1
mimic_iii
CREATE TABLE table_1571238_2 ( third_place VARCHAR, team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When the team is Toronto how many times did they place third?
SELECT COUNT(third_place) FROM table_1571238_2 WHERE team = "Toronto"
sql_create_context
CREATE TABLE table_58923 ( "Rank" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the fewest bronze medals when the total medals is less than 10, and the gold medals less than 0?
SELECT MIN("Bronze") FROM table_58923 WHERE "Total" < '10' AND "Gold" < '0'
wikisql
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, INSU_TYPE text, IN_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text, MED_EXP_BILL_ID text, MED_EXP_DET_ID text, MED_INV_ITEM_TYPE text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_SELF_AMO number, PRESCRIPTION_CODE text, PRESCRIPTION_ID text, QTY number, RECIPE_BILL_ID text, REF_STA_FLG number, REIMBURS_TYPE number, REMOTE_SETTLE_FLG text, RER_SOL number, SELF_PAY_AMO number, SELF_PAY_PRO number, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, SPEC text, STA_DATE time, STA_FLG number, SYNC_TIME time, TRADE_TYPE number, UNIVALENT number, UP_LIMIT_AMO number, USE_FRE text, VAL_UNIT text ) 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, FLX_MED_ORG_ID text, ILL_PAY number, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, LAS_OVE_PAY number, MED_AMOUT number, MED_CLINIC_ID text, MED_SAFE_PAY_ID text, MED_TYPE number, OLDC_FUND_PAY number, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_ADD_PAY number, OVE_PAY number, PERSON_ID text, PER_ACC_PAY number, PER_EXP number, PER_SOL number, RECEIVER_DEAL_ID text, RECEIVER_OFFSET_ID text, RECEIVER_REVOKE_ID text, RECIPE_BILL_ID text, REF_SLT_FLG number, REIMBURS_FLG number, SENDER_DEAL_ID text, SENDER_OFFSET_ID text, SENDER_REVOKE_ID text, SPE_FUND_PAY number, SUP_ADD_PAY number, SYNC_TIME time, TRADE_TYPE number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 患者陶乐贤来之前哪些检查项目已经做过了
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '陶乐贤' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_72591 ( "Year" text, "Channel" text, "Play-by-play" text, "Color commentator(s)" text, "Courtside reporter" text, "Studio host" text, "Studio analysts" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who is the studio host for the year 2006-07?
SELECT "Studio host" FROM table_72591 WHERE "Year" = '2006-07'
wikisql
CREATE TABLE table_61627 ( "Fin. Pos" real, "Car No." real, "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Laps Led" real, "Points" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which driver finished in position 8?
SELECT "Driver" FROM table_61627 WHERE "Fin. Pos" = '8'
wikisql
CREATE TABLE table_train_276 ( "id" int, "hbv" bool, "systolic_blood_pressure_sbp" int, "hiv_infection" bool, "hcv" bool, "diastolic_blood_pressure_dbp" int, "body_mass_index_bmi" float, "hypertension" bool, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- subjects must have a bp < 130 / 80 mm hg and no prior history of hypertension.
SELECT * FROM table_train_276 WHERE hypertension = 0 OR systolic_blood_pressure_sbp < 130 OR diastolic_blood_pressure_dbp < 80
criteria2sql
CREATE TABLE table_1940144_1 ( change_since_2006 VARCHAR, county VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many places did the rank change since 22006 for County Leitrim?
SELECT COUNT(change_since_2006) FROM table_1940144_1 WHERE county = "county Leitrim"
sql_create_context
CREATE TABLE table_name_16 ( round VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which round was Tom Morris picked in?
SELECT COUNT(round) FROM table_name_16 WHERE player = "tom morris"
sql_create_context
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) 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 int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE days ( days_code varchar, day_name varchar ) 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 fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) -- Using valid SQLite, answer the following questions for the tables provided above. -- i need an early flight from DALLAS to HOUSTON
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 ((flight.departure_time <= 1000 AND flight.departure_time >= 0) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'HOUSTON' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
atis
CREATE TABLE table_name_69 ( wins INTEGER, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least wins for 6 points
SELECT MIN(wins) FROM table_name_69 WHERE points = 6
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 procedures ( 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 ) 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, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- count the number of patients whose diagnoses icd9 code is 3310 and lab test fluid is pleural?
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 = "3310" AND lab.fluid = "Pleural"
mimicsql_data
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE 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 number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) 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, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) 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, culturetakentime time ) -- Using valid SQLite, answer the following questions for the tables provided above. -- is patient 032-21820's mpv value last measured on the current hospital visit greater than the value first measured on the current hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-21820' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'mpv' ORDER BY lab.labresulttime DESC LIMIT 1) > (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-21820' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'mpv' ORDER BY lab.labresulttime LIMIT 1)
eicu
CREATE TABLE table_16029 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score of the match with partner Jim Pugh?
SELECT "Score" FROM table_16029 WHERE "Partner" = 'Jim Pugh'
wikisql
CREATE TABLE table_name_14 ( date VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- On what Date was the Score 105-128?
SELECT date FROM table_name_14 WHERE score = "105-128"
sql_create_context
CREATE TABLE match_result ( rank number, club_id number, gold number, big_silver number, small_silver number, bronze number, points number ) CREATE TABLE coach ( coach_id number, coach_name text, gender text, club_id number, rank number ) CREATE TABLE player ( player_id number, sponsor_name text, player_name text, gender text, residence text, occupation text, votes number, rank text ) CREATE TABLE club ( club_id number, club_name text, region text, start_year number ) CREATE TABLE player_coach ( player_id number, coach_id number, starting_year number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Show the names and genders of players with a coach starting after 2011.
SELECT T3.player_name, T3.gender FROM player_coach AS T1 JOIN coach AS T2 ON T1.coach_id = T2.coach_id JOIN player AS T3 ON T1.player_id = T3.player_id WHERE T1.starting_year > 2011
spider
CREATE TABLE table_17488 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many episodes were written only by William N. Fordes?
SELECT COUNT("Series #") FROM table_17488 WHERE "Written by" = 'William N. Fordes'
wikisql
CREATE TABLE table_49737 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the away team when Manchester United played at home on 10 February 1951?
SELECT "Away team" FROM table_49737 WHERE "Date" = '10 february 1951' AND "Home team" = 'manchester united'
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 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 text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) 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 ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is average age of patients whose admission type is emergency and year of birth is greater than 2080?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dob_year > "2080"
mimicsql_data
CREATE TABLE performance ( songid number, bandmate number, stageposition text ) CREATE TABLE band ( id number, firstname text, lastname text ) CREATE TABLE instruments ( songid number, bandmateid number, instrument text ) CREATE TABLE vocals ( songid number, bandmate number, type text ) CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE tracklists ( albumid number, position number, songid number ) CREATE TABLE songs ( songid number, title text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the unique labels for the albums?
SELECT COUNT(DISTINCT label) FROM albums
spider
CREATE TABLE table_5909 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance when Nuneaton Borough was the home team?
SELECT "Attendance" FROM table_5909 WHERE "Home team" = 'nuneaton borough'
wikisql
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom 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 transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) 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, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) 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 prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the four year survival rate of a person with fall from slipping nec?
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) 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_diagnoses.short_title = 'fall from slipping nec') GROUP BY admissions.subject_id HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 4 * 365) AS t2 JOIN patients ON t2.subject_id = patients.subject_id
mimic_iii
CREATE TABLE table_47396 ( "Rank" real, "Rider" text, "Team" text, "Time" text, "Speed" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the rider with 120.953 mph speed?
SELECT "Rider" FROM table_47396 WHERE "Speed" = '120.953 mph'
wikisql
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, FLX_MED_ORG_ID text, ILL_PAY number, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, LAS_OVE_PAY number, MED_AMOUT number, MED_CLINIC_ID text, MED_SAFE_PAY_ID text, MED_TYPE number, OLDC_FUND_PAY number, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_ADD_PAY number, OVE_PAY number, PERSON_ID text, PER_ACC_PAY number, PER_EXP number, PER_SOL number, RECEIVER_DEAL_ID text, RECEIVER_OFFSET_ID text, RECEIVER_REVOKE_ID text, RECIPE_BILL_ID text, REF_SLT_FLG number, REIMBURS_FLG number, SENDER_DEAL_ID text, SENDER_OFFSET_ID text, SENDER_REVOKE_ID text, SPE_FUND_PAY number, SUP_ADD_PAY number, SYNC_TIME time, TRADE_TYPE number ) 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, INSU_TYPE text, IN_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, IN_HOSP_DATE time, IN_HOSP_DAYS number, MAIN_COND_DES text, MED_AMOUT number, MED_CLINIC_ID text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, MED_SER_ORG_NO text, MED_TYPE number, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, OUT_HOSP_DATE time, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, PERSON_AGE number, PERSON_ID text, PERSON_NM text, PERSON_SEX number, REIMBURSEMENT_FLG number, REMOTE_SETTLE_FLG text, SERVANT_FLG text, SOC_SRT_CARD text, SYNC_TIME time, TRADE_TYPE number ) CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text, MED_EXP_BILL_ID text, MED_EXP_DET_ID text, MED_INV_ITEM_TYPE text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, OVE_SELF_AMO number, PRESCRIPTION_CODE text, PRESCRIPTION_ID text, QTY number, RECIPE_BILL_ID text, REF_STA_FLG number, REIMBURS_TYPE number, REMOTE_SETTLE_FLG text, RER_SOL number, SELF_PAY_AMO number, SELF_PAY_PRO number, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, SPEC text, STA_DATE time, STA_FLG number, SYNC_TIME time, TRADE_TYPE number, UNIVALENT number, UP_LIMIT_AMO number, USE_FRE text, VAL_UNIT text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 在2001年4月20日到2004年12月7日这段时间里,列出病患90461367在医院5572160中被开出全部的药品名称和编码分别是什么呢?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '90461367' AND t_kc21.MED_SER_ORG_NO = '5572160' AND t_kc21.IN_HOSP_DATE BETWEEN '2001-04-20' AND '2004-12-07')
css
CREATE TABLE table_51936 ( "Club" text, "Sport" text, "League" text, "Venue" text, "Established" real, "Championships" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which WNBA team that won at least 2 championships was established most recently?
SELECT MAX("Established") FROM table_51936 WHERE "League" = 'wnba' AND "Championships" > '2'
wikisql
CREATE TABLE table_name_52 ( rank INTEGER, name VARCHAR, time VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the rank of flori lang when his time was less than 22.27
SELECT SUM(rank) FROM table_name_52 WHERE name = "flori lang" AND time < 22.27
sql_create_context
CREATE TABLE table_10674 ( "Team" text, "Lost" real, "Tied" real, "Pct." real, "Years" real, "Total Games" real, "Conference" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What were the total games in the Big Ten conference when Nebraska lost fewer than 488 games and had a Pct less than 0.7014?
SELECT SUM("Total Games") FROM table_10674 WHERE "Conference" = 'big ten' AND "Lost" < '488' AND "Team" = 'nebraska' AND "Pct." < '0.7014'
wikisql
CREATE TABLE Shipment_Items ( shipment_id INTEGER, order_item_id INTEGER ) CREATE TABLE Products ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255) ) CREATE TABLE Shipments ( shipment_id INTEGER, order_id INTEGER, invoice_number INTEGER, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, other_shipment_details VARCHAR(255) ) CREATE TABLE Order_Items ( order_item_id INTEGER, product_id INTEGER, order_id INTEGER, order_item_status VARCHAR(10), order_item_details VARCHAR(255) ) CREATE TABLE Orders ( order_id INTEGER, customer_id INTEGER, order_status VARCHAR(10), date_order_placed DATETIME, order_details VARCHAR(255) ) CREATE TABLE Customers ( customer_id INTEGER, customer_name VARCHAR(80), customer_details VARCHAR(255) ) CREATE TABLE Invoices ( invoice_number INTEGER, invoice_date DATETIME, invoice_details VARCHAR(255) ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the dates of the orders made by the customer named 'Jeramie', and count them by a bar chart
SELECT date_order_placed, COUNT(date_order_placed) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
nvbench
CREATE TABLE table_name_47 ( country VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what country has tiger woods
SELECT country FROM table_name_47 WHERE player = "tiger woods"
sql_create_context
CREATE TABLE table_name_38 ( spouse VARCHAR, birth VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Spouse has a Birth of 30 may 1653?
SELECT spouse FROM table_name_38 WHERE birth = "30 may 1653"
sql_create_context
CREATE TABLE table_name_93 ( label VARCHAR, catalogue VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the label for catalogue of RT-346-5?
SELECT label FROM table_name_93 WHERE catalogue = "rt-346-5"
sql_create_context
CREATE TABLE table_77357 ( "Name" text, "Birth" text, "Marriage" text, "Became Dauphine" text, "Ceased to be Dauphine" text, "Death" text, "Husband" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When was became dauphine when birth is 1393?
SELECT "Became Dauphine" FROM table_77357 WHERE "Birth" = '1393'
wikisql
CREATE TABLE table_45055 ( "Season" text, "Races" real, "Wins" real, "Podiums" real, "Poles" real, "Fastest Laps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of wins in the 2007 season when the fastest laps is 0, there are less than 0 podiums, and there are less than 16 races?
SELECT SUM("Wins") FROM table_45055 WHERE "Fastest Laps" = '0' AND "Races" < '16' AND "Season" = '2007' AND "Podiums" < '0'
wikisql
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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) 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 ( 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 ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many patients admitted before the year 2198 are diagnosed with primary disease coronary artery disease\coronary artery bypass graft /sda?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT /SDA" AND demographic.admityear < "2198"
mimicsql_data
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 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 ) 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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- specify the maximum age of male patients who remained admitted in hospital for 20 days.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.days_stay = "20"
mimicsql_data
CREATE TABLE table_54173 ( "Driver" text, "Car #" real, "Make" text, "Points" real, "Laps" real, "Winnings" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which is the lowest point value that had not only a Chevrolet car, but also a car number smaller than 24, total laps of 312, and a winning purse of $122,325?
SELECT MIN("Points") FROM table_54173 WHERE "Make" = 'chevrolet' AND "Car #" < '24' AND "Laps" = '312' AND "Winnings" = '$122,325'
wikisql
CREATE TABLE table_24887326_8 ( score_1 VARCHAR, away_team VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score when the away team was norwich city?
SELECT score_1 FROM table_24887326_8 WHERE away_team = "Norwich City"
sql_create_context
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) 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 SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense 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, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) 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 ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) 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 ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Find Stack Overflow Users In Your City. A simply query to find users in your city or country.
SELECT Id, Reputation, DisplayName FROM Users WHERE Location LIKE '%##Location##%' ORDER BY Reputation DESC
sede
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Return a bar chart on how many wines are there for each grape?, list from low to high by the Grape please.
SELECT Grape, COUNT(*) FROM wine GROUP BY Grape ORDER BY Grape
nvbench
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) 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 int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE month ( month_number int, month_name text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- show me the flights from BALTIMORE to PITTSBURGH
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
atis
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE 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 job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about the sum of employee_id over the hire_date bin hire_date by weekday by a bar chart, could you show by the y-axis in descending?
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment 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 PostTypes ( Id number, Name text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) 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, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) 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 ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Comments containing given keyword between two dates.
SELECT Id AS "comment_link", Text FROM Comments WHERE Text LIKE '%##Word##%' AND CreationDate >= '##Date1##' AND CreationDate <= '##Date2##'
sede
CREATE TABLE table_name_19 ( finish INTEGER, year VARCHAR, start VARCHAR, engine VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the finish associated with under 11 starts, a honda engine, before 2003?
SELECT AVG(finish) FROM table_name_19 WHERE start < 11 AND engine = "honda" AND year < 2003
sql_create_context
CREATE TABLE table_76554 ( "Date" text, "Captain 1" text, "Team 2" text, "Captain 2" text, "Venue" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Result has a Captain 2 of louis burger?
SELECT "Result" FROM table_76554 WHERE "Captain 2" = 'louis burger'
wikisql
CREATE TABLE table_name_92 ( result VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the match that had a score of 58-6?
SELECT result FROM table_name_92 WHERE score = "58-6"
sql_create_context
CREATE TABLE table_204_556 ( id number, "rank" number, "athlete" text, "country" text, "time" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many women competed during the 1980 winter olympic women 's 1000 metres in speed skating ?
SELECT COUNT("athlete") FROM table_204_556
squall
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text, VAL_UNIT text, DOSE_UNIT text, DOSE_FORM text, SPEC text, USE_FRE text, EACH_DOSAGE text, QTY number, UNIVALENT number, AMOUNT number, SELF_PAY_PRO number, RER_SOL number, SELF_PAY_AMO number, UP_LIMIT_AMO number, OVE_SELF_AMO number, EXP_OCC_DATE time, RECIPE_BILL_ID text, FLX_MED_ORG_ID text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, HOSP_DOC_CD text, HOSP_DOC_NM text, REF_STA_FLG number, DATA_ID text, SYNC_TIME time, PRESCRIPTION_CODE text, PRESCRIPTION_ID text, TRADE_TYPE number, STA_FLG number, STA_DATE time, REIMBURS_TYPE number, FXBZ number, REMOTE_SETTLE_FLG text ) 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 number, ILL_PAY number, CIVIL_SUBSIDY number, PER_SOL number, PER_EXP number, DATA_ID text, SYNC_TIME time, OUT_HOSP_DATE time, CLINIC_ID text, MED_TYPE number, INSURED_STS text, INSURED_IDENTITY number, TRADE_TYPE number, RECIPE_BILL_ID text, ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, REIMBURS_FLG number, SENDER_DEAL_ID text, RECEIVER_DEAL_ID text, SENDER_REVOKE_ID text, RECEIVER_REVOKE_ID text, SENDER_OFFSET_ID text, RECEIVER_OFFSET_ID text, LAS_OVE_PAY number, OVE_ADD_PAY number, SUP_ADD_PAY number, CKC102 number, CASH_PAY number, COM_ACC_PAY number, ENT_ACC_PAY number, ENT_PAY number, COM_PAY number, OLDC_FUND_PAY number, SPE_FUND_PAY number ) 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 number, FLX_MED_ORG_ID text, MED_SER_ORG_NO text, CLINIC_TYPE text, MED_TYPE number, CLINIC_ID text, IN_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, INPT_AREA_BED text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, MAIN_COND_DES text, INSU_TYPE text, IN_HOSP_DAYS number, MED_AMOUT number, FERTILITY_STS number, DATA_ID text, SYNC_TIME time, REIMBURSEMENT_FLG number, HOSP_LEV number, HOSP_STS number, INSURED_IDENTITY number, SERVANT_FLG text, TRADE_TYPE number, INSURED_STS text, REMOTE_SETTLE_FLG text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 对于医疗费总额高于5656.54元的患者窦麦冬的医疗记录,列出入院诊断有什么疾病编码和名称?
SELECT IN_DIAG_DIS_CD, IN_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_NM = '窦麦冬' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc24 WHERE MED_AMOUT > 5656.54)
css
CREATE TABLE table_64265 ( "Rank" text, "Rider" text, "Team" text, "Speed" text, "Time" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the speed for rank 1?
SELECT "Speed" FROM table_64265 WHERE "Rank" = '1'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) 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, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what were the top five frequently prescribed drugs that patients were prescribed during the same hospital visit after having received a ventilator weaning procedure since 2102?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'ventilator weaning' AND STRFTIME('%y', treatment.treatmenttime) >= '2102') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', medication.drugstarttime) >= '2102') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 5
eicu
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 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 ) 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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the average age of female patient discharged to home health care?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.discharge_location = "HOME HEALTH CARE"
mimicsql_data
CREATE TABLE table_32259 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What venue featured a notes of 2:38:44?
SELECT "Venue" FROM table_32259 WHERE "Notes" = '2:38:44'
wikisql
CREATE TABLE table_train_83 ( "id" int, "systolic_blood_pressure_sbp" int, "renal_disease" bool, "diabetic" string, "estimated_glomerular_filtration_rate_egfr" int, "iq" int, "geriatric_depression_scale_gds" int, "NOUSE" float ) -- Using valid SQLite, answer the following questions for the tables provided above. -- diagnosis of type i diabetes
SELECT * FROM table_train_83 WHERE diabetic = 'i'
criteria2sql
CREATE TABLE table_11761 ( "Name" text, "Location" text, "Elevation + Height" text, "Delivery" text, "Purpose" text, "Yield" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Elevation + Height has a Delivery of barge and a Location of bikini, yurochi aka irioj (dog)?
SELECT "Elevation + Height" FROM table_11761 WHERE "Delivery" = 'barge' AND "Location" = 'bikini, yurochi aka irioj (dog)'
wikisql
CREATE TABLE table_54360 ( "Candidate" text, "Contributions" real, "Loans Received" real, "All Receipts" real, "Operating Expenditures" real, "All Disbursements" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much in average Loans Received has Contributions less than 34,986,088, Disbursements more than 251,093,944 for Dennis Kucinich with Operating Expenditures more than 3,638,219?
SELECT AVG("Loans Received") FROM table_54360 WHERE "Contributions" < '34,986,088' AND "All Disbursements" > '251,093,944' AND "Candidate" = 'dennis kucinich †' AND "Operating Expenditures" > '3,638,219'
wikisql
CREATE TABLE table_name_44 ( viewers VARCHAR, order VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average 18-49 for the episode that had an order number higher than 35 and less than 3.5 viewers?
SELECT AVG(18 AS _49) FROM table_name_44 WHERE viewers < 3.5 AND order > 35
sql_create_context
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ZZYSGH text, QTJZYSGH text, JZZDBM text, JZZDSM text, MZZYZDZZBM text, MZZYZDZZMC text, SG number, TZ number, TW number, SSY number, SZY number, XL number, HXPLC number, ML number, JLSJ time ) CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH text, SHRXM text, SHSJ time, SQKS text, SQKSMC text, JYKSBM text, JYKSMC text, BGJGDM text, BGJGMC text, SQRQ time, CJRQ time, JYRQ time, BGSJ time, BBDM text, BBMC text, JYBBH text, BBZT number, BBCJBW text, JSBBSJ time, JYXMMC text, JYXMDM text, JYSQJGMC text, JYJGMC text, JSBBRQSJ time, JYJSQM text, JYJSGH text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM text, CYBQMC text, CYCWH text, ZYBMLX number, ZYZDBM text, ZYZDMC text, ZYZYZDZZBM text, ZYZYZDZZMC text, MZBMLX number, MZZDBM text, MZZDMC text, MZZYZDZZBM text, RYSJ time, CYSJ time, CYZTDM number ) 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, YQMC text, CKZFWDX text, CKZFWXX number, CKZFWSX number, JLDW text ) 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 hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 自2000年12月30日,到2020年10月26日,8951695这个医疗机构处理了多少次新生儿门诊
SELECT COUNT(*) FROM mzjzjlb WHERE YLJGDM = '8951695' AND JZKSRQ BETWEEN '2000-12-30' AND '2020-10-26' AND ZSEBZ > 0
css
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 number, FLX_MED_ORG_ID text, MED_SER_ORG_NO text, CLINIC_TYPE text, MED_TYPE number, CLINIC_ID text, IN_DIAG_DIS_CD text, IN_DIAG_DIS_NM text, OUT_DIAG_DIS_CD text, OUT_DIAG_DIS_NM text, INPT_AREA_BED text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, OUT_DIAG_DOC_CD text, OUT_DIAG_DOC_NM text, MAIN_COND_DES text, INSU_TYPE text, IN_HOSP_DAYS number, MED_AMOUT number, FERTILITY_STS number, DATA_ID text, SYNC_TIME time, REIMBURSEMENT_FLG number, HOSP_LEV number, HOSP_STS number, INSURED_IDENTITY number, SERVANT_FLG text, TRADE_TYPE number, INSURED_STS text, REMOTE_SETTLE_FLG text ) 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 number, ILL_PAY number, CIVIL_SUBSIDY number, PER_SOL number, PER_EXP number, DATA_ID text, SYNC_TIME time, OUT_HOSP_DATE time, CLINIC_ID text, MED_TYPE number, INSURED_STS text, INSURED_IDENTITY number, TRADE_TYPE number, RECIPE_BILL_ID text, ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, REIMBURS_FLG number, SENDER_DEAL_ID text, RECEIVER_DEAL_ID text, SENDER_REVOKE_ID text, RECEIVER_REVOKE_ID text, SENDER_OFFSET_ID text, RECEIVER_OFFSET_ID text, LAS_OVE_PAY number, OVE_ADD_PAY number, SUP_ADD_PAY number, CKC102 number, CASH_PAY number, COM_ACC_PAY number, ENT_ACC_PAY number, ENT_PAY number, COM_PAY number, OLDC_FUND_PAY number, SPE_FUND_PAY number ) CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text, VAL_UNIT text, DOSE_UNIT text, DOSE_FORM text, SPEC text, USE_FRE text, EACH_DOSAGE text, QTY number, UNIVALENT number, AMOUNT number, SELF_PAY_PRO number, RER_SOL number, SELF_PAY_AMO number, UP_LIMIT_AMO number, OVE_SELF_AMO number, EXP_OCC_DATE time, RECIPE_BILL_ID text, FLX_MED_ORG_ID text, MED_ORG_DEPT_CD text, MED_ORG_DEPT_NM text, HOSP_DOC_CD text, HOSP_DOC_NM text, REF_STA_FLG number, DATA_ID text, SYNC_TIME time, PRESCRIPTION_CODE text, PRESCRIPTION_ID text, TRADE_TYPE number, STA_FLG number, STA_DATE time, REIMBURS_TYPE number, FXBZ number, REMOTE_SETTLE_FLG text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- 不低于10岁的病患的医疗记录的医疗费总额是多少?计算出平均值
SELECT AVG(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_AGE >= 10)
css
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Give me the comparison about the average of School_ID over the All_Home , and group by attribute All_Home by a bar chart, and could you show by the X in desc please?
SELECT All_Home, AVG(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC
nvbench
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 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 ) 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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- provide the number of patients who have a medicare insurance and diagnosis icd9 code is 79439.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.icd9_code = "79439"
mimicsql_data
CREATE TABLE table_name_39 ( winner VARCHAR, prize VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who was the winner of the prize z 1,226,711?
SELECT winner FROM table_name_39 WHERE prize = "zł 1,226,711"
sql_create_context
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 text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear 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 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 ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- among patients tested for chloride, how many of them were aged below 82?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "82" AND lab.label = "Chloride"
mimicsql_data
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) 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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) 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, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) 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 number ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) -- Using valid SQLite, answer the following questions for the tables provided above. -- the last time during the last year patient 015-96048 was diagnosed with what was?
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-96048')) AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY diagnosis.diagnosistime DESC LIMIT 1
eicu
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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) 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, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what were the four most frequently ordered specimen tests for patients who were previously diagnosed with anemia - iron deficiency anemia secondary to chronic blood in 2105 within the same hospital visit?
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'anemia - iron deficiency anemia secondary to chronic blood' AND STRFTIME('%y', diagnosis.diagnosistime) = '2105') AS t1 JOIN (SELECT patient.uniquepid, microlab.culturesite, microlab.culturetakentime, patient.patienthealthsystemstayid FROM microlab JOIN patient ON microlab.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', microlab.culturetakentime) = '2105') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.culturetakentime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.culturesite) AS t3 WHERE t3.c1 <= 4
eicu
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 ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Return a histogram on how old is each gender, on average?, show by the Y-axis from high to low.
SELECT gender, AVG(age) FROM Person GROUP BY gender ORDER BY AVG(age) DESC
nvbench
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense 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 ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) 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 PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) 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 ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Most effective Fastest Guns in the West (enlightened percentage times quantity). Top 500 most effective Fastest Guns in the West Enlightened badges weighted against total Accepted answers with score >= 10 Enlightened requires an Accepted Answer with score >= 10, posted first. The higher their number * higher percentage of all accepted answers makes for a very effective Fastest Gun in the West.
SELECT a.OwnerUserId AS "user_link", COUNT(DISTINCT a.Id) AS "accepted", COUNT(DISTINCT b.Id) AS "enlightened", (CAST(COUNT(DISTINCT b.Id) AS FLOAT) / COUNT(DISTINCT a.Id)) * 100.0 AS "percentage_enlightened", COUNT(DISTINCT b.Id) * (CAST(COUNT(DISTINCT b.Id) AS FLOAT) / COUNT(DISTINCT a.Id)) * 100.0 AS "weighting" FROM Votes AS v, Posts AS q, Posts AS a INNER JOIN Badges AS b ON b.UserId = a.OwnerUserId WHERE v.VoteTypeId = 1 AND v.PostId = a.Id AND q.AcceptedAnswerId = a.Id AND q.OwnerUserId != a.OwnerUserId AND a.Score >= 10 AND b.Name = 'Enlightened' GROUP BY a.OwnerUserId ORDER BY Weighting DESC LIMIT 100
sede
CREATE TABLE table_name_10 ( record VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Record on July 12?
SELECT record FROM table_name_10 WHERE date = "july 12"
sql_create_context
CREATE TABLE table_5095 ( "Date" text, "City" text, "Opponent" text, "Results\u00b9" text, "Type of game" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the result of the game against Luxembourg?
SELECT "Results\u00b9" FROM table_5095 WHERE "Opponent" = 'luxembourg'
wikisql
CREATE TABLE table_34712 ( "Year" text, "National Champion" text, "Runner-Up" text, "Location" text, "Host" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Runner-up in the Monroe County Sports Commission?
SELECT "Runner-Up" FROM table_34712 WHERE "Host" = 'monroe county sports commission'
wikisql
CREATE TABLE table_27146 ( "Week" real, "Date" text, "Kickoff" text, "Opponent" text, "Final score" text, "Team record" text, "Game site" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the team record after the Frankfurt Galaxy matchup?
SELECT "Team record" FROM table_27146 WHERE "Opponent" = 'Frankfurt Galaxy'
wikisql