instruction stringlengths 11 303 | input stringlengths 38 5.51k | output stringlengths 25 1.92k | text stringlengths 321 6.52k |
|---|---|---|---|
what were the top three most common lab tests in 2103? | CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE d_items (
... | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE STRFTIME('%y', labevents.charttime) = '2103' GROUP BY labevents.itemid) 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 were the top three most common lab tests in 2103? ### Input: CREATE TABLE diagnoses_icd (
row_id number,
subjec... |
What is the lowest rank of the team with 0 bronze, 1 silver, and more than 0 gold? | CREATE TABLE table_name_69 (
rank INTEGER,
gold VARCHAR,
bronze VARCHAR,
silver VARCHAR
) | SELECT MIN(rank) FROM table_name_69 WHERE bronze = 0 AND silver = 1 AND gold > 0 | 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 rank of the team with 0 bronze, 1 silver, and more than 0 gold? ### Input: CREATE TABLE table_name_69 (
... |
what are the three most common procedures for patients that had previously been diagnosed with depression - moderate within 2 months in a year before? | 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,
... | SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'depression - moderate' AND DATETIME(diag... | 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 three most common procedures for patients that had previously been diagnosed with depression - moderate within ... |
For those employees who did not have any job in the past, return a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday, show in asc by the y-axis. | 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 HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(SALARY) | 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 did not have any job in the past, return a bar chart about the distribution of hire_date and the ave... |
What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000. Visualize by pie chart. | CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40)... | SELECT JOB_TITLE, MAX_SALARY - MIN_SALARY FROM jobs WHERE MAX_SALARY BETWEEN 12000 AND 18000 | 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 job titles, and range of salaries for jobs with maximum salary between 12000 and 18000. Visualize by pie chart.... |
what is the number of patients whose primary disease is st elevated myocardial infarction\cardiac cath and lab test fluid is cerebrospinal fluid (csf)? | CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.fluid = "Cerebrospinal Fluid (CSF)" | 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 primary disease is st elevated myocardial infarction\cardiac cath and lab test fluid is... |
List the number of completion students in each month and bin date of completion by month interval with a bar chart, display from high to low by the Y-axis. | CREATE TABLE Subjects (
subject_id INTEGER,
subject_name VARCHAR(120)
)
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_description VARCHAR(255)
)
CREATE TABLE Course_Authors_and_Tutors (
author_id INTEGER,
author_tu... | SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment ORDER BY COUNT(date_of_completion) 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: List the number of completion students in each month and bin date of completion by month interval with a bar chart, display ... |
What is Record, when Game is '36'? | CREATE TABLE table_name_24 (
record VARCHAR,
game VARCHAR
) | SELECT record FROM table_name_24 WHERE game = 36 | 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 Record, when Game is '36'? ### Input: CREATE TABLE table_name_24 (
record VARCHAR,
game VARCHAR
) ### Respon... |
what are the three most commonly ordered procedures for patients who have received temporary tracheostomy within 2 months previously in 2102? | 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 d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.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 = admi... | 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 three most commonly ordered procedures for patients who have received temporary tracheostomy within 2 months pr... |
How many laps are there for grid 8? | CREATE TABLE table_58478 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | SELECT "Laps" FROM table_58478 WHERE "Grid" = '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: How many laps are there for grid 8? ### Input: CREATE TABLE table_58478 (
"Driver" text,
"Constructor" text,
"La... |
how many of the patients diagnosed with mv collision nos-driver received id therapy? | 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,
... | 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 = "Mv collision NOS-driver" AND prescriptions.route = "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: how many of the patients diagnosed with mv collision nos-driver received id therapy? ### Input: CREATE TABLE procedures (
... |
how much has patient 30987 to pay for their hospital stay in the first hospital encounter? | CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id ... | SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30987 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime 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: how much has patient 30987 to pay for their hospital stay in the first hospital encounter? ### Input: CREATE TABLE inputeven... |
Please show the names and the players of clubs. | CREATE TABLE club (
name VARCHAR,
Club_ID VARCHAR
)
CREATE TABLE player (
Player_id VARCHAR,
Club_ID VARCHAR
) | SELECT T1.name, T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_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: Please show the names and the players of clubs. ### Input: CREATE TABLE club (
name VARCHAR,
Club_ID VARCHAR
)
CREA... |
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, for employee_id, hire_date, visualize the trend, list in ascending by the X. | 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 regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE countries (
COUNTRY_ID... | SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE | 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 whose salary is in the range of 8000 and 12000 and commission is not null or department number does not ... |
what are the procedures that are the top four most commonly received during the last year? | CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location... | 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, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of ye... | 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 procedures that are the top four most commonly received during the last year? ### Input: CREATE TABLE d_icd_pro... |
What date has the format of CD and catalog of alca-274? | CREATE TABLE table_70693 (
"Region" text,
"Date" text,
"Label" text,
"Format" text,
"Catalog" text
) | SELECT "Date" FROM table_70693 WHERE "Format" = 'cd' AND "Catalog" = 'alca-274' | 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 date has the format of CD and catalog of alca-274? ### Input: CREATE TABLE table_70693 (
"Region" text,
"Date" ... |
How many students are from each city, and which cities have more than one cities? | CREATE TABLE dorm (
dormid number,
dorm_name text,
student_capacity number,
gender text
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE lives_in (
stuid number,
dorm... | SELECT COUNT(*), city_code FROM student GROUP BY city_code HAVING COUNT(*) > 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: How many students are from each city, and which cities have more than one cities? ### Input: CREATE TABLE dorm (
dormid ... |
What date did the Mountaineers score 27 points and their opponent scored more that 7? | CREATE TABLE table_69892 (
"Date" text,
"Bowl" text,
"Result" text,
"Points For" real,
"Points Against" real
) | SELECT "Date" FROM table_69892 WHERE "Points Against" > '7' AND "Points For" = '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 date did the Mountaineers score 27 points and their opponent scored more that 7? ### Input: CREATE TABLE table_69892 (
... |
What Week 4 has a Week 2 of samantha speer? | CREATE TABLE table_12982 (
"Week 1" text,
"Week 2" text,
"Week 3" text,
"Week 4" text,
"Week 5" text
) | SELECT "Week 4" FROM table_12982 WHERE "Week 2" = 'samantha speer' | 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 Week 4 has a Week 2 of samantha speer? ### Input: CREATE TABLE table_12982 (
"Week 1" text,
"Week 2" text,
... |
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the average of employee_id bin hire_date by weekday in a bar chart. | 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(25)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varch... | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) 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... |
What is the highest game number? | CREATE TABLE table_13619027_10 (
game INTEGER
) | SELECT MAX(game) FROM table_13619027_10 | 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 highest game number? ### Input: CREATE TABLE table_13619027_10 (
game INTEGER
) ### Response: SELECT MAX(gam... |
What day does the team play at punt road oval? | CREATE TABLE table_74773 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | SELECT "Date" FROM table_74773 WHERE "Venue" = 'punt road 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: What day does the team play at punt road oval? ### Input: CREATE TABLE table_74773 (
"Home team" text,
"Home team sc... |
Show me about the distribution of All_Games and Team_ID in a bar chart, and list Team_ID from low to high order please. | 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 All_Games, Team_ID FROM basketball_match ORDER BY Team_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 All_Games and Team_ID in a bar chart, and list Team_ID from low to high order please. ### ... |
how many patients with diagnoses icd9 code 4210 have additive type drug prescription? | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "4210" AND prescriptions.drug_type = "ADDITIVE" | 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 diagnoses icd9 code 4210 have additive type drug prescription? ### Input: CREATE TABLE diagnoses (
... |
Who was home team South Melbourne's opponent? | CREATE TABLE table_name_13 (
away_team VARCHAR,
home_team VARCHAR
) | SELECT away_team FROM table_name_13 WHERE home_team = "south 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: Who was home team South Melbourne's opponent? ### Input: CREATE TABLE table_name_13 (
away_team VARCHAR,
home_team V... |
how many french restaurant are there in palo alto ? | CREATE TABLE restaurant (
id int,
name varchar,
food_type varchar,
city_name varchar,
rating "decimal
)
CREATE TABLE geographic (
city_name varchar,
county varchar,
region varchar
)
CREATE TABLE location (
restaurant_id int,
house_number int,
street_name varchar,
city_n... | SELECT COUNT(*) FROM location, restaurant WHERE location.city_name = 'palo alto' AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_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: how many french restaurant are there in palo alto ? ### Input: CREATE TABLE restaurant (
id int,
name varchar,
f... |
which tribunal pronounced the least number of sentences between 1701 and 1746 ? | CREATE TABLE table_203_303 (
id number,
"tribunal" text,
"number of autos da fe" number,
"executions in persona" number,
"executions in effigie" number,
"penanced" number,
"total" number
) | SELECT "tribunal" FROM table_203_303 ORDER BY "total" 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: which tribunal pronounced the least number of sentences between 1701 and 1746 ? ### Input: CREATE TABLE table_203_303 (
... |
What is the elevator when the elector is Pietro Colonna? | CREATE TABLE table_name_77 (
elevator VARCHAR,
elector VARCHAR
) | SELECT elevator FROM table_name_77 WHERE elector = "pietro colonna" | 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 elevator when the elector is Pietro Colonna? ### Input: CREATE TABLE table_name_77 (
elevator VARCHAR,
e... |
What's bob tway's score? | CREATE TABLE table_name_51 (
score VARCHAR,
player VARCHAR
) | SELECT score FROM table_name_51 WHERE player = "bob tway" | 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's bob tway's score? ### Input: CREATE TABLE table_name_51 (
score VARCHAR,
player VARCHAR
) ### Response: SELEC... |
For those records from the products and each product's manufacturer, show me about the distribution of founder and the average of price , and group by attribute founder in a bar chart, display by the X-axis from low to high please. | CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | SELECT Founder, AVG(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder | 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 records from the products and each product's manufacturer, show me about the distribution of founder and the avera... |
What is the Opponent of the game in Week 3? | CREATE TABLE table_name_21 (
opponent VARCHAR,
week VARCHAR
) | SELECT opponent FROM table_name_21 WHERE week = 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 is the Opponent of the game in Week 3? ### Input: CREATE TABLE table_name_21 (
opponent VARCHAR,
week VARCHAR
)... |
Where is the director Dariush Mehrjui from? | CREATE TABLE table_name_99 (
country VARCHAR,
director VARCHAR
) | SELECT country FROM table_name_99 WHERE director = "dariush mehrjui" | 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: Where is the director Dariush Mehrjui from? ### Input: CREATE TABLE table_name_99 (
country VARCHAR,
director VARCHA... |
Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments by a bar chart. | CREATE TABLE Apartment_Buildings (
building_id INTEGER,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80)
)
CREATE TABLE Apartment_Bookings (
apt_bookin... | SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) | 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 each apartment type code with the number of apartments having that apartment type, in ascending order of the number o... |
What is the area (km ) for the country with a population of 16967000? | CREATE TABLE table_11780179_1 (
area__km²_ INTEGER,
population VARCHAR
) | SELECT MIN(area__km²_) FROM table_11780179_1 WHERE population = 16967000 | 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 area (km ) for the country with a population of 16967000? ### Input: CREATE TABLE table_11780179_1 (
area__k... |
What was the tournament that was on july 6, 1987? | CREATE TABLE table_59754 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | SELECT "Tournament" FROM table_59754 WHERE "Date" = 'july 6, 1987' | 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 tournament that was on july 6, 1987? ### Input: CREATE TABLE table_59754 (
"Outcome" text,
"Date" text,... |
what is the average gold when rank is total and silver is more than 20? | CREATE TABLE table_name_32 (
gold INTEGER,
rank VARCHAR,
silver VARCHAR
) | SELECT AVG(gold) FROM table_name_32 WHERE rank = "total" AND silver > 20 | 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 gold when rank is total and silver is more than 20? ### Input: CREATE TABLE table_name_32 (
gold INT... |
For each headquarter, what are the headquarter and how many companies are centered there Visualize by bar chart, and order names in descending order. | CREATE TABLE company (
Company_ID int,
Rank int,
Company text,
Headquarters text,
Main_Industry text,
Sales_billion real,
Profits_billion real,
Assets_billion real,
Market_Value real
)
CREATE TABLE station_company (
Station_ID int,
Company_ID int,
Rank_of_the_Year int
)
... | SELECT Headquarters, COUNT(*) FROM company GROUP BY Headquarters ORDER BY Headquarters 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: For each headquarter, what are the headquarter and how many companies are centered there Visualize by bar chart, and order n... |
provide the number of patients with elective admission type under procedure icd9 code 540. | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.icd9_code = "540" | 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 with elective admission type under procedure icd9 code 540. ### Input: CREATE TABLE prescript... |
In Spring or Summer 2008 which hardware courses are offered ? | 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,
... | SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%hardw... | 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: In Spring or Summer 2008 which hardware courses are offered ? ### Input: CREATE TABLE instructor (
instructor_id int,
... |
What is the head of government for Don Stephen Senanayake? | CREATE TABLE table_48325 (
"Name" text,
"Party" text,
"Tenure" text,
"Head(s) of Government" text,
"Ministerial title" text
) | SELECT "Head(s) of Government" FROM table_48325 WHERE "Name" = 'don stephen senanayake' | 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 head of government for Don Stephen Senanayake? ### Input: CREATE TABLE table_48325 (
"Name" text,
"Party... |
Show the minimum of the rooms in different decor using a bar chart, and rank by the decor in descending. | CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adults INTEGER,
Kids INTEGER
)
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
baseP... | SELECT decor, MIN(basePrice) FROM Rooms GROUP BY decor ORDER BY decor 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 the minimum of the rooms in different decor using a bar chart, and rank by the decor in descending. ### Input: CREATE T... |
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id, and could you list in descending by the Y? | CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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),
CO... | SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) 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: For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the ave... |
What is the venue when fitzroy was the away team? | CREATE TABLE table_name_80 (
venue VARCHAR,
away_team VARCHAR
) | SELECT venue FROM table_name_80 WHERE away_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 venue when fitzroy was the away team? ### Input: CREATE TABLE table_name_80 (
venue VARCHAR,
away_team V... |
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. | 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,... | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_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: For those employees who was hired before 2002-06-21, give me the comparison about the sum of salary over the job_id , and gr... |
whats the first value of mchc in 10/2103 for patient 70206? | CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime ti... | SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70206) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mchc') AND STRFTIME('%y-%m', labevents.charttime) = '2103-10' ORDER BY labevents... | 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: whats the first value of mchc in 10/2103 for patient 70206? ### Input: CREATE TABLE d_labitems (
row_id number,
item... |
What is the lowest population for the area that has a density of 36.7? | CREATE TABLE table_42839 (
"Name" text,
"Seat" text,
"Population (2011)" real,
"Area (km 2 )" real,
"Density (inhabitants/km 2 )" real
) | SELECT MIN("Population (2011)") FROM table_42839 WHERE "Density (inhabitants/km 2 )" = '36.7' | 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 population for the area that has a density of 36.7? ### Input: CREATE TABLE table_42839 (
"Name" text... |
What is the lowest evening gown score a contestant with an average less than 8.23, an interview score of 8.11, and a swimsuit larger than 7.84 has? | CREATE TABLE table_52656 (
"State" text,
"Interview" real,
"Swimsuit" real,
"Evening gown" real,
"Average" real
) | SELECT MIN("Evening gown") FROM table_52656 WHERE "Average" < '8.23' AND "Interview" = '8.11' AND "Swimsuit" > '7.84' | 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 evening gown score a contestant with an average less than 8.23, an interview score of 8.11, and a swimsui... |
Tell me the time/retired for Laps larger than 63 and has a grid of 20 | CREATE TABLE table_name_97 (
time_retired VARCHAR,
laps VARCHAR,
grid VARCHAR
) | SELECT time_retired FROM table_name_97 WHERE laps > 63 AND grid = 20 | 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 the time/retired for Laps larger than 63 and has a grid of 20 ### Input: CREATE TABLE table_name_97 (
time_retir... |
What is the lowest crowd when North Melbourne played at home? | CREATE TABLE table_name_92 (
crowd INTEGER,
home_team VARCHAR
) | SELECT MIN(crowd) FROM table_name_92 WHERE home_team = "north 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: What is the lowest crowd when North Melbourne played at home? ### Input: CREATE TABLE table_name_92 (
crowd INTEGER,
... |
who finished at the top with a gold medal ? | CREATE TABLE table_204_862 (
id number,
"rank" number,
"bib" number,
"athlete" text,
"country" text,
"run 1" text,
"run 2" text,
"total" text,
"behind" number
) | SELECT "athlete" FROM table_204_862 WHERE id = 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: who finished at the top with a gold medal ? ### Input: CREATE TABLE table_204_862 (
id number,
"rank" number,
"b... |
Show the number of companies in each headquarter with a bar chart, and order by the the number of headquarters in desc. | CREATE TABLE station_company (
Station_ID int,
Company_ID int,
Rank_of_the_Year int
)
CREATE TABLE company (
Company_ID int,
Rank int,
Company text,
Headquarters text,
Main_Industry text,
Sales_billion real,
Profits_billion real,
Assets_billion real,
Market_Value real
)
... | SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Headquarters ORDER BY COUNT(Headquarters) 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 the number of companies in each headquarter with a bar chart, and order by the the number of headquarters in desc. ### ... |
please list flights from ATLANTA to PHILADELPHIA | 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_... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILAD... | 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 list flights from ATLANTA to PHILADELPHIA ### Input: CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_... |
what is maximum days of hospital stay of patients whose gender is m? | 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 MAX(demographic.days_stay) FROM demographic WHERE demographic.gender = "M" | 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 maximum days of hospital stay of patients whose gender is m? ### Input: CREATE TABLE lab (
subject_id text,
... |
which is before ks tomori | CREATE TABLE table_204_623 (
id number,
"opponent" text,
"goals" text,
"wins" number,
"draws" number,
"losses" number,
"+- goals" number,
"matches" number,
"qualified" number,
"eliminated" number
) | SELECT "opponent" FROM table_204_623 WHERE id = (SELECT id FROM table_204_623 WHERE "opponent" = 'ks tomori') - 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: which is before ks tomori ### Input: CREATE TABLE table_204_623 (
id number,
"opponent" text,
"goals" text,
... |
What is Collingwood's home venue? | CREATE TABLE table_33502 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | SELECT "Venue" FROM table_33502 WHERE "Home team" = 'collingwood' | 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 Collingwood's home venue? ### Input: CREATE TABLE table_33502 (
"Home team" text,
"Home team score" text,
... |
Who was the opponent on september 10, 1979? | CREATE TABLE table_64116 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | SELECT "Opponent" FROM table_64116 WHERE "Date" = 'september 10, 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: Who was the opponent on september 10, 1979? ### Input: CREATE TABLE table_64116 (
"Week" real,
"Date" text,
"Opp... |
What was the score when the away team was Footscray? | CREATE TABLE table_name_25 (
away_team VARCHAR
) | SELECT away_team AS score FROM table_name_25 WHERE away_team = "footscray" | 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 score when the away team was Footscray? ### Input: CREATE TABLE table_name_25 (
away_team VARCHAR
) ### Res... |
please show me airlines with flights from DENVER to BOSTON with stop in PHILADELPHIA | 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 dual_carrier... | SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' 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: please show me airlines with flights from DENVER to BOSTON with stop in PHILADELPHIA ### Input: CREATE TABLE flight_stop (
... |
How many total rounds has lehigh as the college? | CREATE TABLE table_48825 (
"Round" real,
"Pick" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | SELECT COUNT("Round") FROM table_48825 WHERE "College" = 'lehigh' | 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 total rounds has lehigh as the college? ### Input: CREATE TABLE table_48825 (
"Round" real,
"Pick" real,
... |
what procedure did patient 010-32698 receive the first time this year. | CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE intakeoutput (
i... | SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-32698')) AND DATETIME(treatment.treatmenttime, 'start of year... | 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 procedure did patient 010-32698 receive the first time this year. ### Input: CREATE TABLE microlab (
microlabid num... |
How many clubs remain in the fourth round? | CREATE TABLE table_18328569_1 (
clubs_remaining INTEGER,
round VARCHAR
) | SELECT MIN(clubs_remaining) FROM table_18328569_1 WHERE round = "Fourth round" | 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 clubs remain in the fourth round? ### Input: CREATE TABLE table_18328569_1 (
clubs_remaining INTEGER,
round... |
how many patients with hyperglycemia primary disease have not been admitted to hospital? | 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 WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND demographic.days_stay > "0" | 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 hyperglycemia primary disease have not been admitted to hospital? ### Input: CREATE TABLE lab (
s... |
Which Artist has a Draw of 6? | CREATE TABLE table_66511 (
"Draw" real,
"Language" text,
"Artist" text,
"Song" text,
"English translation" text,
"Place" real,
"Points" real
) | SELECT "Artist" FROM table_66511 WHERE "Draw" = '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: Which Artist has a Draw of 6? ### Input: CREATE TABLE table_66511 (
"Draw" real,
"Language" text,
"Artist" text,... |
What is Pittodrie Stadium's maximum capacity? | CREATE TABLE table_11208143_9 (
capacity INTEGER,
stadium VARCHAR
) | SELECT MAX(capacity) FROM table_11208143_9 WHERE stadium = "Pittodrie" | 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 Pittodrie Stadium's maximum capacity? ### Input: CREATE TABLE table_11208143_9 (
capacity INTEGER,
stadium V... |
provide me the number of unmarried patients with tp route of drug administration. | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "SINGLE" AND prescriptions.route = "TP" | 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 me the number of unmarried patients with tp route of drug administration. ### Input: CREATE TABLE prescriptions (
... |
what is the number of patients admitted in hospital before 2180 who had albumin, pleural lab test? | 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 < "2180" AND lab.label = "Albumin, Pleural" | 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 admitted in hospital before 2180 who had albumin, pleural lab test? ### Input: CREATE TABLE l... |
nonstop flights from SEATTLE to DENVER | CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE fare_basis (
fare_basis_code ... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SEATTLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVE... | 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: nonstop flights from SEATTLE to DENVER ### Input: CREATE TABLE airline (
airline_code varchar,
airline_name text,
... |
What's the result when the score is 2-2? | CREATE TABLE table_11452 (
"Date" text,
"Opponents" text,
"Result" text,
"Score" text,
"Competition" text,
"Venue" text
) | SELECT "Result" FROM table_11452 WHERE "Score" = '2-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: What's the result when the score is 2-2? ### Input: CREATE TABLE table_11452 (
"Date" text,
"Opponents" text,
"R... |
calculate the length of patient 7959's stay for the last hospital stay. | 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 procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime t... | SELECT STRFTIME('%j', admissions.dischtime) - STRFTIME('%j', admissions.admittime) FROM admissions WHERE admissions.subject_id = 7959 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime 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: calculate the length of patient 7959's stay for the last hospital stay. ### Input: CREATE TABLE chartevents (
row_id num... |
What is the Pinyin name for Dingyuan County? | CREATE TABLE table_2173 (
"English Name" text,
"Simplified Chinese" text,
"Traditional Chinese" text,
"Pinyin" text,
"Area" real,
"Population" real,
"Density" real
) | SELECT "Pinyin" FROM table_2173 WHERE "English Name" = 'Dingyuan County' | 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 Pinyin name for Dingyuan County? ### Input: CREATE TABLE table_2173 (
"English Name" text,
"Simplified C... |
What is the value Others% when the value Others# is greater than 147 and the value Kerry% is 39.6%? | CREATE TABLE table_15683 (
"County" text,
"Kerry%" text,
"Kerry#" real,
"Bush%" text,
"Bush#" real,
"Others%" text,
"Others#" real
) | SELECT "Others%" FROM table_15683 WHERE "Others#" > '147' AND "Kerry%" = '39.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: What is the value Others% when the value Others# is greater than 147 and the value Kerry% is 39.6%? ### Input: CREATE TABLE ... |
Name the least total when bronze is less than 2 and rank is more than 2 with silver less than 1 | CREATE TABLE table_15177 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | SELECT MIN("Total") FROM table_15177 WHERE "Bronze" < '2' AND "Rank" > '2' AND "Silver" < '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: Name the least total when bronze is less than 2 and rank is more than 2 with silver less than 1 ### Input: CREATE TABLE tabl... |
what is the number of patients whose admission type is elective and drug type is additive? | 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 prescriptions... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.drug_type = "ADDITIVE" | 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 admission type is elective and drug type is additive? ### Input: CREATE TABLE diagnoses... |
What height was the player that played for the Rockets between 1992-93? | CREATE TABLE table_330 (
"Player" text,
"No.(s)" text,
"Height in Ft." text,
"Position" text,
"Years for Rockets" text,
"School/Club Team/Country" text
) | SELECT "Height in Ft." FROM table_330 WHERE "Years for Rockets" = '1992-93' | 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 height was the player that played for the Rockets between 1992-93? ### Input: CREATE TABLE table_330 (
"Player" tex... |
What is the theme, date, and attendance for the exhibition in year 2004? | CREATE TABLE artist (
artist_id number,
name text,
country text,
year_join number,
age number
)
CREATE TABLE exhibition_record (
exhibition_id number,
date text,
attendance number
)
CREATE TABLE exhibition (
exhibition_id number,
year number,
theme text,
artist_id numbe... | SELECT T2.theme, T1.date, T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 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 is the theme, date, and attendance for the exhibition in year 2004? ### Input: CREATE TABLE artist (
artist_id numb... |
Show me a stacked bar graph, the x-axis is the nationality of ship, and the y-axis is their total number of different nationality and split by ship type, and show X-axis in desc order. | CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
)
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
) | SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Type, Nationality ORDER BY Nationality 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 me a stacked bar graph, the x-axis is the nationality of ship, and the y-axis is their total number of different nation... |
on 5 4 ATLANTA to DENVER DL flight 257 | CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight 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 (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.flight_number = 257 AND flight.to_airport = AIRPORT_... | 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: on 5 4 ATLANTA to DENVER DL flight 257 ### Input: CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_f... |
Show the order ids and the number of invoices for each order. | CREATE TABLE Invoices (
order_id VARCHAR
) | SELECT order_id, COUNT(*) FROM Invoices GROUP BY order_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 the order ids and the number of invoices for each order. ### Input: CREATE TABLE Invoices (
order_id VARCHAR
) ### ... |
What lost has 528 as the points? | CREATE TABLE table_name_78 (
lost VARCHAR,
points_for VARCHAR
) | SELECT lost FROM table_name_78 WHERE points_for = "528" | 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 lost has 528 as the points? ### Input: CREATE TABLE table_name_78 (
lost VARCHAR,
points_for VARCHAR
) ### Resp... |
how many hours have passed since the the time patient 28447 was admitted to the icu? | CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', icustays.intime)) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28447) AND icustays.outtime 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: how many hours have passed since the the time patient 28447 was admitted to the icu? ### Input: CREATE TABLE procedures_icd ... |
when did the last procedure time of patient 18841 the previous year? | CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE prescriptions (
row_id number,
s... | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18841) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY procedures_icd.charttime DESC LIMIT ... | 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 did the last procedure time of patient 18841 the previous year? ### Input: CREATE TABLE diagnoses_icd (
row_id numb... |
what is the COACH economy class night service from BOSTON to SAN FRANCISCO | CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
econ... | 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, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND fare_basis.class_type = 'COACH' AND fa... | 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 COACH economy class night service from BOSTON to SAN FRANCISCO ### Input: CREATE TABLE code_description (
co... |
Of ASTRO 389 , how many sections are there ? | CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE course_offering (
offering_id int,
course_id int,
semes... | SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ASTRO' AND course.number = 389 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 | 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: Of ASTRO 389 , how many sections are there ? ### Input: CREATE TABLE offering_instructor (
offering_instructor_id int,
... |
What is the customer last name, id and phone number with most number of orders? | CREATE TABLE Orders (
customer_id VARCHAR
)
CREATE TABLE Customers (
customer_last_name VARCHAR,
phone_number VARCHAR,
customer_id VARCHAR
) | SELECT T2.customer_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) 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: What is the customer last name, id and phone number with most number of orders? ### Input: CREATE TABLE Orders (
custome... |
Find the number of departments in each school Plot them as bar chart, show y-axis in ascending order. | CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIGH_DEGREE varchar(5)
)
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10),
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
... | SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY COUNT(DISTINCT DEPT_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: Find the number of departments in each school Plot them as bar chart, show y-axis in ascending order. ### Input: CREATE TABL... |
Who was the leading scorer of the game on 20 February 2008? | CREATE TABLE table_51864 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Leading scorer" text,
"Record" text
) | SELECT "Leading scorer" FROM table_51864 WHERE "Date" = '20 february 2008' | 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 leading scorer of the game on 20 February 2008? ### Input: CREATE TABLE table_51864 (
"Date" text,
"Visi... |
For those employees who did not have any job in the past, for department_id, hire_date, visualize the trend, show x axis from high to low order please. | 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 countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE T... | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_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: For those employees who did not have any job in the past, for department_id, hire_date, visualize the trend, show x axis fro... |
Where the week # is Top 12, what is the result? | CREATE TABLE table_26250253_1 (
result VARCHAR,
week__number VARCHAR
) | SELECT result FROM table_26250253_1 WHERE week__number = "Top 12" | 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: Where the week # is Top 12, what is the result? ### Input: CREATE TABLE table_26250253_1 (
result VARCHAR,
week__num... |
what is the number of male patients who had home health care discharge? | 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,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.discharge_location = "HOME HEALTH CARE" | 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 male patients who had home health care discharge? ### Input: CREATE TABLE lab (
subject_id text,
... |
how much changes in the weight of patient 006-181433 last measured on the current hospital visit compared to the first value measured on the current hospital visit? | CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE treatment (
treat... | SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-181433' AND patient.hospitaldischargetime IS NULL) AND NOT patient.admissionweight IS NULL ORDER BY patient.unitadmittime 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: how much changes in the weight of patient 006-181433 last measured on the current hospital visit compared to the first value... |
how many patients whose admission location is phys referral/normal deli and drug code is dilt30? | 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 prescription... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND prescriptions.formulary_drug_cd = "DILT30" | 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 admission location is phys referral/normal deli and drug code is dilt30? ### Input: CREATE TABLE lab... |
Which title has a year later than 1986 with an album as the format? | CREATE TABLE table_name_29 (
title VARCHAR,
year VARCHAR,
format_s_ VARCHAR
) | SELECT title FROM table_name_29 WHERE year > 1986 AND format_s_ = "album" | 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 title has a year later than 1986 with an album as the format? ### Input: CREATE TABLE table_name_29 (
title VARCHA... |
To study GEOSCI 420 which classes do I need to take ? | CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational... | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT... | 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: To study GEOSCI 420 which classes do I need to take ? ### Input: CREATE TABLE area (
course_id int,
area varchar
)
... |
Who was the oppenent what the score was L 68-60? | CREATE TABLE table_21327 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location/Attendance" text,
"Record" text
) | SELECT "Opponent" FROM table_21327 WHERE "Score" = 'L 68-60' | 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 oppenent what the score was L 68-60? ### Input: CREATE TABLE table_21327 (
"Game" real,
"Date" text,
... |
When was the incident in Pol-E Khomri? | CREATE TABLE table_name_17 (
date VARCHAR,
location VARCHAR
) | SELECT date FROM table_name_17 WHERE location = "pol-e khomri" | 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 incident in Pol-E Khomri? ### Input: CREATE TABLE table_name_17 (
date VARCHAR,
location VARCHAR
) ### ... |
Which one of the tournaments had a QF in 1996? | CREATE TABLE table_55457 (
"Tournament" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text
) | SELECT "Tournament" FROM table_55457 WHERE "1996" = 'qf' | 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 one of the tournaments had a QF in 1996? ### Input: CREATE TABLE table_55457 (
"Tournament" text,
"1993" text,... |
For those records from the products and each product's manufacturer, find founder and the sum of price , and group by attribute founder, and visualize them by a bar chart, and list by the X in ascending please. | 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
) | SELECT Founder, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder | 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 records from the products and each product's manufacturer, find founder and the sum of price , and group by attrib... |
What was the result for the nomination of Best Revival of a Musical? | CREATE TABLE table_78856 (
"Year" real,
"Award Ceremony" text,
"Category" text,
"Nominee" text,
"Result" text
) | SELECT "Result" FROM table_78856 WHERE "Category" = 'best revival of a musical' | 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 result for the nomination of Best Revival of a Musical? ### Input: CREATE TABLE table_78856 (
"Year" real,
... |
count the number of patients whose primary disease is gastrointestinal bleed and age is less than 79? | 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,... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED" AND demographic.age < "79" | 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 primary disease is gastrointestinal bleed and age is less than 79? ### Input: CREATE TABL... |
had the sao2 of patient 021-49416 been until 06/2105 ever less than 69.0? | CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE medication (
medication... | SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-49416')) AND vitalperiodic.sao2 < 69.0 AND NOT vitalperiodic.sao... | 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 the sao2 of patient 021-49416 been until 06/2105 ever less than 69.0? ### Input: CREATE TABLE lab (
labid number,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.