instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the name of the customer who has the most policies listed? | CREATE TABLE services (service_id number,service_name text)CREATE TABLE claims (claim_id number,fnol_id number,effective_date time)CREATE TABLE available_policies (policy_id number,policy_type_code text,customer_phone text)CREATE TABLE customers (customer_id number,customer_name text)CREATE TABLE customers_policies (cu... | SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1 |
at most what number in the series was the episode 'chet episode'? | CREATE TABLE table_74227 ("Series no." real,"Season no." real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real,"U.S. viewers (millions)" text) | SELECT MAX("Series no.") FROM table_74227 WHERE "Title" = 'Chet Episode' |
What was the largest crowd to view a game where the away team scored 17.8 (110)? | CREATE TABLE table_74684 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT MAX("Crowd") FROM table_74684 WHERE "Away team score" = '17.8 (110)' |
give me the number of patients whose age is less than 67 and drug name is theophylline sr? | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "67" AND prescriptions.drug = "Theophylline SR" |
Give me the comparison about the average of School_ID over the ACC_Road , and group by attribute ACC_Road by a bar chart, I want to sort in desc by the y axis. | 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_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT ACC_Road, AVG(School_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(School_ID) DESC |
What`s the score in October 7. | CREATE TABLE table_27734286_1 (score VARCHAR,date VARCHAR) | SELECT score FROM table_27734286_1 WHERE date = "October 7" |
flights on sunday from TAMPA to CHARLOTTE | CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_miles int,pressurized varchar)CREATE TABLE airport_service (city_code ... | 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 = 'CHARLOTTE' AND date_day.day_number = 27 AND date_day.month_number = 8 AND... |
How many laps were in 1955? | CREATE TABLE table_name_89 (laps VARCHAR,year VARCHAR) | SELECT COUNT(laps) FROM table_name_89 WHERE year = "1955" |
What years did Orlando have stanley roberts on the team? | CREATE TABLE table_7467 ("Player" text,"Nationality" text,"Position" text,"Years in Orlando" text,"School/Club Team" text) | SELECT "Years in Orlando" FROM table_7467 WHERE "Player" = 'stanley roberts' |
Which average draw has points greater than 12? | CREATE TABLE table_name_52 (draw INTEGER,points INTEGER) | SELECT AVG(draw) FROM table_name_52 WHERE points > 12 |
Find the number of students whose age is younger than the average age and group by students' last name in a bar chart, and I want to rank by the total number in ascending. | CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Dorm (dormid INTEGER,dorm_name VARCHAR(20),student_capacity INTEGER,gender VARCHAR(1))CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Student (StuI... | SELECT LName, COUNT(LName) FROM Student WHERE Age < (SELECT AVG(Age) FROM Student) GROUP BY LName ORDER BY COUNT(LName) |
How many points did the away team of st kilda score? | CREATE TABLE table_name_84 (away_team VARCHAR) | SELECT away_team AS score FROM table_name_84 WHERE away_team = "st kilda" |
Return a bar chart about the distribution of All_Home and the sum of School_ID , and group by attribute All_Home, sort by the y-axis in asc 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_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT All_Home, SUM(School_ID) FROM basketball_match GROUP BY All_Home ORDER BY SUM(School_ID) |
Name the result for first elected of 1920 | CREATE TABLE table_1342149_24 (result VARCHAR,first_elected VARCHAR) | SELECT result FROM table_1342149_24 WHERE first_elected = 1920 |
what is drug type and drug route of drug name tuberculin protein? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT prescriptions.drug_type, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Tuberculin Protein" |
What is the sum of the points when Carlos drove for repsol honda in 8th place? | CREATE TABLE table_35189 ("Year" real,"Class" text,"Team" text,"Points" real,"Rank" text,"Wins" real) | SELECT SUM("Points") FROM table_35189 WHERE "Team" = 'repsol honda' AND "Rank" = '8th' |
What is the Year(s) won of the Player with a To par of 5? | CREATE TABLE table_12392 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" real) | SELECT "Year(s) won" FROM table_12392 WHERE "To par" = '5' |
How many Laps does Eddie Cheever have? | CREATE TABLE table_name_39 (laps VARCHAR,driver VARCHAR) | SELECT laps FROM table_name_39 WHERE driver = "eddie cheever" |
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of first_name and employee_id , could you sort total number from low to high order? | CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE 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 jobs (JOB_ID var... | SELECT FIRST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID |
When Rose Wheeler was taking the HISTORY 473 class , who was teaching it ? | CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree... | SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN student_record ON student_record.offering_id = offering_instructor.offering_id INNER JOIN student ON student.student_id = student_record.student_id INNER JOIN course_... |
Which driver had less than 65 laps for Sigma Autosport? | CREATE TABLE table_name_64 (driver VARCHAR,laps VARCHAR,team VARCHAR) | SELECT driver FROM table_name_64 WHERE laps < 65 AND team = "sigma autosport" |
Top 600 SO Users from India. | CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%belgaum' ORDER BY Reputation DESC LIMIT 600 |
How many positions have Points of 30-8 and more than 25 goals? | CREATE TABLE table_name_73 (position VARCHAR,points VARCHAR,goals_for VARCHAR) | SELECT COUNT(position) FROM table_name_73 WHERE points = "30-8" AND goals_for > 25 |
What is the address of the restaurant Subway? | CREATE TABLE Restaurant (Address VARCHAR,ResName VARCHAR) | SELECT Address FROM Restaurant WHERE ResName = "Subway" |
What is the latest year they were nominated? | CREATE TABLE table_name_44 (year INTEGER,result VARCHAR) | SELECT MAX(year) FROM table_name_44 WHERE result = "nominated" |
Which Date has a Record of 11 10 2? | CREATE TABLE table_49319 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Attendance" real,"Record" text,"Points" real) | SELECT "Date" FROM table_49319 WHERE "Record" = '11–10–2' |
When 17,874 (33.2) is the percentage against what is the percentage for? | CREATE TABLE table_20683381_3 (for___percentage_ VARCHAR,against___percentage_ VARCHAR) | SELECT for___percentage_ FROM table_20683381_3 WHERE against___percentage_ = "17,874 (33.2)" |
List all opponents in the September 23, 1984 game? | CREATE TABLE table_19625 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Game Site" text,"Attendance" real) | SELECT "Opponent" FROM table_19625 WHERE "Date" = 'September 23, 1984' |
Can you tell me the Chassis that has the Points of 13, and the Year of 1975, and the Entrant of scuderia citta del mille? | CREATE TABLE table_name_5 (chassis VARCHAR,entrant VARCHAR,points VARCHAR,year VARCHAR) | SELECT chassis FROM table_name_5 WHERE points = 13 AND year = 1975 AND entrant = "scuderia citta del mille" |
provide the number of patients whose diagnoses short title is human immuno virus dis and lab test abnormal status is abnormal? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Human immuno virus dis" AND lab.flag = "abnormal" |
how many players are qbs ? | CREATE TABLE table_204_389 (id number,"rnd." number,"pick #" number,"nfl team" text,"player" text,"pos." text,"college" text,"conf." text,"notes" text) | SELECT COUNT("player") FROM table_204_389 WHERE "pos." = 'qb' |
Which 1st Party has a 1st Member of sir john tyssen tyrell, bt, and a 2nd Party of conservative, and a 2nd Member of john payne elwes? | CREATE TABLE table_12984 ("Election" text,"1st Member" text,"1st Party" text,"2nd Member" text,"2nd Party" text) | SELECT "1st Party" FROM table_12984 WHERE "1st Member" = 'sir john tyssen tyrell, bt' AND "2nd Party" = 'conservative' AND "2nd Member" = 'john payne elwes' |
Tell me the rank for bronze less than 17 and gold less than 1 | CREATE TABLE table_74487 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT "Rank" FROM table_74487 WHERE "Bronze" < '17' AND "Silver" > '1' AND "Gold" < '1' |
what is the number of patients whose admission year is less than 2127 and item id is 50998? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2127" AND lab.itemid = "50998" |
What is the lowest of the Highest score for the Quickstep Dance and the Lowest score under 16? | CREATE TABLE table_name_72 (highest_score INTEGER,dance VARCHAR,lowest_score VARCHAR) | SELECT MIN(highest_score) FROM table_name_72 WHERE dance = "quickstep" AND lowest_score < 16 |
What was the amount won with tries against at 54? | CREATE TABLE table_12828723_5 (won VARCHAR,tries_against VARCHAR) | SELECT won FROM table_12828723_5 WHERE tries_against = "54" |
indicate the daily maximum sao2 of patient 12454 on the last icu visit. | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,a... | SELECT MAX(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12454) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents.it... |
What is the Set 3 with a Score of 3 1, and has a Set 2 of 13 15? | CREATE TABLE table_name_7 (set_3 VARCHAR,score VARCHAR,set_2 VARCHAR) | SELECT set_3 FROM table_name_7 WHERE score = "3–1" AND set_2 = "13–15" |
what team came in last , not counting teams disqualified or teams that did not finish ? | CREATE TABLE table_203_160 (id number,"rank" number,"heat" number,"nation" text,"competitors" text,"time" text,"notes" text) | SELECT "nation" FROM table_203_160 ORDER BY "rank" DESC LIMIT 1 |
what was the last drug prescribed in 12/2103 to patient 31880? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE microbiologyevents (row_id number,su... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31880) AND STRFTIME('%y-%m', prescriptions.startdate) = '2103-12' ORDER BY prescriptions.startdate DESC LIMIT 1 |
What is the total number of years wehre anna thompson had a 3rd place result at edinburgh, scotland? | CREATE TABLE table_46159 ("Year" real,"Tournament" text,"Venue" text,"Result" text,"Extra" text) | SELECT COUNT("Year") FROM table_46159 WHERE "Result" = '3rd' AND "Venue" = 'edinburgh, scotland' |
what are connecting flights from CHICAGO into SEATTLE on 6 5 | CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,depa... | 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 = 'SEATTLE' AND date_day.day_number = 5 AND date_day.month_number = 6 AND d... |
What is the average Year with a Veritas rs chassis and more than 0 points? | CREATE TABLE table_name_73 (year INTEGER,chassis VARCHAR,points VARCHAR) | SELECT AVG(year) FROM table_name_73 WHERE chassis = "veritas rs" AND points > 0 |
What is the Club of the Player with a Date of Birth of 1977-02-03? | CREATE TABLE table_name_61 (club VARCHAR,date_of_birth VARCHAR) | SELECT club FROM table_name_61 WHERE date_of_birth = "1977-02-03" |
Which country has the city of London, England with more than 150,000 specimens? | CREATE TABLE table_60331 ("Name" text,"No. Specimens" real,"Abbr." text,"Country" text,"City" text) | SELECT "Country" FROM table_60331 WHERE "No. Specimens" > '150,000' AND "City" = 'london, england' |
what is the average wins when percent is more than 0.4 and teams is chargers~? | CREATE TABLE table_name_53 (wins INTEGER,percent VARCHAR,teams VARCHAR) | SELECT AVG(wins) FROM table_name_53 WHERE percent > 0.4 AND teams = "chargers~" |
count the number of patients who had arteriography of cerebral arteries and died on or before 2148. | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2148.0" AND procedures.long_title = "Arteriography of cerebral arteries" |
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, visualize a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by weekday. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),E... | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
What is the highest draws when more than 6 are played and the points against are 54? | CREATE TABLE table_32865 ("Club" text,"Played" real,"Lost" real,"Drawn" real,"Against" real,"Diff." real,"Points" real) | SELECT MAX("Drawn") FROM table_32865 WHERE "Against" = '54' AND "Played" > '6' |
What was the Nominated Work earlier than 2003? | CREATE TABLE table_name_95 (nominated_work VARCHAR,year INTEGER) | SELECT nominated_work FROM table_name_95 WHERE year < 2003 |
What is the lowest rank for an album after 1999 and an Accolade of the 100 greatest indie rock albums of all time? | CREATE TABLE table_35414 ("Publication" text,"Country" text,"Accolade" text,"Year" real,"Rank" real) | SELECT MIN("Rank") FROM table_35414 WHERE "Year" > '1999' AND "Accolade" = 'the 100 greatest indie rock albums of all time' |
What was the game's points against Team 2 Deportivo Anzo tegui? | CREATE TABLE table_17282875_2 (points VARCHAR,team__number2 VARCHAR) | SELECT points FROM table_17282875_2 WHERE team__number2 = "Deportivo Anzoátegui" |
Who was the player in Position G on the Petron Blaze Boosters and retired in 2000? | CREATE TABLE table_name_61 (name VARCHAR,year_retired VARCHAR,position VARCHAR,team VARCHAR) | SELECT name FROM table_name_61 WHERE position = "g" AND team = "petron blaze boosters" AND year_retired = "2000" |
For each branch id, what are the names of the branches that were registered after 2015 Visualize by bar chart, could you order the total number in asc order? | CREATE TABLE branch (Branch_ID int,Name text,Open_year text,Address_road text,City text,membership_amount text)CREATE TABLE purchase (Member_ID int,Branch_ID text,Year text,Total_pounds real)CREATE TABLE membership_register_branch (Member_ID int,Branch_ID text,Register_Year text)CREATE TABLE member (Member_ID int,Card_... | SELECT Name, COUNT(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID WHERE T1.Register_Year > 2015 GROUP BY T2.Branch_ID ORDER BY COUNT(*) |
has the heartrate of patient 030-31704 until 303 days ago ever been less than 61.0? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosa... | 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 = '030-31704')) AND vitalperiodic.heartrate < 61.0 AND NOT vitalperiodi... |
What is the total number of top-25 with a top-10 bigger than 2 and less than 29 cuts? | CREATE TABLE table_name_92 (top_25 VARCHAR,top_10 VARCHAR,cuts_made VARCHAR) | SELECT COUNT(top_25) FROM table_name_92 WHERE top_10 > 2 AND cuts_made < 29 |
Find the capacity and gender type of the dorm whose name has substring Donor . | CREATE TABLE has_amenity (dormid number,amenid number)CREATE TABLE lives_in (stuid number,dormid number,room_number number)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE dorm_amenity (amenid number,amenity_name text)CREATE TABLE dorm ... | SELECT student_capacity, gender FROM dorm WHERE dorm_name LIKE '%Donor%' |
what is the average days of hospital stay of patients whose primary disease is aortic insufficiency\re-do sternotomy; aortic valve replacement? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ... | SELECT AVG(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " |
provide the number of patients whose ethnicity is black/african american and year of death is less than or equal to 2126? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dod_year <= "2126.0" |
on 9 4 i'll be traveling from PITTSBURGH to ATLANTA can you tell me what flight would be the cheapest | CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time_elapsed int,to_airport varchar)CREATE TABLE equipment_sequen... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, da... |
what was the last year that the regent house grammar school won a title ? | CREATE TABLE table_203_362 (id number,"school" text,"location" text,"outright titles" number,"shared titles" number,"runners-up" number,"total finals" number,"last title" number,"last final" number) | SELECT "last title" FROM table_203_362 WHERE "school" = 'regent house grammar school' |
provide the number of patients with personal history of tobacco use diagnoses who were admitted before 2156. | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2156" AND diagnoses.long_title = "Personal history of tobacco use" |
what number of patients who stayed in the hospital for more than 4 days were given the drug labetol hcl? | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "4" AND prescriptions.drug = "Labetalol HCl" |
calculate the maximum age of patients with primary disease st-segment elevation myocardial infarction/cardiac catheterization who were discharged to home health care. | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "ST-SEGMENT ELEVATION MYOCARDIAL INFARCTION\CARDIAC CATH" |
what is the number of patients whose lab test abnormal status is abnormal and lab test name is phenytoin? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "Phenytoin" |
What surface was played on when Piet Norval was a partner? | CREATE TABLE table_45860 ("Outcome" text,"Year" real,"Championship" text,"Surface" text,"Partner" text,"Opponents in the final" text,"Score in the final" text) | SELECT "Surface" FROM table_45860 WHERE "Partner" = 'piet norval' |
Name the least pick # for doug gibson | CREATE TABLE table_23125 ("Pick #" real,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text) | SELECT MIN("Pick #") FROM table_23125 WHERE "Player" = 'Doug Gibson' |
Which S.R. has a Average smaller than 23.63 Runs Scored of 49? | CREATE TABLE table_name_46 (sr VARCHAR,average VARCHAR,runs_scored VARCHAR) | SELECT sr FROM table_name_46 WHERE average < 23.63 AND runs_scored = 49 |
What is the rate limit when the desired rate (p) is 162? | CREATE TABLE table_25316812_1 (rate_limit__p_ VARCHAR,desired_rate__p_ VARCHAR) | SELECT rate_limit__p_ FROM table_25316812_1 WHERE desired_rate__p_ = "162" |
What is the location and attendance after game 2, and the team New Orleans? | CREATE TABLE table_48774 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Location Attendance" FROM table_48774 WHERE "Game" > '2' AND "Team" = 'new orleans' |
What position(s) do players from bowling green play? | CREATE TABLE table_20872 ("Player" text,"No." real,"Nationality" text,"Position" text,"Years for Grizzlies" text,"School/Club Team" text) | SELECT "Position" FROM table_20872 WHERE "School/Club Team" = 'Bowling Green' |
how many dbeingtrict with candidates being william b. bankhead (d) 71.3% e. m. reed (r) 28.7% | CREATE TABLE table_1342292_2 (district VARCHAR,candidates VARCHAR) | SELECT COUNT(district) FROM table_1342292_2 WHERE candidates = "William B. Bankhead (D) 71.3% E. M. Reed (R) 28.7%" |
among patients that were prescribed with 1000 ml flex cont: dextrose-nacl 5-0.45 % iv soln, what were the three most frequently prescribed drugs at the same time, since 2103. | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,... | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = '1000 ml flex cont: dextrose-nacl 5-0.45 % iv soln' ... |
What team is based at junction oval? | CREATE TABLE table_52085 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team" FROM table_52085 WHERE "Venue" = 'junction oval' |
Name the number of won for goals for being 274 | CREATE TABLE table_27399 ("Season" text,"Games" real,"Won" real,"Lost" real,"Tied" real,"Points" real,"Goals for" real,"Goals against" real,"Standing" text) | SELECT COUNT("Won") FROM table_27399 WHERE "Goals for" = '274' |
What was the attendance on March 17? | CREATE TABLE table_17328 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Location Attendance" FROM table_17328 WHERE "Date" = 'March 17' |
What's the HC for the Euro I standard? | CREATE TABLE table_3902 ("Standard" text,"Date" text,"CO (g/kWh)" text,"NO x (g/kWh)" text,"HC (g/kWh)" text,"PM (g/kWh)" text) | SELECT "HC (g/kWh)" FROM table_3902 WHERE "Standard" = 'Euro I' |
what is the unabbreviated version of the tb esophagus-histo dx? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE diagnoses_icd (row_id number... | SELECT d_icd_diagnoses.long_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'tb esophagus-histo dx' UNION SELECT d_icd_procedures.long_title FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'tb esophagus-histo dx' |
PHOENIX to MILWAUKEE on wednesday | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,gro... | 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 = 'MILWAUKEE' AND date_day.day_number = 23 AND date_day.month_number = 4 AND... |
What episode number of the season was written by Tom Garrigus and had 2.31 million u.s. viewers? | CREATE TABLE table_3959 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text) | SELECT MAX("Season #") FROM table_3959 WHERE "U.S. viewers (million)" = '2.31' AND "Written by" = 'Tom Garrigus' |
What was the platform of Red Dead Redemption? | CREATE TABLE table_65634 ("Year" real,"Game" text,"Genre" text,"Platform(s)" text,"Developer(s)" text) | SELECT "Platform(s)" FROM table_65634 WHERE "Game" = 'red dead redemption' |
What is the young rider classification for jesper worre and stage 3 | CREATE TABLE table_name_66 (young_rider_classification VARCHAR,mountains_classification VARCHAR,stage VARCHAR) | SELECT young_rider_classification FROM table_name_66 WHERE mountains_classification = "jesper worre" AND stage = "3" |
Which call sign has ERP Wlarger than 250, and Frequency MHZ smaller than 99.3? | CREATE TABLE table_name_3 (call_sign VARCHAR,erp_w VARCHAR,frequency_mhz VARCHAR) | SELECT call_sign FROM table_name_3 WHERE erp_w > 250 AND frequency_mhz < 99.3 |
when was the first time that during this year patient 005-77687 was diagnosed with acute copd exacerbation. | 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 cost (costid number,uniquepid text,patienthealthsystemstayid number,eventt... | SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-77687')) AND diagnosis.diagnosisname = 'acute copd exacerbati... |
For those employees who was hired before 2002-06-21, visualize a scatter chart about the correlation between salary and manager_id . | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decima... | SELECT SALARY, MANAGER_ID FROM employees WHERE HIRE_DATE < '2002-06-21' |
Show all the planned delivery dates and bin by year in a line chart, could you rank by the x-axis in ascending please? | CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID INTEGER,Address_ID INTEGER,Currency_Code CHAR(15),Marketing_Region_Code CHAR(15),Store_Name VARCHAR(255),Store_Phone VARCHAR(255),Store_Email_Address VARCHAR(255),Other_Details VARCHAR(255))CREATE TABLE Customers (Customer_ID VARCHAR(100),Address_ID INTEGER,Customer... | SELECT Planned_Delivery_Date, COUNT(Planned_Delivery_Date) FROM Bookings ORDER BY Planned_Delivery_Date |
What is the average medal total of the country who had 0 silver medals and participated in less than 15 games? | CREATE TABLE table_name_41 (total INTEGER,games VARCHAR,silver VARCHAR) | SELECT AVG(total) FROM table_name_41 WHERE games < 15 AND silver < 0 |
The years produced for the cylinder layout v8 are what? | CREATE TABLE table_28590 ("Engine Family" text,"Cylinder Layout" text,"Displacement(s)" text,"Injection type" text,"Years produced" text) | SELECT "Years produced" FROM table_28590 WHERE "Cylinder Layout" = 'V8' |
What is the oder part number for the model with 10x mult. 1? | CREATE TABLE table_29394 ("Model Number" text,"Frequency" text,"L2 Cache" text,"HT" text,"Mult. 1" text,"Voltage" text,"TDP" text,"Socket" text,"Release date" text,"Order Part Number" text) | SELECT "Order Part Number" FROM table_29394 WHERE "Mult. 1" = '10x' |
what are the four most frequent diagnoses that patients received in the same hospital encounter after receiving a anticonvulsants - midazolam since 2103? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmen... | SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antic... |
Who plays halfback? | CREATE TABLE table_name_54 (player VARCHAR,position VARCHAR) | SELECT player FROM table_name_54 WHERE position = "halfback" |
get the short title as well as the icd9 code of diagnoses for patient with patient id 55094. | 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 (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT diagnoses.icd9_code, diagnoses.short_title FROM diagnoses WHERE diagnoses.subject_id = "55094" |
how much did the british formula three called 'fortec motorsport' score? | CREATE TABLE table_16295 ("Season" text,"Series" text,"Team Name" text,"Races" real,"Wins" real,"Poles" real,"F/Laps" real,"Podiums" real,"Points" text,"Position" text) | SELECT "Points" FROM table_16295 WHERE "Series" = 'British Formula Three' AND "Team Name" = 'Fortec Motorsport' |
if the 2.09 million US viewers watched this episode, who was it written by | CREATE TABLE table_27343 ("No." real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. Viewers (in millions)" text) | SELECT "Written by" FROM table_27343 WHERE "U.S. Viewers (in millions)" = '2.09' |
How many were won when the points were 12? | CREATE TABLE table_17369472_2 (won VARCHAR,points VARCHAR) | SELECT COUNT(won) FROM table_17369472_2 WHERE points = "12" |
what was the daily maximum value of weight for patient 017-88691 on their current hospital encounter? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid ... | SELECT MAX(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-88691' AND patient.hospitaldischargetime IS NULL) AND NOT patient.admissionweight IS NULL GROUP BY STRFTIME('%y-%m-%d', patient.unitadmittime) |
What team had a Ravg of 3.4? | CREATE TABLE table_7017 ("Year" text,"Team" text,"SckY" text,"Int%" text,"Rate" text,"RAtt" text,"RYds" text,"RAvg" text,"RLng" text,"R1st" text) | SELECT "Team" FROM table_7017 WHERE "RAvg" = '3.4' |
What is the total for Chen Yibing ( chn ), when his B Score was smaller than 9.225? | CREATE TABLE table_64178 ("Position" real,"Gymnast" text,"A Score" real,"B Score" real,"Total" real) | SELECT COUNT("Total") FROM table_64178 WHERE "Gymnast" = 'chen yibing ( chn )' AND "B Score" < '9.225' |
Which airport has an IATA Code of ORD? | CREATE TABLE table_22104 ("Rank" real,"Airport Name" text,"Location" text,"IATA Code" text,"Tonnes" text,"% Chg. 2010/11" text) | SELECT "Airport Name" FROM table_22104 WHERE "IATA Code" = 'ORD' |
What are the stations in Tarzana? | CREATE TABLE table_24012 ("Stations" text,"Connections" text,"City/ Neighborhood" text,"Parking" text,"Date Opened" text) | SELECT "Stations" FROM table_24012 WHERE "City/ Neighborhood" = 'Tarzana' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.