instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
Which advisor has most number of students?
CREATE TABLE has_allergy ( stuid number, allergy text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE allergy_type ( allergy text, allergytype text )
SELECT advisor FROM student GROUP BY advisor 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: Which advisor has most number of students? ### Input: CREATE TABLE has_allergy ( stuid number, allergy text ) CREAT...
how many times patient 004-65311 has been prescribed for 500 ml flex cont excel : sodium chloride 0.9 % iv soln until 2104?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TAB...
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-65311')) AND medication.drugname = '500 ml flex cont excel : sodium chlori...
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 times patient 004-65311 has been prescribed for 500 ml flex cont excel : sodium chloride 0.9 % iv soln until 2104? ...
can you show me flights that are economy class from BALTIMORE to DALLAS
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE fare ( fare_id int, from_...
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 = 'DALLAS' AND fare_basis.economy = 'YES' AND fare.fare_basis...
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 show me flights that are economy class from BALTIMORE to DALLAS ### Input: CREATE TABLE time_interval ( period t...
when was the first time patient 006-2586 had the maximum heartrate the previous day.
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 vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586')) AND NOT vitalperiodic.heartrate 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: when was the first time patient 006-2586 had the maximum heartrate the previous day. ### Input: CREATE TABLE medication ( ...
Who did the Flames play against when Stephen Lee was the man of the match?
CREATE TABLE table_name_6 ( opponent VARCHAR, man_of_the_match VARCHAR )
SELECT opponent FROM table_name_6 WHERE man_of_the_match = "stephen lee"
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 did the Flames play against when Stephen Lee was the man of the match? ### Input: CREATE TABLE table_name_6 ( oppone...
What percentage did kennedy win while coakly won 37.9%
CREATE TABLE table_26594 ( "County" text, "Coakley %" text, "Coakley votes" real, "Brown %" text, "Brown votes" real, "Kennedy %" text, "Kennedy votes" real )
SELECT "Kennedy %" FROM table_26594 WHERE "Coakley %" = '37.9%'
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 percentage did kennedy win while coakly won 37.9% ### Input: CREATE TABLE table_26594 ( "County" text, "Coakley...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time, and rank from high to low by the total number.
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 HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) 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 do not work in departments with managers that have ids between 100 and 200, a bar chart shows the di...
Frequency of 100.1 has what on-air id?
CREATE TABLE table_5963 ( "Callsign" text, "Area served" text, "Frequency" text, "Band" text, "On-air ID" text, "Purpose" text )
SELECT "On-air ID" FROM table_5963 WHERE "Frequency" = '100.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: Frequency of 100.1 has what on-air id? ### Input: CREATE TABLE table_5963 ( "Callsign" text, "Area served" text, ...
Users by Location and Tag.
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation, COUNT(p.Id) FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE LOWER(Location) LIKE LOWER('%##Location##%') AND t.TagName ...
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: Users by Location and Tag. ### Input: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number...
What episode number in the series had 2.77 million U.S. viewers?
CREATE TABLE table_26764 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "U.S. viewers (million)" text, "Original air date" text, "Production code" text )
SELECT MAX("No. in series") FROM table_26764 WHERE "U.S. viewers (million)" = '2.77'
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 episode number in the series had 2.77 million U.S. viewers? ### Input: CREATE TABLE table_26764 ( "No. in series" r...
what is admission time and drug name of subject id 18480?
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.admittime, prescriptions.drug FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "18480"
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 admission time and drug name of subject id 18480? ### Input: CREATE TABLE diagnoses ( subject_id text, hadm_...
How many episodes have 18.73 million viewers?
CREATE TABLE table_29541 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. No." real, "Viewers (millions)" text )
SELECT COUNT("No. in series") FROM table_29541 WHERE "Viewers (millions)" = '18.73'
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 episodes have 18.73 million viewers? ### Input: CREATE TABLE table_29541 ( "No. in series" real, "Title" te...
What is the highest number in series with director as Phil Abraham?
CREATE TABLE table_26736040_1 ( no_in_series INTEGER, directed_by VARCHAR )
SELECT MAX(no_in_series) FROM table_26736040_1 WHERE directed_by = "Phil Abraham"
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 number in series with director as Phil Abraham? ### Input: CREATE TABLE table_26736040_1 ( no_in_ser...
A bar chart for finding the number of the names of Japanese constructors that have once earned more than 5 points?
CREATE TABLE lapTimes ( raceId INTEGER, driverId INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER ) CREATE TABLE constructorResults ( constructorResultsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, status TEXT ) CREATE TABLE qualifyi...
SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY 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: A bar chart for finding the number of the names of Japanese constructors that have once earned more than 5 points? ### Input...
Who's the incumbent in the district that first elected in 1969?
CREATE TABLE table_18169 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Results" text, "Candidates" text )
SELECT "Incumbent" FROM table_18169 WHERE "First elected" = '1969'
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's the incumbent in the district that first elected in 1969? ### Input: CREATE TABLE table_18169 ( "District" text, ...
What was the score for the game with FK Bratstvo as home team?
CREATE TABLE table_name_7 ( score VARCHAR, home VARCHAR )
SELECT score FROM table_name_7 WHERE home = "fk bratstvo"
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 for the game with FK Bratstvo as home team? ### Input: CREATE TABLE table_name_7 ( score VARCHAR, ...
What was the essendon score when they were at home?
CREATE TABLE table_33390 ( "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_33390 WHERE "Home team" = 'essendon'
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 essendon score when they were at home? ### Input: CREATE TABLE table_33390 ( "Home team" text, "Home te...
how many places for french food are there in palo alto ?
CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar ) CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE geographic ( city_name varchar, county varchar, reg...
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 places for french food are there in palo alto ? ### Input: CREATE TABLE location ( restaurant_id int, house...
What was the name of the away team that had a tie of 2?
CREATE TABLE table_name_93 ( away_team VARCHAR, tie_no VARCHAR )
SELECT away_team FROM table_name_93 WHERE tie_no = "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 was the name of the away team that had a tie of 2? ### Input: CREATE TABLE table_name_93 ( away_team VARCHAR, t...
Placing of 3 had what match w-l?
CREATE TABLE table_5822 ( "Placing" real, "Team" text, "Players" text, "Seeding" text, "Playoffs W-L" text, "Matches W-L" text )
SELECT "Matches W-L" FROM table_5822 WHERE "Placing" = '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: Placing of 3 had what match w-l? ### Input: CREATE TABLE table_5822 ( "Placing" real, "Team" text, "Players" tex...
Who is the Winnning driver in which lorenzo bandini has the fastest lap as well as the Pole position?
CREATE TABLE table_57916 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
SELECT "Winning driver" FROM table_57916 WHERE "Fastest lap" = 'lorenzo bandini' AND "Pole position" = 'lorenzo bandini'
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 Winnning driver in which lorenzo bandini has the fastest lap as well as the Pole position? ### Input: CREATE TABL...
What are the ids and details for all organizations that have grants of more than 6000 dollars. Show a pie chart.
CREATE TABLE Document_Types ( document_type_code VARCHAR(10), document_description VARCHAR(255) ) CREATE TABLE Organisations ( organisation_id INTEGER, organisation_type VARCHAR(10), organisation_details VARCHAR(255) ) CREATE TABLE Organisation_Types ( organisation_type VARCHAR(10), organi...
SELECT T2.organisation_details, T1.organisation_id FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_details
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 ids and details for all organizations that have grants of more than 6000 dollars. Show a pie chart. ### Input: ...
What date was the score 3 0, and set 1 was 25 22?
CREATE TABLE table_44808 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Total" text )
SELECT "Date" FROM table_44808 WHERE "Score" = '3–0' AND "Set 1" = '25–22'
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 was the score 3 0, and set 1 was 25 22? ### Input: CREATE TABLE table_44808 ( "Date" text, "Score" text, ...
what are the procedures that are the top four most commonly received in the last year?
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperio...
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4
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 in the last year? ### Input: CREATE TABLE treatment ( ...
what is the number of patients whose death status is 0 and diagnoses short title is cl skul base fx-coma nos?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Cl skul base fx-coma NOS"
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 death status is 0 and diagnoses short title is cl skul base fx-coma nos? ### Input: CRE...
count the number of patients whose marital status is married and procedure icd9 code is 4611?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "MARRIED" AND procedures.icd9_code = "4611"
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 marital status is married and procedure icd9 code is 4611? ### Input: CREATE TABLE demogr...
how many of the patients aged below 68 were on medicaid insurance?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Medicaid" AND demographic.age < "68"
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 aged below 68 were on medicaid insurance? ### Input: CREATE TABLE diagnoses ( subject_id text, ...
What was the time of the driver who had a grid of 22?
CREATE TABLE table_11188 ( "Driver" text, "Constructor" text, "Laps" text, "Time/Retired" text, "Grid" text )
SELECT "Time/Retired" FROM table_11188 WHERE "Grid" = '22'
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 time of the driver who had a grid of 22? ### Input: CREATE TABLE table_11188 ( "Driver" text, "Construc...
what was the last intake of patient 010-12900 for the patient?
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 lab ( labid numbe...
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-12900')) AND intakeoutput.cellpath LIKE '%intake%' ORDER...
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 last intake of patient 010-12900 for the patient? ### Input: CREATE TABLE vitalperiodic ( vitalperiodicid n...
What is the Score of a Record 24 23 3?
CREATE TABLE table_37300 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
SELECT "Score" FROM table_37300 WHERE "Record" = '24–23–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 Score of a Record 24 23 3? ### Input: CREATE TABLE table_37300 ( "Date" text, "Visitor" text, "Score...
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a line chart about the change of department_id over hire_date , and show in desc by the X-axis 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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) 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 do not work in departments with managers that have ids between 100 and 200, draw a line chart about ...
what are the five most commonly conducted specimen tests this year?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeou...
SELECT t1.culturesite FROM (SELECT microlab.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microlab WHERE DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY microlab.culturesite) AS t1 WHERE t1.c1 <= 5
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 five most commonly conducted specimen tests this year? ### Input: CREATE TABLE microlab ( microlabid number...
What are the movie titles with the highest average rating and what are those ratings?
CREATE TABLE rating ( rid number, mid number, stars number, ratingdate time ) CREATE TABLE reviewer ( rid number, name text ) CREATE TABLE movie ( mid number, title text, year number, director text )
SELECT T2.title, AVG(T1.stars) FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid GROUP BY T1.mid ORDER BY AVG(T1.stars) 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 are the movie titles with the highest average rating and what are those ratings? ### Input: CREATE TABLE rating ( r...
what is the year when then organisation is star awards, the result is won and the nominated work title is n/a?
CREATE TABLE table_51488 ( "Year" real, "Organisation" text, "Award" text, "Nominated Work Title" text, "Result" text )
SELECT "Year" FROM table_51488 WHERE "Organisation" = 'star awards' AND "Result" = 'won' AND "Nominated Work Title" = 'n/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: what is the year when then organisation is star awards, the result is won and the nominated work title is n/a? ### Input: CR...
Show me about the distribution of All_Games and ACC_Percent in a bar chart.
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT All_Games, ACC_Percent FROM basketball_match
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 ACC_Percent in a bar chart. ### Input: CREATE TABLE basketball_match ( T...
how many turkish lakes ate less than 10 square kilometers in size ?
CREATE TABLE table_204_341 ( id number, "name in english" text, "name in turkish" text, "area (km2)" text, "depth" text, "location (districts and/or provinces)" text )
SELECT COUNT(*) FROM table_204_341 WHERE "area (km2)" < 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: how many turkish lakes ate less than 10 square kilometers in size ? ### Input: CREATE TABLE table_204_341 ( id number, ...
Top 100 User from Pakistan.
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%pakistan%' OR UPPER(Location) LIKE '%PK' ORDER BY Reputation DESC LIMIT 100
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 100 User from Pakistan. ### Input: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDa...
Name the record for l 24 22
CREATE TABLE table_14520977_1 ( record VARCHAR, result VARCHAR )
SELECT record FROM table_14520977_1 WHERE result = "L 24–22"
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 record for l 24 22 ### Input: CREATE TABLE table_14520977_1 ( record VARCHAR, result VARCHAR ) ### Response...
what is the number of patients whose insurance is medicare and lab test name is reticulocyte count, automated?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Medicare" AND lab.label = "Reticulocyte Count, Automated"
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 insurance is medicare and lab test name is reticulocyte count, automated? ### Input: CR...
Give me the comparison about School_ID over the Team_Name , order by the total number in descending.
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT Team_Name, School_ID FROM basketball_match ORDER BY School_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: Give me the comparison about School_ID over the Team_Name , order by the total number in descending. ### Input: CREATE TABLE...
Who played the Rams on October 2, 2005?
CREATE TABLE table_33040 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
SELECT "Opponent" FROM table_33040 WHERE "Date" = 'october 2, 2005'
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 played the Rams on October 2, 2005? ### Input: CREATE TABLE table_33040 ( "Week" real, "Date" text, "Opponen...
What are the number of the completion dates of all the tests that have result 'Fail'?, display from low to high by the total number.
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_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), per...
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion)
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 number of the completion dates of all the tests that have result 'Fail'?, display from low to high by the total...
What is the number of each allergie that the student with first name Lisa has? Draw a bar chart.
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Has_Allergy ( StuID INTEGE...
SELECT T1.Allergy, COUNT(T1.Allergy) FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" GROUP BY T1.Allergy
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 each allergie that the student with first name Lisa has? Draw a bar chart. ### Input: CREATE TABLE Stu...
Visualize a bar chart about the distribution of All_Neutral and ACC_Percent , and sort by the x-axis in asc.
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_Neutral, ACC_Percent FROM basketball_match ORDER BY All_Neutral
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 All_Neutral and ACC_Percent , and sort by the x-axis in asc. ### Input: CREA...
What season did Stoke City win?
CREATE TABLE table_name_13 ( season VARCHAR, winner VARCHAR )
SELECT season FROM table_name_13 WHERE winner = "stoke city"
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 season did Stoke City win? ### Input: CREATE TABLE table_name_13 ( season VARCHAR, winner VARCHAR ) ### Respons...
For those employees who did not have any job in the past, show me about the distribution of hire_date and the sum of manager_id bin hire_date by time in a bar chart, and rank from high to low by the y axis.
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(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, show me about the distribution of hire_date and the sum of manager...
I want to see the away team the has a home team of richmond
CREATE TABLE table_name_74 ( away_team VARCHAR, home_team VARCHAR )
SELECT away_team FROM table_name_74 WHERE home_team = "richmond"
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: I want to see the away team the has a home team of richmond ### Input: CREATE TABLE table_name_74 ( away_team VARCHAR, ...
Visualize a bar chart to show editors' names and their ages.
CREATE TABLE editor ( Editor_ID int, Name text, Age real ) CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int ) CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text )
SELECT Name, Age FROM editor
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 to show editors' names and their ages. ### Input: CREATE TABLE editor ( Editor_ID int, Name te...
What are the number of the names of races held between 2009 and 2011?, and list from low to high by the names.
CREATE TABLE status ( statusId INTEGER, status TEXT ) CREATE TABLE constructorStandings ( constructorStandingsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER ) CREATE TABLE lapTimes ( raceId INTEGER, driverId...
SELECT name, COUNT(name) FROM races WHERE year BETWEEN 2009 AND 2011 GROUP BY name ORDER BY 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: What are the number of the names of races held between 2009 and 2011?, and list from low to high by the names. ### Input: CR...
count the number of patients whose lab test name is magnesium, urine?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Magnesium, Urine"
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 lab test name is magnesium, urine? ### Input: CREATE TABLE demographic ( subject_id t...
Count those dates for each day of the week and in which zip code was the min dew point lower than any day in zip code 94107 using a bar graph.
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE weather ( date TEX...
SELECT date, COUNT(date) FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107)
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 those dates for each day of the week and in which zip code was the min dew point lower than any day in zip code 94107 ...
how many patients primarily diagnosed with rash had drug route as tp?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "RASH" 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: how many patients primarily diagnosed with rash had drug route as tp? ### Input: CREATE TABLE demographic ( subject_id t...
The competition that took place on 4 Apr 1997 ended with what as the score?
CREATE TABLE table_name_42 ( score VARCHAR, date VARCHAR )
SELECT score FROM table_name_42 WHERE date = "4 apr 1997"
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 competition that took place on 4 Apr 1997 ended with what as the score? ### Input: CREATE TABLE table_name_42 ( scor...
Prevalence of SQL, Schema, IC.
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE R...
SELECT COUNT(Id) FROM Posts WHERE (Tags LIKE '%sql%' OR Tags LIKE '%schema%' OR Tags LIKE '%integrity constraint%')
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: Prevalence of SQL, Schema, IC. ### Input: CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PendingFlags...
What is the average attendance for the game before week 4 that was on october 16, 1955?
CREATE TABLE table_37772 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
SELECT AVG("Attendance") FROM table_37772 WHERE "Date" = 'october 16, 1955' AND "Week" < '4'
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 attendance for the game before week 4 that was on october 16, 1955? ### Input: CREATE TABLE table_37772 ...
has patient 18866 received during this hospital visit a laboratory test?
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18866 AND admissions.dischtime 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: has patient 18866 received during this hospital visit a laboratory test? ### Input: CREATE TABLE outputevents ( row_id n...
Find the number of the names of swimmers who has a result of 'win'.
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 name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY 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 the names of swimmers who has a result of 'win'. ### Input: CREATE TABLE event ( ID int, Name tex...
What are the number of the dates of the assessment notes?, list y-axis in asc order.
CREATE TABLE Behavior_Incident ( incident_id INTEGER, incident_type_code VARCHAR(10), student_id INTEGER, date_incident_start DATETIME, date_incident_end DATETIME, incident_summary VARCHAR(255), recommendations VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Addresses ( addr...
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY COUNT(date_of_notes)
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 number of the dates of the assessment notes?, list y-axis in asc order. ### Input: CREATE TABLE Behavior_Incide...
Who was Carlton's away team opponent?
CREATE TABLE table_name_79 ( away_team VARCHAR, home_team VARCHAR )
SELECT away_team FROM table_name_79 WHERE home_team = "carlton"
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 Carlton's away team opponent? ### Input: CREATE TABLE table_name_79 ( away_team VARCHAR, home_team VARCHAR )...
Where did Hawthorn play as the home team?
CREATE TABLE table_name_41 ( venue VARCHAR, home_team VARCHAR )
SELECT venue FROM table_name_41 WHERE home_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: Where did Hawthorn play as the home team? ### Input: CREATE TABLE table_name_41 ( venue VARCHAR, home_team VARCHAR )...
How many people were at the match on July 13/
CREATE TABLE table_68683 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
SELECT "Attendance" FROM table_68683 WHERE "Date" = 'july 13'
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 people were at the match on July 13/ ### Input: CREATE TABLE table_68683 ( "Date" text, "Opponent" text, ...
Is DANCE 131 harder than DANCE 695 ?
CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total...
SELECT COUNT(*) > 0 FROM course AS COURSE_0, course AS COURSE_1, program_course AS PROGRAM_COURSE_0, program_course AS PROGRAM_COURSE_1 WHERE COURSE_0.department = 'DANCE' AND COURSE_0.number = 131 AND COURSE_1.department = 'DANCE' AND COURSE_1.number = 695 AND PROGRAM_COURSE_0.course_id = COURSE_0.course_id AND PROGRA...
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 DANCE 131 harder than DANCE 695 ? ### Input: CREATE TABLE ta ( campus_job_id int, student_id int, location va...
Posts tagged with TagName ordered by upvotes DESC.
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, ...
SELECT Posts.OwnerUserId, TagName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 WHERE TagName = '##TagName##' GROUP BY Posts.OwnerUserId, TagName ORDER BY UpVotes 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: Posts tagged with TagName ordered by upvotes DESC. ### Input: CREATE TABLE Votes ( Id number, PostId number, Vot...
Provide the number of patients admitted to the hospital before year 2157 whose procedure long title is open and other left hemicolectomy.
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2157" AND procedures.long_title = "Open and other left hemicolectomy"
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 admitted to the hospital before year 2157 whose procedure long title is open and other left h...
Which player was drafted by the Saskatchewan Roughriders?
CREATE TABLE table_43135 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
SELECT "Player" FROM table_43135 WHERE "CFL Team" = 'saskatchewan roughriders'
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 player was drafted by the Saskatchewan Roughriders? ### Input: CREATE TABLE table_43135 ( "Pick #" real, "CFL ...
The To par of +14 was won in what year(s)?
CREATE TABLE table_name_17 ( year_s__won VARCHAR, to_par VARCHAR )
SELECT year_s__won FROM table_name_17 WHERE to_par = "+14"
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 To par of +14 was won in what year(s)? ### Input: CREATE TABLE table_name_17 ( year_s__won VARCHAR, to_par VARCH...
which game was attended by the least number of people ?
CREATE TABLE table_204_565 ( id number, "game" number, "date" text, "opponent" text, "venue" text, "result" text, "attendance" number, "goalscorers" text )
SELECT "date" FROM table_204_565 ORDER BY "attendance" 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 game was attended by the least number of people ? ### Input: CREATE TABLE table_204_565 ( id number, "game" nu...
Top 300 bangladeshi Stackoverfollow user ranking.
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId numb...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS PositionNumber, Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Bangladesh%' ORDER BY Reputation DESC LIMIT 300
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 300 bangladeshi Stackoverfollow user ranking. ### Input: CREATE TABLE PostNotices ( Id number, PostId number, ...
give me the number of patients whose admission type is emergency and lab test category is hematology?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab."CATEGORY" = "Hematology"
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 admission type is emergency and lab test category is hematology? ### Input: CREATE TABL...
provide the number of patients whose year of death is less than or equal to 2173 and item id is 51082?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2173.0" AND lab.itemid = "51082"
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 year of death is less than or equal to 2173 and item id is 51082? ### Input: CREATE TAB...
how many patients stayed in hospital for more than 1 day and were diagnosed with icd9 code 99859?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "1" AND diagnoses.icd9_code = "99859"
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 stayed in hospital for more than 1 day and were diagnosed with icd9 code 99859? ### Input: CREATE TABLE de...
Who has a hometown of los angeles, ca?
CREATE TABLE table_10921 ( "Player" text, "Height" text, "School" text, "Hometown" text, "College" text, "NBA Draft" text )
SELECT "Player" FROM table_10921 WHERE "Hometown" = 'los angeles, ca'
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 has a hometown of los angeles, ca? ### Input: CREATE TABLE table_10921 ( "Player" text, "Height" text, "Scho...
What are the names of customers with credit score less than the average credit score across customers?
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 TABLE bank ( branch_id number, bname text, no_of_customers number, city text, 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: What are the names of customers with credit score less than the average credit score across customers? ### Input: CREATE TAB...
What is the highest points value for 1962, in the 125cc class, and with 0 wins?
CREATE TABLE table_70562 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real )
SELECT MAX("Points") FROM table_70562 WHERE "Year" = '1962' AND "Class" = '125cc' AND "Wins" < '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 highest points value for 1962, in the 125cc class, and with 0 wins? ### Input: CREATE TABLE table_70562 ( "Y...
what are patient 031-1337's gender?
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( med...
SELECT DISTINCT patient.gender FROM patient WHERE patient.uniquepid = '031-1337'
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 031-1337's gender? ### Input: CREATE TABLE allergy ( allergyid number, patientunitstayid number, ...
What are the offered courses this semester ?
CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 ORDER BY course.department
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 offered courses this semester ? ### Input: CREATE TABLE ta ( campus_job_id int, student_id int, loc...
What number episode had a 4.2 rating?
CREATE TABLE table_26310 ( "No." real, "Episode" text, "Rating" text, "Share" real, "Rating/share (18-49)" text, "Viewers (millions)" text, "Rank (timeslot)" real, "Rank (night)" real )
SELECT MIN("No.") FROM table_26310 WHERE "Rating" = '4.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 number episode had a 4.2 rating? ### Input: CREATE TABLE table_26310 ( "No." real, "Episode" text, "Rating"...
what are flights between BOSTON and PITTSBURGH on 8 10
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND date_day.day_number = 10 AND date_day.month_number = 8 AN...
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 flights between BOSTON and PITTSBURGH on 8 10 ### Input: CREATE TABLE aircraft ( aircraft_code varchar, air...
Show me the total number by product category in a histogram, rank x-axis from high to low order please.
CREATE TABLE Customer_Addresses ( customer_id INTEGER, premise_id INTEGER, date_address_from DATETIME, address_type_code VARCHAR(15), date_address_to DATETIME ) CREATE TABLE Mailshot_Customers ( mailshot_id INTEGER, customer_id INTEGER, outcome_code VARCHAR(15), mailshot_customer_da...
SELECT product_category, COUNT(*) FROM Mailshot_Campaigns GROUP BY product_category ORDER BY product_category 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 the total number by product category in a histogram, rank x-axis from high to low order please. ### Input: CREATE TA...
what are the flights from ATLANTA to BALTIMORE which arrive in BALTIMORE at 1900 o'clock pm
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.arrival_time = 1900 AND flight.to_airport = AIRPORT_SERVICE_1.airpo...
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 flights from ATLANTA to BALTIMORE which arrive in BALTIMORE at 1900 o'clock pm ### Input: CREATE TABLE aircraft...
Show the location codes and the number of documents in each location. Visualize by bar chart.
CREATE TABLE Document_Locations ( Document_ID INTEGER, Location_Code CHAR(15), Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME ) CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME, Day_Number INTEGER ) CREATE TABLE All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, ...
SELECT Location_Code, COUNT(*) FROM Document_Locations GROUP BY Location_Code
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 location codes and the number of documents in each location. Visualize by bar chart. ### Input: CREATE TABLE Docume...
Recently closed questions for a single user.
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTaskResults ( Id number, ...
SELECT Id AS "post_link", ClosedDate, Score FROM Posts WHERE OwnerUserId = '##UserId:int##' AND NOT ClosedDate IS NULL ORDER BY ClosedDate 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: Recently closed questions for a single user. ### Input: CREATE TABLE CloseReasonTypes ( Id number, Name text, De...
What is the name of the venue that was used before 1991?
CREATE TABLE table_69626 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
SELECT "Venue" FROM table_69626 WHERE "Year" < '1991'
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 venue that was used before 1991? ### Input: CREATE TABLE table_69626 ( "Year" real, "Tournam...
What is the earliest year of the Honda Engine with a finish of 4?
CREATE TABLE table_name_53 ( year INTEGER, engine VARCHAR, finish VARCHAR )
SELECT MIN(year) FROM table_name_53 WHERE engine = "honda" AND finish = 4
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 earliest year of the Honda Engine with a finish of 4? ### Input: CREATE TABLE table_name_53 ( year INTEGER, ...
what was the name of the laboratory test that patient 025-53538 has received for the last time last month?
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 lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-53538')) AND DATETIME(lab.labresulttime, 'start of month') = 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: what was the name of the laboratory test that patient 025-53538 has received for the last time last month? ### Input: CREATE...
provide the number of patients whose days of hospital stay is greater than 16 and drug name is sw?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "16" AND prescriptions.drug = "SW"
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 days of hospital stay is greater than 16 and drug name is sw? ### Input: CREATE TABLE p...
is the alkaline phosphatase of patient 52342 last measured on the last hospital visit less than the value second to last measured on the last hospital visit?
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id...
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52342 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.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: is the alkaline phosphatase of patient 52342 last measured on the last hospital visit less than the value second to last mea...
Show the name and service for all trains in order by time.
CREATE TABLE train_station ( train_id number, station_id number ) CREATE TABLE train ( train_id number, name text, time text, service text ) CREATE TABLE station ( station_id number, name text, annual_entry_exit number, annual_interchanges number, total_passengers number, ...
SELECT name, service FROM train ORDER BY 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: Show the name and service for all trains in order by time. ### Input: CREATE TABLE train_station ( train_id number, ...
Which Number of electorates (2009) has a Constituency number of 46?
CREATE TABLE table_name_77 ( number_of_electorates__2009_ INTEGER, constituency_number VARCHAR )
SELECT AVG(number_of_electorates__2009_) FROM table_name_77 WHERE constituency_number = "46"
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 Number of electorates (2009) has a Constituency number of 46? ### Input: CREATE TABLE table_name_77 ( number_of_el...
Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.
CREATE TABLE staff ( staff_name VARCHAR, staff_gender VARCHAR, staff_id VARCHAR ) CREATE TABLE Staff_Department_Assignments ( staff_id VARCHAR, job_title_code VARCHAR )
SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Sales Person" EXCEPT SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code ...
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 and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff. ### Input: CRE...
What is the to par of player hunter mahan?
CREATE TABLE table_13595 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "To par" FROM table_13595 WHERE "Player" = 'hunter mahan'
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 to par of player hunter mahan? ### Input: CREATE TABLE table_13595 ( "Place" text, "Player" text, "C...
What are the names of all the Japanese constructors that have earned more than 5 points, and count them by a bar chart, and I want to rank by the y axis in ascending.
CREATE TABLE qualifying ( qualifyId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT ) CREATE TABLE circuits ( circuitId INTEGER, circuitRef TEXT, name TEXT, location TEXT, country TEXT,...
SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY name ORDER BY COUNT(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: What are the names of all the Japanese constructors that have earned more than 5 points, and count them by a bar chart, and ...
how much has been the total amount of promote w/fiber that patient 739 received on this month/19?
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) ...
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 739)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label...
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 been the total amount of promote w/fiber that patient 739 received on this month/19? ### Input: CREATE TABLE pa...
What is the nickname of the team who was in the GFL from 1986-1988?
CREATE TABLE table_name_25 ( nickname VARCHAR, years_in_gfl VARCHAR )
SELECT nickname FROM table_name_25 WHERE years_in_gfl = "1986-1988"
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 nickname of the team who was in the GFL from 1986-1988? ### Input: CREATE TABLE table_name_25 ( nickname VAR...
Which loss was on June 13?
CREATE TABLE table_70635 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
SELECT "Loss" FROM table_70635 WHERE "Date" = 'june 13'
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 loss was on June 13? ### Input: CREATE TABLE table_70635 ( "Date" text, "Opponent" text, "Score" text, ...
how much cost is it to perform quantitative g6pd lab tests?
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 DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'quantitative g6pd'))
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 cost is it to perform quantitative g6pd lab tests? ### Input: CREATE TABLE procedures_icd ( row_id number, ...
give me the number of patients whose age is less than 59 and lab test name is sodium, whole blood?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "59" AND lab.label = "Sodium, Whole 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 age is less than 59 and lab test name is sodium, whole blood? ### Input: CREATE TABLE d...
Give the number of patients under the age of 70 with lab test name calculated bicarbonate, whole 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.age < "70" AND lab.label = "Calculated Bicarbonate, Whole 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 the number of patients under the age of 70 with lab test name calculated bicarbonate, whole blood. ### Input: CREATE TA...
What was the minimum number of episodes in any of the series?
CREATE TABLE table_23043 ( "No." real, "Country" text, "Local title" text, "Format" text, "Start Date" text, "End Date" text, "Episodes" real, "Premiere/Air Dates" text )
SELECT MIN("Episodes") FROM table_23043
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 minimum number of episodes in any of the series? ### Input: CREATE TABLE table_23043 ( "No." real, "Cou...
US 3724 BALTIMORE to PHILADELPHIA what is the round trip fare
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1....
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: US 3724 BALTIMORE to PHILADELPHIA what is the round trip fare ### Input: CREATE TABLE state ( state_code text, state...