instruction
stringlengths 151
7.46k
| output
stringlengths 2
4.44k
| source
stringclasses 26
values |
---|---|---|
CREATE TABLE table_35856 (
"Season" real,
"Overall" text,
"Slalom" text,
"Giant Slalom" text,
"Super G" text,
"Combined" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which combined score has an overall of 8?
| SELECT "Combined" FROM table_35856 WHERE "Overall" = '8' | wikisql |
CREATE TABLE player (
Player_ID int,
name text,
Position text,
Club_ID int,
Apps real,
Tries real,
Goals text,
Points real
)
CREATE TABLE club_rank (
Rank real,
Club_ID int,
Gold real,
Silver real,
Bronze real,
Total real
)
CREATE TABLE club (
Club_ID int,
name text,
Region text,
Start_year text
)
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Score text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List the position of players and the average number of points of players of each position by a bar chart, and display from low to high by the X.
| SELECT Position, AVG(Points) FROM player GROUP BY Position ORDER BY Position | nvbench |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
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 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 regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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)
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- For those employees who was hired before 2002-06-21, find job_id and the average of salary , and group by attribute job_id, and visualize them by a bar chart, and I want to rank by the Y-axis in descending.
| SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY) DESC | nvbench |
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
)
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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what number of patients with femoral artery thrombosis have 0 death status?
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "FEMORAL ARTERY THROMBOSIS" | mimicsql_data |
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_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_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.
-- 查查医疗机构3554465在2008年7月28日到2019年5月22日这段时间,住院的患者平均要住多长时间
| SELECT AVG(t_kc21.IN_HOSP_DAYS) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '3554465' AND t_kc21.IN_HOSP_DATE BETWEEN '2008-07-28' AND '2019-05-22' | css |
CREATE TABLE table_name_84 (
area_km_2 INTEGER,
population VARCHAR,
official_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest area for locations named Centreville having populations over 532?
| SELECT MAX(area_km_2) FROM table_name_84 WHERE population > 532 AND official_name = "centreville" | sql_create_context |
CREATE TABLE status (
station_id INTEGER,
bikes_available INTEGER,
docks_available INTEGER,
time TEXT
)
CREATE TABLE weather (
date TEXT,
max_temperature_f INTEGER,
mean_temperature_f INTEGER,
min_temperature_f INTEGER,
max_dew_point_f INTEGER,
mean_dew_point_f INTEGER,
min_dew_point_f INTEGER,
max_humidity INTEGER,
mean_humidity INTEGER,
min_humidity INTEGER,
max_sea_level_pressure_inches NUMERIC,
mean_sea_level_pressure_inches NUMERIC,
min_sea_level_pressure_inches NUMERIC,
max_visibility_miles INTEGER,
mean_visibility_miles INTEGER,
min_visibility_miles INTEGER,
max_wind_Speed_mph INTEGER,
mean_wind_speed_mph INTEGER,
max_gust_speed_mph INTEGER,
precipitation_inches INTEGER,
cloud_cover INTEGER,
events TEXT,
wind_dir_degrees INTEGER,
zip_code INTEGER
)
CREATE TABLE station (
id INTEGER,
name TEXT,
lat NUMERIC,
long NUMERIC,
dock_count INTEGER,
city TEXT,
installation_date TEXT
)
CREATE TABLE trip (
id INTEGER,
duration INTEGER,
start_date TEXT,
start_station_name TEXT,
start_station_id INTEGER,
end_date TEXT,
end_station_name TEXT,
end_station_id INTEGER,
bike_id INTEGER,
subscription_type TEXT,
zip_code INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Count those days and in which zip code was the min dew point lower than any day in zip code 94107 using a bar graph, and I want to list by the bars from low to high.
| SELECT date, COUNT(date) FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107) GROUP BY date ORDER BY date | nvbench |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime 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 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 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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what's the minimum cost of a hospital that includes a anion gap lab test until 2101?
| SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'anion gap')) AND STRFTIME('%y', cost.chargetime) <= '2101' GROUP BY cost.patienthealthsystemstayid) AS t1 | eicu |
CREATE TABLE table_204_711 (
id number,
"dance" text,
"best dancer(s)" text,
"best score" number,
"worst dancer(s)" text,
"worst score" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which is the last dance on the chart
| SELECT "dance" FROM table_204_711 ORDER BY id DESC LIMIT 1 | squall |
CREATE TABLE person_info_hz_info (
RYBH text,
KH number,
KLX number,
YLJGDM number
)
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 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 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 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 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 hz_info (
KH text,
KLX number,
YLJGDM text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 列出患者窦泰河入院科室名称包含遗传的在医院1388094中有什么住院就诊记录?
| SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX WHERE person_info.XM = '窦泰河' AND hz_info.YLJGDM = '1388094' AND zyjzjlb.JZKSMC LIKE '%遗传%' | css |
CREATE TABLE table_57035 (
"Date" text,
"Tournament" text,
"Location" text,
"Purse( $ )" real,
"Winner" text,
"Score" text,
"1st Prize( $ )" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the winner for Virginia?
| SELECT "Winner" FROM table_57035 WHERE "Location" = 'virginia' | wikisql |
CREATE TABLE table_6148 (
"Year" real,
"Finish position" text,
"1st day" text,
"2nd day" text,
"3rd day" text,
"4th Day" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the 3rd day that has bumped by clare as the 4th day?
| SELECT "3rd day" FROM table_6148 WHERE "4th Day" = 'bumped by clare' | 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 prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the number of patients whose year of birth is less than 2056 and lab test fluid is pleural?
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2056" AND lab.fluid = "Pleural" | mimicsql_data |
CREATE TABLE device (
Software_Platform VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Please show different software platforms and the corresponding number of devices using each.
| SELECT Software_Platform, COUNT(*) FROM device GROUP BY Software_Platform | sql_create_context |
CREATE TABLE table_name_62 (
a330 VARCHAR,
a310 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the A330 and the A310 wide?
| SELECT a330 FROM table_name_62 WHERE a310 = "wide" | sql_create_context |
CREATE TABLE table_11504 (
"Rank" real,
"Player" text,
"Country" text,
"Earnings ( $ )" real,
"Events" real,
"Wins" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average events that Al Geiberger played with wins smaller than 1?
| SELECT AVG("Events") FROM table_11504 WHERE "Player" = 'al geiberger' AND "Wins" < '1' | wikisql |
CREATE TABLE table_name_95 (
founded INTEGER,
joined_prsl VARCHAR,
home_city VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When is the club founded that founed prsl in 2008 and the home city is carolina 1?
| SELECT MAX(founded) FROM table_name_95 WHERE joined_prsl = 2008 AND home_city = "carolina 1" | sql_create_context |
CREATE TABLE customers_cards (
card_id number,
customer_id number,
card_type_code text,
card_number text,
date_valid_from time,
date_valid_to time,
other_card_details text
)
CREATE TABLE customers (
customer_id number,
customer_first_name text,
customer_last_name text,
customer_address text,
customer_phone text,
customer_email text,
other_customer_details text
)
CREATE TABLE accounts (
account_id number,
customer_id number,
account_name text,
other_account_details text
)
CREATE TABLE financial_transactions (
transaction_id number,
previous_transaction_id number,
account_id number,
card_id number,
transaction_type text,
transaction_date time,
transaction_amount number,
transaction_comment text,
other_transaction_details text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many cards does customer Art Turcotte have?
| SELECT COUNT(*) FROM customers_cards AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Art" AND T2.customer_last_name = "Turcotte" | spider |
CREATE TABLE table_name_98 (
event VARCHAR,
method VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What event did Mikhail Avetisyan win by method of DQ (eye gouging)?
| SELECT event FROM table_name_98 WHERE method = "dq (eye gouging)" | sql_create_context |
CREATE TABLE table_28019988_5 (
series__number INTEGER,
production_code VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What episode number in the series had a production code of bdf405?
| SELECT MIN(series__number) FROM table_28019988_5 WHERE production_code = "BDF405" | sql_create_context |
CREATE TABLE company (
Company_ID real,
Name text,
Headquarters text,
Industry text,
Sales_in_Billion real,
Profits_in_Billion real,
Assets_in_Billion real,
Market_Value_in_Billion real
)
CREATE TABLE employment (
Company_ID int,
People_ID int,
Year_working int
)
CREATE TABLE people (
People_ID int,
Age int,
Name text,
Nationality text,
Graduation_College text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Show the number of headquarters from each headquarters, could you order by the total number in ascending?
| SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Headquarters ORDER BY COUNT(Headquarters) | nvbench |
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 requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location 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 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 comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
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 program_course (
program_id int,
course_id int,
workload int,
category varchar
)
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 instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
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
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When Prof. Edward Chamberlin teaches it , does PROSTHOD 879 have a lab ?
| SELECT COUNT(*) = 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course.department = 'PROSTHOD' AND course.has_lab = 'N' AND course.number = 879 AND instructor.name LIKE '%Edward Chamberlin%' | advising |
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
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 program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req 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 gsi (
course_offering_id int,
student_id int
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location 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
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text 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 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 offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE area (
course_id int,
area varchar
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What class can I take to get the MDE requirement done easily ?
| SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%MDE%') | advising |
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 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 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 zyjzjlb_jybgb (
YLJGDM_ZYJZJLB text,
BGDH number,
YLJGDM number
)
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
)
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 患者的检测指标487632的参考值范围在哪个区间内可以被门诊诊断为慢性咽炎
| SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDSM = '慢性咽炎' AND jyjgzbb.JCZBDM = '487632' | css |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text,
person_info_CSD text,
person_info_CSRQ time,
person_info_GJDM text,
person_info_GJMC text,
person_info_JGDM text,
person_info_JGMC text,
person_info_MZDM text,
person_info_MZMC text,
person_info_XBDM number,
person_info_XBMC text,
person_info_XLDM text,
person_info_XLMC text,
person_info_XM text,
person_info_ZYLBDM text,
person_info_ZYMC 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 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 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 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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 患者秦茉莉在门诊诊断为疾病O29.001时的二氧化碳结果定量及单位分别是多少?
| SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW 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 mzjzjlb.JZZDBM = 'O29.001' AND hz_info.person_info_XM = '秦茉莉' AND jyjgzbb.JCZBMC = '二氧化碳' | css |
CREATE TABLE table_name_19 (
venue VARCHAR,
host VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the venue at Stanford University?
| SELECT venue FROM table_name_19 WHERE host = "stanford university" | sql_create_context |
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
)
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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 对于医疗费总额不少于6376.37元的医疗记录属于患者37329044的,列出入院诊断疾病编码是什么?名称是什么?
| SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '37329044' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 6376.37) | css |
CREATE TABLE table_name_45 (
byes INTEGER,
wins VARCHAR,
against VARCHAR,
club VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Byes has an Against smaller than 1297, and a Club of avoca, and Wins larger than 12?
| SELECT AVG(byes) FROM table_name_45 WHERE against < 1297 AND club = "avoca" AND wins > 12 | sql_create_context |
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.
-- Visualize the relationship between Team_ID and All_Games_Percent , and group by attribute All_Road.
| SELECT Team_ID, All_Games_Percent FROM basketball_match GROUP BY All_Road | nvbench |
CREATE TABLE table_74617 (
"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.
-- When was the game where the away team had a score of 13.8 (86)?
| SELECT "Date" FROM table_74617 WHERE "Away team score" = '13.8 (86)' | 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 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 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.
-- get me the number of patients admitted before 2129 who had lymphocytes, percent lab test done.
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2129" AND lab.label = "Lymphocytes, Percent" | mimicsql_data |
CREATE TABLE table_2289 (
"Type" text,
"Beam height (mm)" real,
"Flange width (mm)" real,
"Web thickness (mm)" text,
"Flange thickness (mm)" text,
"Weight (kg/m)" text,
"Cross-section area (cm 2 )" text,
"Moment of inertia in torsion (J) (cm 4 )" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the flange thickness when the weight is 19.9?
| SELECT "Flange thickness (mm)" FROM table_2289 WHERE "Weight (kg/m)" = '19.9' | wikisql |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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 job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
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 locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- For those employees who was hired before 2002-06-21, give me the comparison about the sum of salary over the job_id , and group by attribute job_id.
| SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID | nvbench |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
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 PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress 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 ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
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 PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description 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 PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense 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 Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE PostTags (
PostId number,
TagId 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 PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
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 FlagTypes (
Id number,
Name text,
Description text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Posts with a few edits after CW-ification.
| WITH cw_cte AS (SELECT ph.Id AS cwid, ph.PostId AS pid FROM PostHistory AS ph INNER JOIN Posts AS p ON ph.PostId = p.Id WHERE (ph.PostHistoryTypeId = 16)) SELECT COUNT(DISTINCT RevisionGUID), ph.PostId AS "post_link", revisions = 'site://posts/' + CAST(ph.PostId AS TEXT) + '/revisions' FROM cw_cte AS c INNER JOIN PostHistory AS ph ON (ph.PostId = c.pid) AND (ph.Id > c.cwid) WHERE (ph.PostHistoryTypeId IN (1, 2, 3, 4, 5, 6, 7, 8, 9)) GROUP BY ph.PostId ORDER BY COUNT(DISTINCT RevisionGUID) LIMIT 100 | sede |
CREATE TABLE table_22496344_1 (
weight INTEGER,
_number VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the weight when 20 is the number?
| SELECT MAX(weight) FROM table_22496344_1 WHERE _number = 20 | sql_create_context |
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.
-- 14145059782在就诊时有多少药品名称中包含蜜炼,金额是多少?
| SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.AMOUNT FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '14145059782' AND t_kc22.SOC_SRT_DIRE_NM LIKE '%蜜炼%' | css |
CREATE TABLE table_name_67 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the 2007 value with 2r in 2011 and 2r in 2008?
| SELECT 2007 FROM table_name_67 WHERE 2011 = "2r" AND 2008 = "2r" | sql_create_context |
CREATE TABLE table_203_631 (
id number,
"year" number,
"name of show" text,
"episodes" text,
"other guests" text,
"winner(s)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many of shows had at least 5 episodes ?
| SELECT COUNT(DISTINCT "name of show") FROM table_203_631 WHERE "episodes" >= 5 | squall |
CREATE TABLE table_name_29 (
time VARCHAR,
song_title VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the time from the song called Treat Me Nice?
| SELECT time FROM table_name_29 WHERE song_title = "treat me nice" | sql_create_context |
CREATE TABLE table_11161 (
"Date" text,
"Venue" text,
"Result" text,
"Win/ Loss/ Draw" text,
"Competition" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which competition had a result of 1-0?
| SELECT "Competition" FROM table_11161 WHERE "Result" = '1-0' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses_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 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 inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
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 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 d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title 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 d_items (
row_id number,
itemid number,
label text,
linksto 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 labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value 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.
-- what is the average total hospital cost which involves nonop cardiac/vasc exam in a year before?
| SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'nonop cardiac/vasc exam')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY cost.hadm_id) AS t1 | mimic_iii |
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 Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
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 PostTypes (
Id number,
Name text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description 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 PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
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 Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
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 TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
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 PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Posts with apt-get install that have no software button.
| SELECT Score, Id AS "post_link" FROM Posts WHERE Body LIKE '%apt-get install%' AND NOT Body LIKE '%add-apt-repository%' AND NOT Body LIKE '%apps.ubuntu.com%' AND PostTypeId = 2 AND ClosedDate IS NULL ORDER BY Score DESC | sede |
CREATE TABLE table_name_41 (
year INTEGER,
mixed_doubles VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average year with alfredo salazar fina salazar in mixed doubles?
| SELECT AVG(year) FROM table_name_41 WHERE mixed_doubles = "alfredo salazar fina salazar" | sql_create_context |
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
)
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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- provide the number of patients whose death status is 0 and procedure long title is insertion of non-drug-eluting coronary artery stent(s)?
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Insertion of non-drug-eluting coronary artery stent(s)" | mimicsql_data |
CREATE TABLE staff (
gender VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which gender makes up the majority of the staff?
| SELECT gender FROM staff GROUP BY gender ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_16855 (
"Player" text,
"No." real,
"Nationality" text,
"Position" text,
"Years for Jazz" text,
"School/Club Team" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What position did the player from maynard evans hs play
| SELECT "Position" FROM table_16855 WHERE "School/Club Team" = 'Maynard Evans HS' | wikisql |
CREATE TABLE table_10596 (
"Location" text,
"Venue" text,
"Promotion" text,
"Event" text,
"Inductee(s)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the location when the event was November reign?
| SELECT "Location" FROM table_10596 WHERE "Event" = 'november reign' | wikisql |
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
)
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.
-- 从0八年十二月六日开始,截止到一一年三月十一日,医院8895083的住院医疗记录总的数量有多少
| SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '8895083' AND IN_HOSP_DATE BETWEEN '2008-12-06' AND '2011-03-11' AND CLINIC_TYPE = '住院' | css |
CREATE TABLE table_13723 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the week when the result was W 38-24 and attendance was less than 43,449?
| SELECT SUM("Week") FROM table_13723 WHERE "Result" = 'w 38-24' AND "Attendance" < '43,449' | wikisql |
CREATE TABLE body_builder (
Body_Builder_ID int,
People_ID int,
Snatch real,
Clean_Jerk real,
Total real
)
CREATE TABLE people (
People_ID int,
Name text,
Height real,
Weight real,
Birth_Date text,
Birth_Place text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Show me about the correlation between Body_Builder_ID and Total in a scatter chart.
| SELECT Body_Builder_ID, Total FROM body_builder | nvbench |
CREATE TABLE table_name_89 (
top_10 INTEGER,
cuts_made VARCHAR,
events VARCHAR,
top_5 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the best top-10 result when events are fewer than 39, top-5 is 1 and more than 5 cuts are made?
| SELECT MAX(top_10) FROM table_name_89 WHERE events < 39 AND top_5 = 1 AND cuts_made > 5 | sql_create_context |
CREATE TABLE table_41988 (
"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 date has 6 as the tie no.?
| SELECT "Date" FROM table_41988 WHERE "Tie no" = '6' | wikisql |
CREATE TABLE table_48597 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the resolution of the fight when matt grice had a record of 2-0?
| SELECT "Res." FROM table_48597 WHERE "Record" = '2-0' | wikisql |
CREATE TABLE table_20422 (
"Episode Number" real,
"Air Date" text,
"Guest Host" text,
"Musical Guest (Song performed)" text,
"Who knows the most about the guest host? panelists" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the musical guest and what song was performed when Matt Willis and Chantelle Houghton were the panelists?
| SELECT "Musical Guest (Song performed)" FROM table_20422 WHERE "Who knows the most about the guest host? panelists" = 'Matt Willis and Chantelle Houghton' | wikisql |
CREATE TABLE table_104 (
"Name of lava dome" text,
"Country" text,
"Volcanic area" text,
"Composition" text,
"Last eruption or growth episode" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the composition at Valles lava dome?
| SELECT "Composition" FROM table_104 WHERE "Name of lava dome" = 'Valles lava dome' | wikisql |
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 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 vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime 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 lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
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 allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many patients is antihypertensive drug given to two times since 1 year ago?
| SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'antihypertensive drug' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-1 year')) GROUP BY patient.uniquepid) AS t1 WHERE t1.c1 = 2 | eicu |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM 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 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
)
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
)
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 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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 患者48565412出院科室名称包含感染性在医院9606012中的住院就诊记录分别是哪几例?
| SELECT * FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE hz_info.RYBH = '48565412' AND hz_info.YLJGDM = '9606012' AND wdmzjzjlb.CYKSMC LIKE '%感染性%' UNION SELECT * FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND hz_info.KH = bdmzjzjlb.KH AND hz_info.KLX = bdmzjzjlb.KLX WHERE hz_info.RYBH = '48565412' AND hz_info.YLJGDM = '9606012' AND bdmzjzjlb.CYKSMC LIKE '%感染性%' | css |
CREATE TABLE table_1939367_1 (
arabs_2011 VARCHAR,
province VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the province is Nunavut, what is the Arabs 2011 amount?
| SELECT arabs_2011 FROM table_1939367_1 WHERE province = "Nunavut" | sql_create_context |
CREATE TABLE table_name_32 (
name VARCHAR,
caps VARCHAR,
rank VARCHAR,
confederation VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which UEFA confederation member had a rank more than 17 and caps of 114?
| SELECT name FROM table_name_32 WHERE rank > 17 AND confederation = "uefa" AND caps = 114 | sql_create_context |
CREATE TABLE table_74641 (
"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.
-- Who was the away team playing the home team North Melbourne?
| SELECT "Away team" FROM table_74641 WHERE "Home team" = 'north melbourne' | wikisql |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount 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 CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
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 Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE PostTypes (
Id number,
Name 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 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 VoteTypes (
Id number,
Name 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 ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostTags (
PostId number,
TagId 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 FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
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 PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
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 PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE PostHistoryTypes (
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 ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Questions migrated to Stack Overflow.
| SELECT Posts.Id AS "post_link" FROM Posts, PostHistory WHERE Posts.Id = PostHistory.PostId AND PostHistoryTypeId = 35 LIMIT 50 | sede |
CREATE TABLE table_1434788_5 (
candidates VARCHAR,
incumbent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who were the candidates in the election where John Beatty was the incumbent?
| SELECT candidates FROM table_1434788_5 WHERE incumbent = "John Beatty" | sql_create_context |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- For those records from the products and each product's manufacturer, give me the comparison about the average of manufacturer over the name , and group by attribute name, display in ascending by the x axis.
| SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name | nvbench |
CREATE TABLE PHOTOS (
Tourist_Attraction_ID VARCHAR,
Name VARCHAR
)
CREATE TABLE TOURIST_ATTRACTIONS (
Name VARCHAR,
Tourist_Attraction_ID VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name of the tourist attraction that is associated with the photo 'game1'?
| SELECT T2.Name FROM PHOTOS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T1.Name = "game1" | sql_create_context |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId 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 ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
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 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 Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE ReviewTaskTypes (
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 PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE PostHistoryTypes (
Id number,
Name 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 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 PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find bad answers from 'not an answer' comments.
| SELECT c.PostId AS "post_link", YEAR(C.CreationDate) AS Year, MONTH(C.CreationDate) AS Month, c.Text AS Body FROM Comments AS C, Posts AS P WHERE (C.Text LIKE '%should be a comment%' AND LENGTH(c.Text) < 25 AND C.PostId = P.Id AND C.CreationDate < '2016-12-01T00:00:00.000' AND C.CreationDate > '2011-01-01T00:00:00.000' AND P.ClosedDate IS NULL AND NOT P.ParentId IS NULL AND P.Score < 1) ORDER BY Year, Month DESC LIMIT 1000 | sede |
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.
-- 出院日期是哪一天?就是57313257288的那个医疗就诊
| SELECT OUT_HOSP_DATE FROM t_kc21 WHERE MED_CLINIC_ID = '57313257288' | css |
CREATE TABLE table_71063 (
"Sydney" text,
"Melbourne" text,
"Perth" text,
"Adelaide" text,
"Gold Coast" text,
"Auckland" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the result for Gold Coast when Adelaide and Perth are yes, but Auckland is no?
| SELECT "Gold Coast" FROM table_71063 WHERE "Adelaide" = 'yes' AND "Auckland" = 'no' AND "Perth" = 'yes' | wikisql |
CREATE TABLE table_name_83 (
license VARCHAR,
system VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which License has a System of amiga, and a Name of pocketuae?
| SELECT license FROM table_name_83 WHERE system = "amiga" AND name = "pocketuae" | sql_create_context |
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 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 area (
course_id int,
area varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction 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 ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year 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_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text 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
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college 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 program_course (
program_id int,
course_id int,
workload int,
category varchar
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Are there courses in the Fall or Winter term at 300 -level ?
| SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'WN' AND semester.year = 2017)) AND course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 300 AND 300 + 100 AND semester.semester_id = course_offering.semester | advising |
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 hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM 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
)
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 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 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 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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 从零五年二月九日到一七年二月九日的这几年来,共有多少患者在医疗机构3982250外地门诊就诊
| SELECT COUNT(*) FROM zzmzjzjlb WHERE zzmzjzjlb.YLJGDM = '3982250' AND zzmzjzjlb.JZKSRQ BETWEEN '2005-02-09' AND '2017-11-19' AND zzmzjzjlb.WDBZ > 0 UNION SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '3982250' AND fzzmzjzjlb.JZKSRQ BETWEEN '2005-02-09' AND '2017-11-19' AND fzzmzjzjlb.WDBZ > 0 | css |
CREATE TABLE table_name_24 (
package_option VARCHAR,
country VARCHAR,
language VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the package/option for Italy when the language is italian?
| SELECT package_option FROM table_name_24 WHERE country = "italy" AND language = "italian" | sql_create_context |
CREATE TABLE table_name_91 (
population INTEGER,
town_status VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest population of a city that has a town status of 2010?
| SELECT MAX(population) FROM table_name_91 WHERE town_status = "2010" | sql_create_context |
CREATE TABLE table_76729 (
"Round" real,
"Pick" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many Picks have an Overall smaller than 304, and a Position of g, and a Round smaller than 11?
| SELECT COUNT("Pick") FROM table_76729 WHERE "Overall" < '304' AND "Position" = 'g' AND "Round" < '11' | wikisql |
CREATE TABLE table_78673 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was Australia's score when Peter Lonard played?
| SELECT "Score" FROM table_78673 WHERE "Country" = 'australia' AND "Player" = 'peter lonard' | wikisql |
CREATE TABLE table_14342480_5 (
field_goals VARCHAR,
position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Na,e the number of field goals for right tackle
| SELECT COUNT(field_goals) FROM table_14342480_5 WHERE position = "Right tackle" | sql_create_context |
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 comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
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 area (
course_id int,
area varchar
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location 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
)
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 program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req 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_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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Has NRE 336 ever taken place over the Summer time ?
| SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'NRE' AND course.number = 336 AND semester.semester = 'Summer' AND semester.semester_id = course_offering.semester | advising |
CREATE TABLE table_9856 (
"Rank" real,
"Venue name" text,
"Highest attendance" text,
"Location" text,
"Current seating capacity" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest Rank, when Location is Kinshasa, DR Congo, and when Current Seating Capacity is less than 80,000?
| SELECT MAX("Rank") FROM table_9856 WHERE "Location" = 'kinshasa, dr congo' AND "Current seating capacity" < '80,000' | wikisql |
CREATE TABLE table_15187735_21 (
segment_c VARCHAR,
series_ep VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the titles of segment c for series episode is 21-08?
| SELECT segment_c FROM table_15187735_21 WHERE series_ep = "21-08" | sql_create_context |
CREATE TABLE table_43549 (
"Official #" real,
"TF1 #" real,
"French title" text,
"English title" text,
"Air date (France)" text,
"Original Beechwood Bunny Tale / Source material" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Original Beechwood Bunny Tale/Source material that has an Official # larger than 38, and a TF1 # larger than 50, and an English title of 'sweet fabiola'?
| SELECT "Original Beechwood Bunny Tale / Source material" FROM table_43549 WHERE "Official #" > '38' AND "TF1 #" > '50' AND "English title" = 'sweet fabiola' | wikisql |
CREATE TABLE table_30293 (
"Vessel" text,
"Built" real,
"Max Speed" text,
"Length" text,
"Breadth" text,
"Flag" text,
"Propulsion" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the max speed when the vessel is gallion?
| SELECT "Max Speed" FROM table_30293 WHERE "Vessel" = 'Gallion' | wikisql |
CREATE TABLE table_26387382_1 (
power__mw·hr_yr_ VARCHAR,
location__county_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What locations are considered centre?
| SELECT power__mw·hr_yr_ FROM table_26387382_1 WHERE location__county_ = "Centre" | sql_create_context |
CREATE TABLE table_635 (
"W.H. Archer" text,
"J.E. Armstrong" text,
"H.L. Birkett" text,
"F.A. Brill" text,
"H.T. Brewer" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is J.E. Armstrong when W.H. Archer is D.M. Lawson?
| SELECT "J.E. Armstrong" FROM table_635 WHERE "W.H. Archer" = 'D.M. Lawson' | wikisql |
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE code_description (
code varchar,
description 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 compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE flight_fare (
flight_id int,
fare_id 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 airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
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 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 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 date_day (
month_number int,
day_number int,
year int,
day_name 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 class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant 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 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 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 flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- on monday i'd like to travel from LAS VEGAS to DETROIT MICHIGAN
| 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, state WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DETROIT' AND date_day.day_number = 21 AND date_day.month_number = 2 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 state.state_code = CITY_1.state_code AND state.state_name = 'MICHIGAN') AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'LAS VEGAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code | atis |
CREATE TABLE table_17801022_1 (
manufacturer VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What manufacturer won the race on November 2?
| SELECT manufacturer FROM table_17801022_1 WHERE date = "November 2" | 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 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
)
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 are with unknown/unspecified ethnicity and diagnosed with primary disease complete heart block?
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "UNKNOWN/NOT SPECIFIED" AND demographic.diagnosis = "COMPLETE HEART BLOCK" | mimicsql_data |
CREATE TABLE table_10568 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many times was the total more than 1, the nation was east germany and silver was more than 1?
| SELECT COUNT("Bronze") FROM table_10568 WHERE "Total" > '1' AND "Nation" = 'east germany' AND "Silver" > '1' | wikisql |
CREATE TABLE table_name_53 (
attempts INTEGER,
net_yards VARCHAR,
touchdowns VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the highest attempts that have net yards less than 631, and 2 for the touchdowns?
| SELECT MAX(attempts) FROM table_name_53 WHERE net_yards < 631 AND touchdowns = 2 | sql_create_context |
CREATE TABLE table_6170 (
"Year" real,
"Total Convictions" real,
"Homicide (Art. 111,112,113,116 StGB)" real,
"Serious Bodily Injury (Art. 122 StGB)" real,
"Minor Bodily Injury (Art. 123 StGB)" real,
"Sexual Contact with Children (Art. 187 StGB)" real,
"Rape (Art. 190 StGB)" real,
"Theft (Art. 139 StGB)" real,
"Robbery (Art. 140 StGB)" real,
"Receiving Stolen Goods (Art. 160 StGB)" real,
"Embezzlement (Art. 138 StGB)" real,
"Fraud (Art. 146 StGB)" real,
"Narcotics Possession" real,
"Major Violation of Traffic Laws (Art. 90 SVG)" real,
"Drunk Driving (Art. 91 Abs. 1 Satz 2 SVG)" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which year earlier than 2006 has the average Total Convictions of Fraud at 1,521?
| SELECT AVG("Total Convictions") FROM table_6170 WHERE "Fraud (Art. 146 StGB)" = '1,521' AND "Year" < '2006' | wikisql |
CREATE TABLE table_26996293_1 (
college VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What college did Jim Bennett attend?
| SELECT college FROM table_26996293_1 WHERE player = "Jim Bennett" | sql_create_context |
CREATE TABLE table_53665 (
"English" text,
"Scots" text,
"West Frisian" text,
"Afrikaans" text,
"Dutch" text,
"Dutch ( Limburgish )" text,
"Low German" text,
"Low German ( Groningen )" text,
"Middle German ( Luxemburgish )" text,
"German" text,
"Yiddish" text,
"Gothic" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Middle German (Luxemburgish) word for stone?
| SELECT "Middle German ( Luxemburgish )" FROM table_53665 WHERE "English" = 'stone' | wikisql |
CREATE TABLE status (
station_id INTEGER,
bikes_available INTEGER,
docks_available INTEGER,
time TEXT
)
CREATE TABLE station (
id INTEGER,
name TEXT,
lat NUMERIC,
long NUMERIC,
dock_count INTEGER,
city TEXT,
installation_date TEXT
)
CREATE TABLE trip (
id INTEGER,
duration INTEGER,
start_date TEXT,
start_station_name TEXT,
start_station_id INTEGER,
end_date TEXT,
end_station_name TEXT,
end_station_id INTEGER,
bike_id INTEGER,
subscription_type TEXT,
zip_code INTEGER
)
CREATE TABLE weather (
date TEXT,
max_temperature_f INTEGER,
mean_temperature_f INTEGER,
min_temperature_f INTEGER,
max_dew_point_f INTEGER,
mean_dew_point_f INTEGER,
min_dew_point_f INTEGER,
max_humidity INTEGER,
mean_humidity INTEGER,
min_humidity INTEGER,
max_sea_level_pressure_inches NUMERIC,
mean_sea_level_pressure_inches NUMERIC,
min_sea_level_pressure_inches NUMERIC,
max_visibility_miles INTEGER,
mean_visibility_miles INTEGER,
min_visibility_miles INTEGER,
max_wind_Speed_mph INTEGER,
mean_wind_speed_mph INTEGER,
max_gust_speed_mph INTEGER,
precipitation_inches INTEGER,
cloud_cover INTEGER,
events TEXT,
wind_dir_degrees INTEGER,
zip_code INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- A bar chart for what are the number of the dates that have an average sea level pressure between 303 and 31?, could you sort in desc by the y axis?
| SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 ORDER BY COUNT(date) DESC | nvbench |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE 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
)
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.
-- give me the number of patients whose religion is christian scientist?
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.religion = "CHRISTIAN SCIENTIST" | mimicsql_data |
CREATE TABLE table_6775 (
"Season" text,
"Round" text,
"Date" text,
"Home" text,
"Away" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What round had a home of FC augsburg with the result of 3-0?
| SELECT "Round" FROM table_6775 WHERE "Home" = 'fc augsburg' AND "Result" = '3-0' | wikisql |
CREATE TABLE routes (
rid integer,
dst_apid integer,
dst_ap varchar(4),
src_apid bigint,
src_ap varchar(4),
alid bigint,
airline varchar(4),
codeshare text
)
CREATE TABLE airlines (
alid integer,
name text,
iata varchar(2),
icao varchar(3),
callsign text,
country text,
active varchar(2)
)
CREATE TABLE airports (
apid integer,
name text,
city text,
country text,
x real,
y real,
elevation bigint,
iata character varchar(3),
icao character varchar(4)
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the countries of all airlines whose names start with Orbit, and count them by a bar chart, could you display Y in desc order?
| SELECT country, COUNT(country) FROM airlines WHERE name LIKE 'Orbit%' GROUP BY country ORDER BY COUNT(country) DESC | nvbench |
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
)
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 根据不同的科室编码和出院诊断疾病编码,医疗就诊记录在医院9593496中所有患者的平均年龄都列出来是哪些?
| SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.OUT_DIAG_DIS_CD, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '9593496' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.OUT_DIAG_DIS_CD | css |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
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 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
)
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
)
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 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 was the daily average amount of insulin in patient 006-97726's body?
| SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-97726')) AND intakeoutput.celllabel = 'insulin' AND intakeoutput.cellpath LIKE '%intake%' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) | eicu |
CREATE TABLE table_name_34 (
average VARCHAR,
total_points VARCHAR,
rank_by_average VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the total average with 54 total points and a rank less than 10?
| SELECT COUNT(average) FROM table_name_34 WHERE total_points = 54 AND rank_by_average < 10 | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
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
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many patients whose admission type is urgent and lab test fluid is joint fluid?
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.fluid = "Joint Fluid" | mimicsql_data |
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 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 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
)
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 hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- 08728091这个患者曾有过什么异常情况?
| 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 = '08728091' AND jyjgzbb.JCZBJGDL < jyjgzbb.CKZFWXX OR jyjgzbb.JCZBJGDL > jyjgzbb.CKZFWSX UNION SELECT * 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 hz_info.RYBH = '08728091' AND jyjgzbb.JCZBJGDL < jyjgzbb.CKZFWXX OR jyjgzbb.JCZBJGDL > jyjgzbb.CKZFWSX UNION SELECT * 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 hz_info.RYBH = '08728091' AND jyjgzbb.JCZBJGDL < jyjgzbb.CKZFWXX OR jyjgzbb.JCZBJGDL > jyjgzbb.CKZFWSX | css |
CREATE TABLE aircraft (
aid number(9,0),
name varchar2(30),
distance number(6,0)
)
CREATE TABLE flight (
flno number(4,0),
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0)
)
CREATE TABLE certificate (
eid number(9,0),
aid number(9,0)
)
CREATE TABLE employee (
eid number(9,0),
name varchar2(30),
salary number(10,2)
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Show name and distance for all aircrafts by a bar chart, could you order by the x-axis in desc?
| SELECT name, distance FROM aircraft ORDER BY name DESC | nvbench |