instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
How many districts had crib damage of 1,164.50?
CREATE TABLE table_20403667_2 ( district VARCHAR, crop_damaged__in_lakh_inr__ VARCHAR )
SELECT COUNT(district) FROM table_20403667_2 WHERE crop_damaged__in_lakh_inr__ = "1,164.50"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many districts had crib damage of 1,164.50? ### Input: CREATE TABLE table_20403667_2 ( district VARCHAR, crop_da...
Which census ranking is 57.06 km big?
CREATE TABLE table_43498 ( "Official Name" text, "Status" text, "Area km 2" real, "Population" real, "Census Ranking" text )
SELECT "Census Ranking" FROM table_43498 WHERE "Area km 2" = '57.06'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which census ranking is 57.06 km big? ### Input: CREATE TABLE table_43498 ( "Official Name" text, "Status" text, ...
what is the number of patients whose age is less than 64 and days of hospital stay is greater than 11?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "64" AND demographic.days_stay > "11"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the number of patients whose age is less than 64 and days of hospital stay is greater than 11? ### Input: CREATE TAB...
What type of engine does the BF Racing Marron Excavations have that also has Monaco as chassis and Lee Filliponi as the driver?
CREATE TABLE table_74867 ( "Team" text, "Class" text, "Chassis" text, "Engine" text, "Driver" text )
SELECT "Engine" FROM table_74867 WHERE "Team" = 'bf racing marron excavations' AND "Chassis" = 'monaco' AND "Driver" = 'lee filliponi'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What type of engine does the BF Racing Marron Excavations have that also has Monaco as chassis and Lee Filliponi as the driv...
what are patient 14962's changes in weight last measured on the first hospital visit compared to the first value measured on the first hospital visit?
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14962 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartev...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what are patient 14962's changes in weight last measured on the first hospital visit compared to the first value measured on...
how many hours has it passed since patient 2518's first prescription of bupropion during their current hospital encounter?
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', prescriptions.startdate)) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2518 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'bupropion' ORDER BY prescriptions.startdate L...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many hours has it passed since patient 2518's first prescription of bupropion during their current hospital encounter? #...
At the venue Vfl Park, what was the Home team score?
CREATE TABLE table_55020 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Home team score" FROM table_55020 WHERE "Venue" = 'vfl park'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: At the venue Vfl Park, what was the Home team score? ### Input: CREATE TABLE table_55020 ( "Home team" text, "Home t...
Find the name of customers whose credit score is below the average credit scores of all customers.
CREATE TABLE bank ( branch_id number, bname text, no_of_customers number, city text, state text ) CREATE TABLE customer ( cust_id text, cust_name text, acc_type text, acc_bal number, no_of_loans number, credit_score number, branch_id number, state text ) CREATE TABL...
SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Find the name of customers whose credit score is below the average credit scores of all customers. ### Input: CREATE TABLE b...
what were the top three most common diagnoses that followed in the same month for those who received rt heart angiocardiogram during this year?
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 )...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what were the top three most common diagnoses that followed in the same month for those who received rt heart angiocardiogra...
count the number of patients whose diagnoses icd9 code is 481 and lab test fluid is blood?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "481" AND lab.fluid = "Blood"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients whose diagnoses icd9 code is 481 and lab test fluid is blood? ### Input: CREATE TABLE diagnoses...
how many current patients are of age 50s?
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 microlab ( microl...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL AND patient.age BETWEEN 50 AND 59
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many current patients are of age 50s? ### Input: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientuni...
what are the top three most common procedures?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 3
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what are the top three most common procedures? ### Input: CREATE TABLE lab ( labid number, patientunitstayid number,...
what is the admission type and lab test name for the patient id 2560?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
SELECT demographic.admission_type, lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "2560"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the admission type and lab test name for the patient id 2560? ### Input: CREATE TABLE procedures ( subject_id te...
is glucose patient 28443 has last measured on the current hospital visit greater than it was second to last measured on the current hospital visit?
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE...
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28443 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'glucose') ORDER BY labevents.charttime ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: is glucose patient 28443 has last measured on the current hospital visit greater than it was second to last measured on the ...
Return the highest acc percent across all basketball matches.
CREATE TABLE basketball_match ( team_id number, school_id number, team_name text, acc_regular_season text, acc_percent text, acc_home text, acc_road text, all_games text, all_games_percent number, all_home text, all_road text, all_neutral text ) CREATE TABLE university (...
SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Return the highest acc percent across all basketball matches. ### Input: CREATE TABLE basketball_match ( team_id number,...
A stacked bar chart showing the number of faults for different fault short name and skills required to fix them The x-axis is skill description and group by fault short name, and order by the Y in ascending.
CREATE TABLE Third_Party_Companies ( company_id INTEGER, company_type VARCHAR(5), company_name VARCHAR(255), company_address VARCHAR(255), other_company_details VARCHAR(255) ) CREATE TABLE Part_Faults ( part_fault_id INTEGER, part_id INTEGER, fault_short_name VARCHAR(20), fault_desc...
SELECT skill_description, COUNT(skill_description) FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY fault_short_name, skill_description ORDER BY COUNT(skill_description)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: A stacked bar chart showing the number of faults for different fault short name and skills required to fix them The x-axis i...
Who was the head coach in season 2?
CREATE TABLE table_19075 ( "Previous season" text, "Team" text, "Town" text, "Arena (capacity)" text, "Website" text, "Head Coach" text, "Foreign Players (max. 2)" text )
SELECT "Head Coach" FROM table_19075 WHERE "Previous season" = '2'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who was the head coach in season 2? ### Input: CREATE TABLE table_19075 ( "Previous season" text, "Team" text, "...
what is days of hospital stay and death status of subject id 74032?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
SELECT demographic.days_stay, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "74032"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is days of hospital stay and death status of subject id 74032? ### Input: CREATE TABLE diagnoses ( subject_id text,...
What is the election date for those politicians who left office on 1850-11-15?
CREATE TABLE table_28605 ( "Election number" real, "Election date" text, "District" text, "Province" text, "Took office" text, "Left office" text )
SELECT COUNT("Election date") FROM table_28605 WHERE "Left office" = '1850-11-15'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the election date for those politicians who left office on 1850-11-15? ### Input: CREATE TABLE table_28605 ( "El...
how many patients are with admission year before 2194 and with lab test item id 50817?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2194" AND lab.itemid = "50817"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients are with admission year before 2194 and with lab test item id 50817? ### Input: CREATE TABLE diagnoses ( ...
Visualize a bar chart about the distribution of meter_700 and meter_100 , and I want to show meter_100 in descending order.
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text...
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_100 DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Visualize a bar chart about the distribution of meter_700 and meter_100 , and I want to show meter_100 in descending order. ...
untreated systolic blood pressure > 150 mmhg and diastolic blood pressure > 90 mmhg
CREATE TABLE table_train_158 ( "id" int, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "moca_score" int, "diastolic_blood_pressure_dbp" int, "body_mass_index_bmi" float, "age" float, "NOUSE" float )
SELECT * FROM table_train_158 WHERE systolic_blood_pressure_sbp > 150 AND diastolic_blood_pressure_dbp > 90
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: untreated systolic blood pressure > 150 mmhg and diastolic blood pressure > 90 mmhg ### Input: CREATE TABLE table_train_158 ...
How many patients are admitted before the year 2123 and with lab test id 51143?
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, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2123" AND lab.itemid = "51143"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many patients are admitted before the year 2123 and with lab test id 51143? ### Input: CREATE TABLE lab ( subject_id...
subjects must have an admission blood glucose > 140 mg and < 400 mg / dl without laboratory evidence of diabetic ketoacidosis ( serum bicarbonate < 18 meq / l or positive serum or urinary ketones ) .
CREATE TABLE table_dev_4 ( "id" int, "hypothyroidism" bool, "serum_bicarbonate" int, "c_peptide_level" float, "autoimmune_disease" bool, "hemoglobin_a1c_hba1c" float, "positive_serum" bool, "inhaled_steroids" bool, "diabetic_ketoacidosis" bool, "creatinine_clearance_cl" float, ...
SELECT * FROM table_dev_4 WHERE admission_blood_glucose > 140 AND admission_blood_glucose < 400 OR (diabetic_ketoacidosis = 0 OR serum_bicarbonate < 18 OR positive_serum = 1 OR urinary_ketones = 1)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: subjects must have an admission blood glucose > 140 mg and < 400 mg / dl without laboratory evidence of diabetic ketoacidosi...
had any organism found in the last sputum, tracheal specimen microbiology test of patient 031-9128 until 2104?
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( ...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-9128')) AND microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIM...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: had any organism found in the last sputum, tracheal specimen microbiology test of patient 031-9128 until 2104? ### Input: CR...
how many patients treated with hydz20i had their body fluids tested by lab?
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 ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "HYDZ20I" AND lab.fluid = "Other Body Fluid"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients treated with hydz20i had their body fluids tested by lab? ### Input: CREATE TABLE prescriptions ( subj...
What shows for 2005 when 2002 shows 0 1?
CREATE TABLE table_name_16 ( Id VARCHAR )
SELECT 2005 FROM table_name_16 WHERE 2002 = "0–1"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What shows for 2005 when 2002 shows 0 1? ### Input: CREATE TABLE table_name_16 ( Id VARCHAR ) ### Response: SELECT 2005 ...
When Melbourne was the Away team, what was their score?
CREATE TABLE table_name_75 ( away_team VARCHAR )
SELECT away_team AS score FROM table_name_75 WHERE away_team = "melbourne"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When Melbourne was the Away team, what was their score? ### Input: CREATE TABLE table_name_75 ( away_team VARCHAR ) ### ...
What is the constructor for time/retired of handling?
CREATE TABLE table_56070 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
SELECT "Constructor" FROM table_56070 WHERE "Time/Retired" = 'handling'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the constructor for time/retired of handling? ### Input: CREATE TABLE table_56070 ( "Driver" text, "Construc...
since 1 year ago, patient 029-30149 has undergone a procedure?
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-30149')) AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: since 1 year ago, patient 029-30149 has undergone a procedure? ### Input: CREATE TABLE medication ( medicationid number,...
Which Away team had a score of 15.15 (105)?
CREATE TABLE table_11251 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Away team" FROM table_11251 WHERE "Away team score" = '15.15 (105)'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which Away team had a score of 15.15 (105)? ### Input: CREATE TABLE table_11251 ( "Home team" text, "Home team score...
What team was the game on February 27 played against?
CREATE TABLE table_73456 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
SELECT "Team" FROM table_73456 WHERE "Date" = 'February 27'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What team was the game on February 27 played against? ### Input: CREATE TABLE table_73456 ( "Game" real, "Date" text...
Can you tell me the lowest Decile that has the Area of matakohe, and the Roll larger than 86?
CREATE TABLE table_51780 ( "Name" text, "Years" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
SELECT MIN("Decile") FROM table_51780 WHERE "Area" = 'matakohe' AND "Roll" > '86'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Can you tell me the lowest Decile that has the Area of matakohe, and the Roll larger than 86? ### Input: CREATE TABLE table_...
what was patient 012-37411's age during their current hospital visit.
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREA...
SELECT patient.age FROM patient WHERE patient.uniquepid = '012-37411' AND patient.hospitaldischargetime IS NULL
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was patient 012-37411's age during their current hospital visit. ### Input: CREATE TABLE treatment ( treatmentid nu...
For NAVARCH 570 and 620 what are the prerequisites ?
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 semester ( semester_id int, semester varchar, year int ) CREATE TABLE...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE (COURSE_1.number = 570 OR COURSE_1.number = 620) AND COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.depar...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For NAVARCH 570 and 620 what are the prerequisites ? ### Input: CREATE TABLE student_record ( student_id int, course...
provide the number of patients whose age is less than 24 and item id is 50915?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "24" AND lab.itemid = "50915"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: provide the number of patients whose age is less than 24 and item id is 50915? ### Input: CREATE TABLE diagnoses ( subje...
the nation above algeria
CREATE TABLE table_203_377 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
SELECT "nation" FROM table_203_377 WHERE id = (SELECT id FROM table_203_377 WHERE "nation" = 'algeria') - 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: the nation above algeria ### Input: CREATE TABLE table_203_377 ( id number, "rank" number, "nation" text, "g...
give me the number of patients whose diagnoses long title is acute diastolic heart failure and lab test abnormal status is delta?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Acute diastolic heart failure" AND lab.flag = "delta"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give me the number of patients whose diagnoses long title is acute diastolic heart failure and lab test abnormal status is d...
What is the size of the crowd when the home team is Fitzroy?
CREATE TABLE table_54374 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT COUNT("Crowd") FROM table_54374 WHERE "Home team" = 'fitzroy'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the size of the crowd when the home team is Fitzroy? ### Input: CREATE TABLE table_54374 ( "Home team" text, ...
What was Geelong's score when they were the away team?
CREATE TABLE table_name_62 ( away_team VARCHAR )
SELECT away_team AS score FROM table_name_62 WHERE away_team = "geelong"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was Geelong's score when they were the away team? ### Input: CREATE TABLE table_name_62 ( away_team VARCHAR ) ### R...
List the number of vacators when successors were formally installed on June 22, 1868.
CREATE TABLE table_26650 ( "State (class)" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date of successors formal installation" text )
SELECT COUNT("Vacator") FROM table_26650 WHERE "Date of successors formal installation" = 'June 22, 1868'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: List the number of vacators when successors were formally installed on June 22, 1868. ### Input: CREATE TABLE table_26650 ( ...
Will 334 have a lab ?
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id 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 T...
SELECT COUNT(*) > 0 FROM course WHERE department = 'EECS' AND has_lab = 'Y' AND number = 334
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Will 334 have a lab ? ### Input: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, ...
What is the lowest amount of bronze medals won by Music City Mystique where they won more than 3 gold medals and less than 15 total medals?
CREATE TABLE table_14983 ( "Ensemble" text, "Gold Medals" real, "Silver Medals" real, "Bronze Medals" real, "Total Medals" real )
SELECT MIN("Bronze Medals") FROM table_14983 WHERE "Gold Medals" > '3' AND "Ensemble" = 'music city mystique' AND "Total Medals" < '15'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the lowest amount of bronze medals won by Music City Mystique where they won more than 3 gold medals and less than 1...
find a flight from WASHINGTON to SAN FRANCISCO on tuesday
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 22 AND date_day.month_number = 3...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: find a flight from WASHINGTON to SAN FRANCISCO on tuesday ### Input: CREATE TABLE food_service ( meal_code text, mea...
How many students are advised by each rank of faculty? List the rank and the number of students with a pie chart.
CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Participates_in ( stuid IN...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many students are advised by each rank of faculty? List the rank and the number of students with a pie chart. ### Input:...
count the number of patients who have been dead after having been diagnosed with gastroduodenal dis nec within 2 months since 2105.
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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_di...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients who have been dead after having been diagnosed with gastroduodenal dis nec within 2 months sinc...
give me the number of patients whose primary disease is transient ischemic attack and lab test fluid is blood?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "TRANSIENT ISCHEMIC ATTACK" AND lab.fluid = "Blood"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give me the number of patients whose primary disease is transient ischemic attack and lab test fluid is blood? ### Input: CR...
show the change in weight of patient 23070's measured at 2105-12-12 04:00:00 compared to the value measured at 2105-12-08 03:00:00?
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23070)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'a...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: show the change in weight of patient 23070's measured at 2105-12-12 04:00:00 compared to the value measured at 2105-12-08 03...
HOW MANY CARS HAD A CAR # SMALLER THAN 7 AND STARTED ON 2010?
CREATE TABLE table_8039 ( "Year started" real, "Number of cars" real, "Current car" text, "Car #" real, "Website" text )
SELECT "Number of cars" FROM table_8039 WHERE "Car #" < '7' AND "Year started" = '2010'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: HOW MANY CARS HAD A CAR # SMALLER THAN 7 AND STARTED ON 2010? ### Input: CREATE TABLE table_8039 ( "Year started" real, ...
Which Wins have a Goal Difference larger than 0, and Goals against larger than 40, and a Position smaller than 6, and a Club of sd indauchu?
CREATE TABLE table_78557 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
SELECT MIN("Wins") FROM table_78557 WHERE "Goal Difference" > '0' AND "Goals against" > '40' AND "Position" < '6' AND "Club" = 'sd indauchu'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which Wins have a Goal Difference larger than 0, and Goals against larger than 40, and a Position smaller than 6, and a Club...
How many Silver medals were won in total by all those with more than 3 bronze and exactly 16 gold?
CREATE TABLE table_name_50 ( silver INTEGER, bronze VARCHAR, gold VARCHAR )
SELECT SUM(silver) FROM table_name_50 WHERE bronze > 3 AND gold = 16
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many Silver medals were won in total by all those with more than 3 bronze and exactly 16 gold? ### Input: CREATE TABLE t...
Construction start of phase i includes what type?
CREATE TABLE table_68272 ( "Unit" text, "Type" text, "Gross MW" text, "Construction start" text, "Operation start" text )
SELECT "Type" FROM table_68272 WHERE "Construction start" = 'phase i'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Construction start of phase i includes what type? ### Input: CREATE TABLE table_68272 ( "Unit" text, "Type" text, ...
Who plays f position for depauw?
CREATE TABLE table_56544 ( "Round" text, "Player" text, "Position" text, "Team" text, "College" text )
SELECT "Player" FROM table_56544 WHERE "Position" = 'f' AND "College" = 'depauw'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who plays f position for depauw? ### Input: CREATE TABLE table_56544 ( "Round" text, "Player" text, "Position" t...
What is the latest week when the chicago bears are the opponent?
CREATE TABLE table_name_27 ( week INTEGER, opponent VARCHAR )
SELECT MAX(week) FROM table_name_27 WHERE opponent = "chicago bears"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the latest week when the chicago bears are the opponent? ### Input: CREATE TABLE table_name_27 ( week INTEGER, ...
if the matches are 16 what is the wc matches
CREATE TABLE table_30085411_1 ( WC INTEGER, matches VARCHAR )
SELECT MAX(WC) AS matches FROM table_30085411_1 WHERE matches = 16
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: if the matches are 16 what is the wc matches ### Input: CREATE TABLE table_30085411_1 ( WC INTEGER, matches VARCHAR ...
List the hardware model name and company name for the phone whose screen mode type is 'Graphics.
CREATE TABLE screen_mode ( Graphics_mode VARCHAR, Type VARCHAR ) CREATE TABLE phone ( Hardware_Model_name VARCHAR, Company_name VARCHAR, screen_mode VARCHAR )
SELECT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: List the hardware model name and company name for the phone whose screen mode type is 'Graphics. ### Input: CREATE TABLE scr...
tricor what is the price?
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time,...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'prescriptions' AND cost.event_id IN (SELECT prescriptions.row_id FROM prescriptions WHERE prescriptions.drug = 'tricor')
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: tricor what is the price? ### Input: CREATE TABLE patients ( row_id number, subject_id number, gender text, ...
Can you tell me the Record that has the Game of 19?
CREATE TABLE table_46830 ( "Game" real, "November" real, "Opponent" text, "Score" text, "Record" text )
SELECT "Record" FROM table_46830 WHERE "Game" = '19'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Can you tell me the Record that has the Game of 19? ### Input: CREATE TABLE table_46830 ( "Game" real, "November" re...
Return a bar chart about the distribution of Date_of_Birth and Height , display in desc by the names please.
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate re...
SELECT Date_of_Birth, Height FROM people ORDER BY Date_of_Birth DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Return a bar chart about the distribution of Date_of_Birth and Height , display in desc by the names please. ### Input: CREA...
For the Fall and Winter , what upper-level electives are offered ?
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE gsi ( c...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (semester.semester = ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For the Fall and Winter , what upper-level electives are offered ? ### Input: CREATE TABLE program ( program_id int, ...
show me the flights on tuesday morning from CHARLOTTE to BALTIMORE
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE flight ( aircraft_code_sequence text, ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((flight.departure_time BETWEEN 0 AND 1200) AND date_day.day_number = 22 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_nam...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: show me the flights on tuesday morning from CHARLOTTE to BALTIMORE ### Input: CREATE TABLE dual_carrier ( main_airline v...
Which home team has a Away team of hawthorn?
CREATE TABLE table_77898 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Home team" FROM table_77898 WHERE "Away team" = 'hawthorn'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which home team has a Away team of hawthorn? ### Input: CREATE TABLE table_77898 ( "Home team" text, "Home team scor...
what is the daily maximum ph value for patient 64292 until 4 months ago?
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 ...
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64292) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ph') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-4 mont...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the daily maximum ph value for patient 64292 until 4 months ago? ### Input: CREATE TABLE admissions ( row_id num...
What Circuit has a Date of 25 july?
CREATE TABLE table_79039 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text )
SELECT "Circuit" FROM table_79039 WHERE "Date" = '25 july'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What Circuit has a Date of 25 july? ### Input: CREATE TABLE table_79039 ( "Name" text, "Circuit" text, "Date" te...
how many patients whose drug name is milrinone?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Milrinone"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients whose drug name is milrinone? ### Input: CREATE TABLE diagnoses ( subject_id text, hadm_id text, ...
List all the policy types used by the customer enrolled in the most policies.
CREATE TABLE available_policies ( policy_id number, policy_type_code text, customer_phone text ) CREATE TABLE services ( service_id number, service_name text ) CREATE TABLE customers_policies ( customer_id number, policy_id number, date_opened time, date_closed time ) CREATE TABLE...
SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id G...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: List all the policy types used by the customer enrolled in the most policies. ### Input: CREATE TABLE available_policies ( ...
what is the attendance when the date is october 22, 2000?
CREATE TABLE table_name_12 ( attendance VARCHAR, date VARCHAR )
SELECT attendance FROM table_name_12 WHERE date = "october 22, 2000"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the attendance when the date is october 22, 2000? ### Input: CREATE TABLE table_name_12 ( attendance VARCHAR, ...
Show the names and ids of tourist attractions that are visited at least two times.
CREATE TABLE Tourist_Attractions ( Name VARCHAR, Tourist_Attraction_ID VARCHAR ) CREATE TABLE VISITS ( Tourist_Attraction_ID VARCHAR )
SELECT T1.Name, T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING COUNT(*) >= 2
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show the names and ids of tourist attractions that are visited at least two times. ### Input: CREATE TABLE Tourist_Attractio...
what is the name of the procedure that has been done two times since 05/2105 to patient 27172?
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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime ti...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 271...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the name of the procedure that has been done two times since 05/2105 to patient 27172? ### Input: CREATE TABLE chart...
What is the total medals in 1964?
CREATE TABLE table_name_24 ( total INTEGER, year_s__won VARCHAR )
SELECT MIN(total) FROM table_name_24 WHERE year_s__won = "1964"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the total medals in 1964? ### Input: CREATE TABLE table_name_24 ( total INTEGER, year_s__won VARCHAR ) ### R...
count the number of patients who have been diagnosed with neonatal hypoglycemia and discharged to psychiatric facility-partial hospitalization.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND diagnoses.short_title = "Neonatal hypoglycemia"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients who have been diagnosed with neonatal hypoglycemia and discharged to psychiatric facility-parti...
How many departments whose budget is more than the average budget in each building? Show me a bar chart, could you show by the bar in descending?
CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2), end_hr numeric(2), end_min numeric(2) ) CREATE TABLE takes ( ID varchar(5), course_id varchar(8), ...
SELECT building, COUNT(building) FROM department WHERE budget > (SELECT AVG(budget) FROM department) GROUP BY building ORDER BY building DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many departments whose budget is more than the average budget in each building? Show me a bar chart, could you show by t...
what were the three most common prescription drugs until 4 years ago for people in their 60 or above?
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE presc...
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY prescriptions.dr...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what were the three most common prescription drugs until 4 years ago for people in their 60 or above? ### Input: CREATE TABL...
how many patients with rheumatic heart failure diagnoses have delta abnormal lab test status?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Rheumatic heart failure" AND lab.flag = "delta"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients with rheumatic heart failure diagnoses have delta abnormal lab test status? ### Input: CREATE TABLE diagno...
Create a bar chart showing the number of city across city, and rank from high to low by the y axis.
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(2...
SELECT CITY, COUNT(CITY) FROM locations GROUP BY CITY ORDER BY COUNT(CITY) DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Create a bar chart showing the number of city across city, and rank from high to low by the y axis. ### Input: CREATE TABLE ...
What was the 1st leg for a team 1 of Teteks?
CREATE TABLE table_44167 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
SELECT "1st leg" FROM table_44167 WHERE "Team 1" = 'teteks'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the 1st leg for a team 1 of Teteks? ### Input: CREATE TABLE table_44167 ( "Team 1" text, "Agg." text, "...
among patients who have been prescribed buffered lidocaine 1%, what are the four most commonly prescribed drugs at the same time during this year?
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, heartr...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'buffered lidocaine 1%' AND DATETIME(medication.drug...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: among patients who have been prescribed buffered lidocaine 1%, what are the four most commonly prescribed drugs at the same ...
What is the average Total with a Rank greater than 1, and a Bronze larger than 8?
CREATE TABLE table_5451 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
SELECT AVG("Total") FROM table_5451 WHERE "Rank" > '1' AND "Bronze" > '8'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the average Total with a Rank greater than 1, and a Bronze larger than 8? ### Input: CREATE TABLE table_5451 ( "...
Top 200 users from Bulgaria.
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
SELECT Id AS "user_link", DisplayName, Reputation, Location FROM Users WHERE Location LIKE '%Sofia%' OR Location LIKE '%Bulgaria%' ORDER BY Reputation DESC LIMIT 200
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Top 200 users from Bulgaria. ### Input: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, ...
how many patients were diagnosed with bacterial pneumonia nos and the drug type is main?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Bacterial pneumonia NOS" AND prescriptions.drug_type = "MAIN"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients were diagnosed with bacterial pneumonia nos and the drug type is main? ### Input: CREATE TABLE procedures ...
What Player has a To par of +5 with a Score of 70-70-71-74=285?
CREATE TABLE table_62408 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
SELECT "Player" FROM table_62408 WHERE "To par" = '+5' AND "Score" = '70-70-71-74=285'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What Player has a To par of +5 with a Score of 70-70-71-74=285? ### Input: CREATE TABLE table_62408 ( "Place" text, ...
Linux Distribution Popularity (By tag). Questions per month for the top 10 distro tags on Serverfault. Does not count BSD or other non-Linux OSes. Probably not so useful on other SE sites where the tags may differ.
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS m, TagName, COUNT(*) FROM PostTags AS pt JOIN Posts AS q ON q.Id = pt.PostId JOIN Tags AS t ON t.Id = pt.TagId WHERE TagName IN ('arch-linux', 'centos', 'debian', 'fedora', 'gentoo', 'kali-linux', 'linux-mint', 'opensuse', 'rhel', 'ubuntu') AND q.CreationDat...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Linux Distribution Popularity (By tag). Questions per month for the top 10 distro tags on Serverfault. Does not count BSD or...
Which Opposing Team has an Against smaller than 19, and a Date of 20/05/1979?
CREATE TABLE table_66405 ( "Opposing Team" text, "Against" real, "Date" text, "Venue" text, "Status" text )
SELECT "Opposing Team" FROM table_66405 WHERE "Against" < '19' AND "Date" = '20/05/1979'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which Opposing Team has an Against smaller than 19, and a Date of 20/05/1979? ### Input: CREATE TABLE table_66405 ( "Opp...
Show me about the distribution of Team_Name and School_ID in a bar chart, and I want to rank by the total number in ascending.
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
SELECT Team_Name, School_ID FROM basketball_match ORDER BY School_ID
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show me about the distribution of Team_Name and School_ID in a bar chart, and I want to rank by the total number in ascendin...
Tell me who was the opponent on May 6
CREATE TABLE table_name_33 ( opponent VARCHAR, date VARCHAR )
SELECT opponent FROM table_name_33 WHERE date = "may 6"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Tell me who was the opponent on May 6 ### Input: CREATE TABLE table_name_33 ( opponent VARCHAR, date VARCHAR ) ### R...
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of email and salary in a bar chart.
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(...
SELECT EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distri...
when has patient 002-45437 received a prescription for the first time since 138 months ago?
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-45437')) AND DATETIME(medication.drugstarttime) >= DATETIM...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when has patient 002-45437 received a prescription for the first time since 138 months ago? ### Input: CREATE TABLE medicati...
Show how many installation date from each installation date, list in desc by the Y-axis please.
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_pre...
SELECT installation_date, COUNT(installation_date) FROM station ORDER BY COUNT(installation_date) DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show how many installation date from each installation date, list in desc by the Y-axis please. ### Input: CREATE TABLE weat...
Will there be an SLAVIC 871 section not on Monday next semester ?
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 TAB...
SELECT DISTINCT course_offering.section_number FROM course, course_offering, semester WHERE course_offering.monday = 'N' AND course.course_id = course_offering.course_id AND course.department = 'SLAVIC' AND course.number = 871 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Will there be an SLAVIC 871 section not on Monday next semester ? ### Input: CREATE TABLE student_record ( student_id in...
Which catalog is in cd format?
CREATE TABLE table_name_54 ( catalog VARCHAR, format VARCHAR )
SELECT catalog FROM table_name_54 WHERE format = "cd"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which catalog is in cd format? ### Input: CREATE TABLE table_name_54 ( catalog VARCHAR, format VARCHAR ) ### Respons...
count the number of patients who had the intake of nutramigen po since 4 years ago.
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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'nutramigen po' AND ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients who had the intake of nutramigen po since 4 years ago. ### Input: CREATE TABLE transfers ( ...
what airlines are AC and AS
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name 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, ...
SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'AC' OR airline_code = 'AS'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what airlines are AC and AS ### Input: CREATE TABLE date_day ( month_number int, day_number int, year int, d...
Please draw a bar chart to show the total number of different color, and sort by the Y-axis from high to low.
CREATE TABLE camera_lens ( id int, brand text, name text, focal_length_mm real, max_aperture real ) CREATE TABLE mountain ( id int, name text, Height real, Prominence real, Range text, Country text ) CREATE TABLE photos ( id int, camera_lens_id int, mountain_id ...
SELECT color, COUNT(color) FROM photos GROUP BY color ORDER BY COUNT(color) DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Please draw a bar chart to show the total number of different color, and sort by the Y-axis from high to low. ### Input: CRE...
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of phone_number and commission_pct .
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), ...
SELECT PHONE_NUMBER, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart ab...
Who is the away side at corio oval?
CREATE TABLE table_name_85 ( away_team VARCHAR, venue VARCHAR )
SELECT away_team FROM table_name_85 WHERE venue = "corio oval"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who is the away side at corio oval? ### Input: CREATE TABLE table_name_85 ( away_team VARCHAR, venue VARCHAR ) ### R...
When was the incumbent from the south carolina 1 district first elected?
CREATE TABLE table_36744 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text )
SELECT "First elected" FROM table_36744 WHERE "District" = 'south carolina 1'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When was the incumbent from the south carolina 1 district first elected? ### Input: CREATE TABLE table_36744 ( "District...
What home has 136-134 as the score?
CREATE TABLE table_38119 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Record" text )
SELECT "Home" FROM table_38119 WHERE "Score" = '136-134'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What home has 136-134 as the score? ### Input: CREATE TABLE table_38119 ( "Date" text, "Visitor" text, "Score" t...
For the group with 1.92% population in 1981, what was their percentage of the population in 1971?
CREATE TABLE table_4505 ( "Religious group" text, "Population % 1961" text, "Population % 1971" text, "Population % 1981" text, "Population % 1991" text, "Population % 2001" text )
SELECT "Population % 1971" FROM table_4505 WHERE "Population % 1981" = '1.92%'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For the group with 1.92% population in 1981, what was their percentage of the population in 1971? ### Input: CREATE TABLE ta...
What region is the catalogue released on June 8, 2004 from?
CREATE TABLE table_name_88 ( region VARCHAR, date VARCHAR )
SELECT region FROM table_name_88 WHERE date = "june 8, 2004"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What region is the catalogue released on June 8, 2004 from? ### Input: CREATE TABLE table_name_88 ( region VARCHAR, ...
Bar chart x axis customer last name y axis how many customer last name
CREATE TABLE Financial_Transactions ( transaction_id INTEGER, previous_transaction_id INTEGER, account_id INTEGER, card_id INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(...
SELECT customer_last_name, COUNT(customer_last_name) FROM Customers GROUP BY customer_last_name
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Bar chart x axis customer last name y axis how many customer last name ### Input: CREATE TABLE Financial_Transactions ( ...