instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Find the Char cells, Pixels and Hardware colours for the screen of the phone whose hardware model name is 'LG-P760'. | CREATE TABLE screen_mode (Char_cells VARCHAR,Pixels VARCHAR,Hardware_colours VARCHAR,Graphics_mode VARCHAR)CREATE TABLE phone (screen_mode VARCHAR,Hardware_Model_name VARCHAR) | SELECT T1.Char_cells, T1.Pixels, T1.Hardware_colours FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Hardware_Model_name = "LG-P760" |
Show the average age for all female students and group them by first name in a bar chart, and order by the Fname from low to high. | 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 INTEGER,Allergy VARCHAR(20)) | SELECT Fname, AVG(Age) FROM Student WHERE Sex = 'F' GROUP BY Fname ORDER BY Fname |
What Location has a College or Campus Name of anna university - tharamani campus? | CREATE TABLE table_78826 ("College or Campus Name" text,"Location" text,"District" text,"Affiliation" text,"Weblink" text) | SELECT "Location" FROM table_78826 WHERE "College or Campus Name" = 'anna university - tharamani campus' |
What date was the game against manchester city when they had a league position of 2nd? | CREATE TABLE table_name_22 (date VARCHAR,opponents VARCHAR,h___a VARCHAR,league_position VARCHAR) | SELECT date FROM table_name_22 WHERE h___a = "a" AND league_position = "2nd" AND opponents = "manchester city" |
What was the type of surface played on for the week of March 17? | CREATE TABLE table_name_23 (surface VARCHAR,week VARCHAR) | SELECT surface FROM table_name_23 WHERE week = "march 17" |
Find the number of the names of stadiums that some Australian swimmers have been to, and list in descending by the x axis. | CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text... | SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name ORDER BY T4.Name DESC |
Who is the player from Houston, TX? | CREATE TABLE table_name_49 (player VARCHAR,hometown VARCHAR) | SELECT player FROM table_name_49 WHERE hometown = "houston, tx" |
When did the away team footscray score 11.15 (81)? | CREATE TABLE table_78345 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Date" FROM table_78345 WHERE "Away team score" = '11.15 (81)' AND "Away team" = 'footscray' |
what is average age of patients whose marital status is widowed and admission location is emergency room admit? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id te... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.admission_location = "EMERGENCY ROOM ADMIT" |
since 2102 how many patients were treated with c v v h in the same month after getting sedative agent - dexmedetomidine? | 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 diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'sedative agent - dexmedetomidine' AND STRFTIME('%y', treatment.treatmenttime) >= '2102') AS t1 JOIN (SELECT ... |
Just plot the manager id and the department id in a scatter chart. | 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 job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE regions (REGIO... | SELECT T1.MANAGER_ID, T1.DEPARTMENT_ID FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.EMPLOYEE_ID = T2.MANAGER_ID |
If the losing bonus was 6, what is the tries for? | CREATE TABLE table_74943 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text) | SELECT "Tries for" FROM table_74943 WHERE "Losing bonus" = '6' |
What is the round on 30 June with a.z.k./roc-comp tition a.z.k./roc-comp tition as the winning team? | CREATE TABLE table_name_7 (round VARCHAR,winning_team VARCHAR,date VARCHAR) | SELECT round FROM table_name_7 WHERE winning_team = "a.z.k./roc-compétition a.z.k./roc-compétition" AND date = "30 june" |
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of last_name and manager_id . | 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),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGE... | SELECT LAST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
For each building, show the name of the building and the number of institutions in it Plot them as bar chart, and display X from low to high order. | CREATE TABLE Institution (Institution_id text,Institution text,Location text,Founded real,Type text,Enrollment int,Team text,Primary_Conference text,building_id text)CREATE TABLE protein (common_name text,protein_name text,divergence_from_human_lineage real,accession_number text,sequence_length real,sequence_identity_t... | SELECT Name, COUNT(*) FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id ORDER BY Name |
What was the date of game 4? | CREATE TABLE table_46392 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Date" FROM table_46392 WHERE "Game" = '4' |
give me the flights from MILWAUKEE to PHOENIX on saturday or sunday on AA | CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE ... | 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 AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, flight WHERE (((flight.airline_code = 'AA') AND ((flight.flight_days = DAYS_0.days_code AND DA... |
List players' first name and last name who have weight greater than 220 or height shorter than 75. | CREATE TABLE player (name_first VARCHAR,name_last VARCHAR,weight VARCHAR,height VARCHAR) | SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75 |
What class does the w298ak sign belong to? | CREATE TABLE table_72001 ("Call sign" text,"Frequency MHz" real,"City of license" text,"ERP W" real,"Class" text,"FCC info" text) | SELECT "Class" FROM table_72001 WHERE "Call sign" = 'w298ak' |
give me the number of patients whose death status is 0 and procedure icd9 code is 4513? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.icd9_code = "4513" |
What is the PI GP of Rob Flockhart, who has a pick # less than 122 and a round # less than 3? | CREATE TABLE table_name_44 (pl_gp INTEGER,rd__number VARCHAR,pick__number VARCHAR,player VARCHAR) | SELECT SUM(pl_gp) FROM table_name_44 WHERE pick__number < 122 AND player = "rob flockhart" AND rd__number < 3 |
A bar chart shows the distribution of All_Games and ACC_Percent , could you list from high to low by the names? | 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_Games, ACC_Percent FROM basketball_match ORDER BY All_Games DESC |
What is Team 1 where Team 2 is gombe united f.c.? | CREATE TABLE table_36489 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text) | SELECT "Team 1" FROM table_36489 WHERE "Team 2" = 'gombe united f.c.' |
Which Incumbent has a District of California 5? | CREATE TABLE table_74883 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text) | SELECT "Incumbent" FROM table_74883 WHERE "District" = 'california 5' |
What's the finals qualification during the 2009-10 season? | CREATE TABLE table_name_88 (finals_qualification VARCHAR,season VARCHAR) | SELECT finals_qualification FROM table_name_88 WHERE season = "2009-10" |
what are the genders of patient 009-338? | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,... | SELECT DISTINCT patient.gender FROM patient WHERE patient.uniquepid = '009-338' |
How many male students are there in each city? Show a bar chart, and list y axis from high to low order. | CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTE... | SELECT city_code, COUNT(*) FROM Student WHERE Sex = 'M' GROUP BY city_code ORDER BY COUNT(*) DESC |
Which LEMA/SUBLEMA has a Ch of Senators of 2? | CREATE TABLE table_36817 ("LEMA/SUBLEMA" text,"Candidates" text,"Votes" real,"Ch. of Senators" text,"Ch. of Deputies" text) | SELECT "LEMA/SUBLEMA" FROM table_36817 WHERE "Ch. of Senators" = '2' |
Which stadium is for football with the China League One? | CREATE TABLE table_name_34 (stadium VARCHAR,sport VARCHAR,league VARCHAR) | SELECT stadium FROM table_name_34 WHERE sport = "football" AND league = "china league one" |
Which title did Neil Affleck direct? | CREATE TABLE table_14724369_1 (title VARCHAR,directed_by VARCHAR) | SELECT title FROM table_14724369_1 WHERE directed_by = "Neil Affleck" |
How many rounds had a time of 5:00 at UFC 155? | CREATE TABLE table_45144 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text) | SELECT COUNT("Round") FROM table_45144 WHERE "Time" = '5:00' AND "Event" = 'ufc 155' |
What is 1997, when 1996 is '1R', when 1990 is '2R', and when 1991 is 'F'? | CREATE TABLE table_76316 ("Tournament" text,"1990" text,"1991" text,"1992" text,"1993" text,"1994" text,"1995" text,"1996" text,"1997" text,"Career SR" text,"Career Win-Loss" text) | SELECT "1997" FROM table_76316 WHERE "1996" = '1r' AND "1990" = '2r' AND "1991" = 'f' |
What is the largest total that has a gold less than 0? | CREATE TABLE table_name_57 (total INTEGER,gold INTEGER) | SELECT MAX(total) FROM table_name_57 WHERE gold < 0 |
What school does Dell Curry play for? | CREATE TABLE table_name_48 (school_club_team VARCHAR,player VARCHAR) | SELECT school_club_team FROM table_name_48 WHERE player = "dell curry" |
in a year before, what are the three most common lab tests in patients aged 20s? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid numb... | SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')... |
Which round has the record of 5-0? | CREATE TABLE table_35866 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" text) | SELECT "Round" FROM table_35866 WHERE "Record" = '5-0' |
What is Date To, when Name is 'Lee Cook'? | CREATE TABLE table_49816 ("Date From" text,"Date To" text,"Pos." text,"Name" text,"Moving To" text) | SELECT "Date To" FROM table_49816 WHERE "Name" = 'lee cook' |
How many different high points results are there for the game on May 15? | CREATE TABLE table_74460 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text) | SELECT COUNT("High points") FROM table_74460 WHERE "Date" = 'May 15' |
for 1 fc saabrucken how often did he have less than 20 appearances ? | CREATE TABLE table_203_835 (id number,"season" text,"club" text,"country" text,"competition" text,"apps." number,"goals" number) | SELECT COUNT(*) FROM table_203_835 WHERE "club" = '1. fc saarbrucken' AND "apps." < 20 |
what was the first height of patient 8016 since 09/2105? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id number,subject_id number,... | SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8016)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht' ... |
Show all distinct positions of matches. | CREATE TABLE player (player_id number,player text,years_played text,total_wl text,singles_wl text,doubles_wl text,team number)CREATE TABLE match_season (season number,player text,position text,country number,team number,draft_pick_number number,draft_class text,college text)CREATE TABLE country (country_id number,count... | SELECT DISTINCT position FROM match_season |
how many cl reduct mandible fx procedures have occured? | CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (r... | SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'cl reduct mandible fx') |
What is the record on December 11? | CREATE TABLE table_name_77 (record VARCHAR,date VARCHAR) | SELECT record FROM table_name_77 WHERE date = "december 11" |
Which Show is dated 9 June? | CREATE TABLE table_name_39 (show VARCHAR,date VARCHAR) | SELECT show FROM table_name_39 WHERE date = "9 june" |
What is the lowest Rank, when the Current Seating Capacity is 137,000? | CREATE TABLE table_9857 ("Rank" real,"Venue name" text,"Highest attendance" text,"Location" text,"Current seating capacity" real) | SELECT MIN("Rank") FROM table_9857 WHERE "Current seating capacity" = '137,000' |
what is the top four most frequent diagnoses since 2102? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,ic... | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE STRFTIME('%y', diagnoses_icd.charttime) >= '2102' GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE ... |
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about employee_id over the phone_number by a bar chart, and order total number from high to low order. | CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25)... | SELECT PHONE_NUMBER, 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 DESC |
what number of patients whose ethnicity is hispanic/latino-puerto rican were given the drug d5ns? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug = "D5NS" |
What is the attendance number of the game on April 16? | CREATE TABLE table_name_91 (attendance VARCHAR,date VARCHAR) | SELECT COUNT(attendance) FROM table_name_91 WHERE date = "april 16" |
count the number of times patient 13806 had left arm drainage output since 152 months ago. | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE patients (row_id number,subject_id... | SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13806)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'left arm drainage'... |
Which Case Length has a Base of 14.96 (.589)? | CREATE TABLE table_4838 ("Name" text,"Bullet" text,"Case Length" text,"Base" text,"Neck" text) | SELECT "Case Length" FROM table_4838 WHERE "Base" = '14.96 (.589)' |
What is the Name of the SS5 Stage? | CREATE TABLE table_name_90 (name VARCHAR,stage VARCHAR) | SELECT name FROM table_name_90 WHERE stage = "ss5" |
Return a scatter chart about the correlation between Team_ID and ACC_Percent , and group by attribute All_Home. | 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 Team_ID, ACC_Percent FROM basketball_match GROUP BY All_Home |
Name the total number of production code by david richardson and todd holland | CREATE TABLE table_1876825_2 (production_code VARCHAR,written_by VARCHAR,directed_by VARCHAR) | SELECT COUNT(production_code) FROM table_1876825_2 WHERE written_by = "David Richardson" AND directed_by = "Todd Holland" |
what is the total sack when totaltk is 1 and asst. is more than 0? | CREATE TABLE table_name_86 (sack INTEGER,totaltk VARCHAR,asst VARCHAR) | SELECT SUM(sack) FROM table_name_86 WHERE totaltk = 1 AND asst > 0 |
What driver has more than 39 laps on gird 15? | CREATE TABLE table_11015 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Driver" FROM table_11015 WHERE "Laps" > '39' AND "Grid" = '15' |
What number of 10 -credit upper-level NEAREAST classes are being offered this Spring-Summer ? | CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE course_p... | SELECT COUNT(DISTINCT course.course_id) FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.credits = 10 AND course.department = 'NEAREAST' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = '... |
Stack Overflow Closed, Low-Quality Questions Voted for Deletion (PHP Tag). | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate ti... | SELECT * FROM (SELECT Posts.Id AS "post_link", AVG(Posts.Score) AS "score", COUNT(*) AS "close_votes", MAX(Votes.CreationDate) AS "last_vote", MIN(Votes.CreationDate) AS "first_vote" FROM Posts INNER JOIN Votes ON Posts.Id = Votes.PostId WHERE Votes.VoteTypeId = 10 AND Posts.ClosedDate > 0 AND Posts.Tags LIKE '%<php>%'... |
Give me a stacked bar chart for showing the total number of each ship type and categorize it by ship nationality. | CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text)CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int) | SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type |
Tell me the home of 2-3 | CREATE TABLE table_4411 ("Round" text,"Club" text,"Home" text,"Away" text,"Aggregate" text) | SELECT "Home" FROM table_4411 WHERE "Aggregate" = '2-3' |
What is the Population of the Place with an Area (km 2) larger than 498.77? | CREATE TABLE table_65360 ("Place" text,"Code" real,"Area (km 2)" real,"Population" real,"Most spoken language" text) | SELECT COUNT("Population") FROM table_65360 WHERE "Area (km 2 )" > '498.77' |
Provide the number of patients who had a procedure titled spinal tap that were admitted before the year 2190. | 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 demographic (subject_id text,hadm_id text,name text,marita... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2190" AND procedures.long_title = "Spinal tap" |
Are undergrads able to take 587 ? | CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project varchar,has_final_exam varchar,textbook varchar,class_address varch... | SELECT DISTINCT advisory_requirement, enforced_requirement, name FROM course WHERE department = 'EECS' AND number = 587 |
Show me courses that incorporate Preliminary Exam and Viscous Flow . | CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,... | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id WHERE (area.area LIKE '%Viscous Flow%' OR course.description LIKE '%Viscous Flow%' OR course.name LIKE '%Viscous Flow%') AND (area.area LIKE '%Preliminary Exam%' OR course.description LIKE '%Pr... |
What year has a RAtt of 1 and a comp of 49? | CREATE TABLE table_name_60 (year VARCHAR,ratt VARCHAR,comp VARCHAR) | SELECT year FROM table_name_60 WHERE ratt = "1" AND comp = "49" |
how many patients whose admission type is emergency and diagnoses long title is morbid obesity? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Morbid obesity" |
What is the lowest number of Against that Lake Wendouree had when they had more than 7 Losses? | CREATE TABLE table_40776 ("Ballarat FL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real) | SELECT MIN("Against") FROM table_40776 WHERE "Ballarat FL" = 'lake wendouree' AND "Losses" > '7' |
how many patients whose gender is m and drug code is metr500pm? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.formulary_drug_cd = "METR500PM" |
Which position was morristown minutemen in? | CREATE TABLE table_54367 ("Season" text,"Winner" text,"Team" text,"Position" text,"Win #" real) | SELECT "Position" FROM table_54367 WHERE "Team" = 'morristown minutemen' |
What vfl club(s) for players ranked sergeant, 8th brigade australian field artillery at time of death? | CREATE TABLE table_16527640_2 (vfl_club_s_ VARCHAR,rank_held_at_time_of_death VARCHAR) | SELECT vfl_club_s_ FROM table_16527640_2 WHERE rank_held_at_time_of_death = "Sergeant, 8th Brigade Australian Field Artillery" |
For those records from the products and each product's manufacturer, return a scatter chart about the correlation between manufacturer and code . | CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER) | SELECT T1.Manufacturer, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code |
return me the total citations of all the papers in the VLDB conference . | CREATE TABLE domain (did int,name varchar)CREATE TABLE cite (cited int,citing int)CREATE TABLE keyword (keyword varchar,kid int)CREATE TABLE journal (homepage varchar,jid int,name varchar)CREATE TABLE writes (aid int,pid int)CREATE TABLE domain_publication (did int,pid int)CREATE TABLE conference (cid int,homepage varc... | SELECT SUM(publication.citation_num) FROM conference, publication WHERE conference.name = 'VLDB' AND publication.cid = conference.cid |
What surface was the citt di caltanissetta played on? | CREATE TABLE table_name_22 (surface VARCHAR,tournament VARCHAR) | SELECT surface FROM table_name_22 WHERE tournament = "città di caltanissetta" |
Give me a histogram for how many workshops did each author submit to? Return the author name and the number of workshops, order in descending by the y axis. | CREATE TABLE Acceptance (Submission_ID int,Workshop_ID int,Result text)CREATE TABLE workshop (Workshop_ID int,Date text,Venue text,Name text)CREATE TABLE submission (Submission_ID int,Scores real,Author text,College text) | SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY COUNT(DISTINCT T1.Workshop_ID) DESC |
Give me a bar chart showing the number of products supplied by supplier id 3 for different product type code, display by the y-axis in ascending. | CREATE TABLE Addresses (address_id INTEGER,address_details VARCHAR(255))CREATE TABLE Departments (department_id INTEGER,dept_store_id INTEGER,department_name VARCHAR(80))CREATE TABLE Staff_Department_Assignments (staff_id INTEGER,department_id INTEGER,date_assigned_from DATETIME,job_title_code VARCHAR(10),date_assigned... | SELECT product_type_code, COUNT(product_type_code) FROM Product_Suppliers AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3 GROUP BY product_type_code ORDER BY COUNT(product_type_code) |
how many days have elapsed since the first time patient 035-24054 had a lr intake on the current icu visit? | CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =... |
What is the score of the game with a 3-0 record? | CREATE TABLE table_59584 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Score" FROM table_59584 WHERE "Record" = '3-0' |
since 08/2103, what was the monthly average value of the -monos of patient 012-31116? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname... | SELECT AVG(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-31116')) AND lab.labname = '-monos' AND STRFTIME('%y-%m', lab.labresulttime) >... |
Question Score June 2012, with Vote Creation Date. | CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostN... | SELECT SUM(CASE Votes.VoteTypeId WHEN 2 THEN 1 ELSE 0 END) - SUM(CASE Votes.VoteTypeId WHEN 3 THEN 1 ELSE 0 END) AS score, Users.DisplayName FROM Posts INNER JOIN Users ON Users.Id = Posts.OwnerUserId INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE PostTypeId = 1 AND Posts.CreationDate BETWEEN '2012-06-01' AND '2012-... |
What is the 2010 with a qf in 2011? | CREATE TABLE table_name_9 (Id VARCHAR) | SELECT 2010 FROM table_name_9 WHERE 2011 = "qf" |
List the name and cost of all procedures sorted by the cost from the highest to the lowest. | CREATE TABLE procedures (code number,name text,cost number)CREATE TABLE on_call (nurse number,blockfloor number,blockcode number,oncallstart time,oncallend time)CREATE TABLE block (blockfloor number,blockcode number)CREATE TABLE trained_in (physician number,treatment number,certificationdate time,certificationexpires t... | SELECT name, cost FROM procedures ORDER BY cost DESC |
Find the name and account balance of the customer whose name includes the letter a . | CREATE TABLE bank (branch_id number,bname text,no_of_customers number,city text,state text)CREATE TABLE customer (cust_id text,cust_name text,acc_type text,acc_bal number,no_of_loans number,credit_score number,branch_id number,state text)CREATE TABLE loan (loan_id text,loan_type text,cust_id text,branch_id text,amount ... | SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%' |
Posts with [ibm] that don't have any product-specific tags. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostLinks (Id n... | SELECT p.Id AS "post_link", p.CreationDate AS "creation_date", p.Tags FROM Posts AS p LEFT JOIN PostTags AS pt ON p.Id = pt.PostId LEFT JOIN Tags AS t ON pt.TagId = t.Id WHERE t.TagName = 'ibm' AND NOT EXISTS(SELECT t2.Id FROM PostTags AS pt2 LEFT JOIN Tags AS t2 ON pt2.TagId = t2.Id WHERE p.Id = pt2.PostId AND t2.TagN... |
how many dead patients had diagnoses of methicillin susceptible pneumonia due to staphylococcus aureus? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (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 WHERE demographic.expire_flag = "1" AND diagnoses.short_title = "Meth sus pneum d/t Staph" |
In what municipality were there 757.5 people per km2? | CREATE TABLE table_216776_2 (municipality VARCHAR,pop_density__per_km²_ VARCHAR) | SELECT municipality FROM table_216776_2 WHERE pop_density__per_km²_ = "757.5" |
What is the average 2001 value with a 2010 value greater than 414, a 2011 value of 7192, and a 2005 value larger than 7340? | CREATE TABLE table_70545 ("Production year" text,"2001" real,"2002" real,"2003" real,"2004" real,"2005" real,"2006" real,"2007" real,"2008" real,"2009" real,"2010" real,"2011" real) | SELECT AVG("2001") FROM table_70545 WHERE "2010" > '414' AND "2011" = '7192' AND "2005" > '7340' |
What is the vessel type for vessel operator Jumbo shipping? | CREATE TABLE table_28363 ("No. in series" real,"No. in season" real,"Title" text,"Vessel Type" text,"Vessel Operator" text,"Narrated by" text,"Original air date" real) | SELECT "Vessel Type" FROM table_28363 WHERE "Vessel Operator" = 'Jumbo Shipping' |
give me the number of patients whose admission year is less than 2180 and item id is 50927? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2180" AND lab.itemid = "50927" |
What is the total launch failures when there are 4 launches, and the not usable is greater than 0? | CREATE TABLE table_40905 ("Block" text,"Launched" real,"Operational" real,"Not usable" real,"Retired" real,"Launch Failures" real) | SELECT SUM("Launch Failures") FROM table_40905 WHERE "Launched" = '4' AND "Not usable" > '0' |
Who was the opponent in week 3? | CREATE TABLE table_name_34 (opponent VARCHAR,week VARCHAR) | SELECT opponent FROM table_name_34 WHERE week = 3 |
did any microbiology tests have been done for patient 10765 in 03/last year? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)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 tex... | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10765) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', microbiologyevents.chartti... |
Next Spring-Summer which upper level electives will be up for taking any time after 18:45 A.M. ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE program (program_id int,name varchar,college varc... | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.start_time > '18:45' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester... |
When Yaroslav Popovych won most corageous, who won the mountains classification? | CREATE TABLE table_73726 ("Stage" real,"Winner" text,"General Classification" text,"Youth Classification" text,"Mountains Classification" text,"Sprint Classification" text,"Most Courageous" text,"Team Classification" text) | SELECT "Mountains Classification" FROM table_73726 WHERE "Most Courageous" = 'Yaroslav Popovych' |
what is the average value of ptt in patient 55503's body in 11/last year? | CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount... | SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55503) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ptt') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT... |
For those employees who did not have any job in the past, give me the comparison about the amount of job_id over the job_id , and group by attribute job_id by a bar chart, and could you rank X-axis in desc order? | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPART... | SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID DESC |
What is the sum of Round(s), when Method is 'Submission (Banana Split)'? | CREATE TABLE table_50787 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text) | SELECT SUM("Round") FROM table_50787 WHERE "Method" = 'submission (banana split)' |
How many characteristics are there? | CREATE TABLE products (product_id number,color_code text,product_category_code text,product_name text,typical_buying_price text,typical_selling_price text,product_description text,other_product_details text)CREATE TABLE characteristics (characteristic_id number,characteristic_type_code text,characteristic_data_type tex... | SELECT COUNT(*) FROM characteristics |
How many courses have more than one prerequisite for each department? Visualize with a bar chart, and order x-axis in desc order. | CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE section (course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),building varchar(15),room_number varchar(7),time_slot_id varchar(4))CREATE TABLE instructor (ID varchar(5),name varchar(20),dept_name varchar(20),salary numer... | SELECT dept_name, COUNT(dept_name) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY dept_name ORDER BY dept_name DESC |
i would like a flight that leaves on sunday from MONTREAL QUEBEC to SAN DIEGO CALIFORNIA | CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE airport (airport_code varchar,a... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight, state AS STATE_0, state AS STATE_1 WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DIEGO' AND date_day.day_number = ... |
What is the D42 associated with a D47 of d 27? | CREATE TABLE table_name_31 (d_42 VARCHAR,d_47 VARCHAR) | SELECT d_42 FROM table_name_31 WHERE d_47 = "d 27" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.