instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Questions with more than n answers. | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE ... | SELECT q.Id, q.Title, q.Body, q.AnswerCount, a.Id, a.Body, q.CreationDate, a.CreationDate, q.ClosedDate, a.ClosedDate, q.ViewCount, q.OwnerUserId, a.OwnerUserId, q.FavoriteCount FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND a.PostTypeId = 2 AND q.AnswerCount >= 10 |
How many patients whose marital status is divorced had a lab test named lactate dehydrogenase, csf? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "Lactate Dehydrogenase, CSF" |
give me the number of patients whose gender is m and admission location is transfer from hosp/extram? | 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 WHERE demographic.gender = "M" AND demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" |
Who is the author for the malasaurus? | CREATE TABLE table_name_65 (authors VARCHAR,name VARCHAR) | SELECT authors FROM table_name_65 WHERE name = "malasaurus" |
what was the name of the drug that was prescribed last to patient 021-111547 since 20 months ago via deepsubcut route? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname... | SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-111547')) AND medication.routeadmin = 'deepsubcut' AND DATETIME... |
how many patients whose year of birth is less than 1846 and drug type is main? | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "1846" AND prescriptions.drug_type = "MAIN" |
when was patient 88659 first tested for microbiology in 09/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 d_labitems (row_id number,itemid number,label text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_i... | SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 88659) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', microbiolo... |
which institutes gave the democratic renewal 18.0% 22.0% on a poll from October 6, 1985? | CREATE TABLE table_73092 ("Date Released" text,"Institute" text,"Socialist" text,"Social Democratic" text,"United People Alliance" text,"Democratic and Social Centre" text,"Democratic Renewal" text,"Lead" text) | SELECT "Institute" FROM table_73092 WHERE "Democratic Renewal" = '18.0% – 22.0%' |
For all employees who have the letters D or S in their first name, find job_id and the sum of salary , and group by attribute job_id, and visualize them by a bar chart, and display by the JOB_ID in desc. | CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DA... | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID DESC |
how many patients have been discharged since 1 year ago? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid num... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND DATETIME(patient.hospitaldischargetime) >= DATETIME(CURRENT_TIME(), '-1 year') |
Find All_Games and School_ID , and visualize them by a bar chart, and show in ascending by the bar. | 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, School_ID FROM basketball_match ORDER BY All_Games |
What was the decision when Chicago was the visiting team? | CREATE TABLE table_71468 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text) | SELECT "Decision" FROM table_71468 WHERE "Visitor" = 'chicago' |
has patient 028-42654 been given a laboratory test until 54 months ago? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text... | SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-42654')) AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-54 month') |
Name the average fall 07 for fall 07 more than 219 | CREATE TABLE table_36375 ("Maryland Counties" text,"Fall 05" real,"Fall 06" real,"Fall 07" real,"Fall 08" real,"Fall 09" real) | SELECT AVG("Fall 07") FROM table_36375 WHERE "Fall 06" > '219' |
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of first_name and department_id . | 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 jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY ... | SELECT FIRST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
has cordarone, lactated ringers, or lantus been prescribed last year for patient 035-19333? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism tex... | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-19333')) AND medication.drugname IN ('cordarone', 'lactated ringers', ... |
how many patients are divorced and followed the procedure small-to-small intestinal anastomosis? | 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.marital_status = "DIVORCED" AND procedures.long_title = "Small-to-small intestinal anastomosis" |
How many college teams have a player with a nationality of Russia? | CREATE TABLE table_2840500_6 (college_junior_club_team VARCHAR,nationality VARCHAR) | SELECT COUNT(college_junior_club_team) FROM table_2840500_6 WHERE nationality = "Russia" |
Which country had a cad 4011 catalogue #? | CREATE TABLE table_51561 ("Country" text,"Date" text,"Label" text,"Format" text,"Catalogue #" text) | SELECT "Country" FROM table_51561 WHERE "Catalogue #" = 'cad 4011' |
Who was the partner on the game which took place on a clay surface with opponents of marco chiudinelli michael lammer and a runner-up result? | CREATE TABLE table_44450 ("Outcome" text,"Date" text,"Surface" text,"Partner" text,"Opponents" text,"Score" text) | SELECT "Partner" FROM table_44450 WHERE "Outcome" = 'runner-up' AND "Surface" = 'clay' AND "Opponents" = 'marco chiudinelli michael lammer' |
Bar chart x axis first name y axis salary, I want to rank names in descending 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 departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN... | SELECT FIRST_NAME, SALARY FROM employees ORDER BY FIRST_NAME DESC |
count the number of drugs that patient 022-158213 was prescribed during their first hospital visit. | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,... | 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 = '022-158213' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hos... |
Of the courses I have to choose from , which ones are worth 15 credits ? | 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 name, number FROM course WHERE credits = 15 AND department = 'EECS' |
What are the points 1 for the team with position less than 13 and goal difference of +16? | CREATE TABLE table_name_93 (points_1 VARCHAR,position VARCHAR,goal_difference VARCHAR) | SELECT points_1 FROM table_name_93 WHERE position < 13 AND goal_difference = "+16" |
Datasets with semantic parsing information | CREATE TABLE writes (paperid int,authorid int)CREATE TABLE dataset (datasetid int,datasetname varchar)CREATE TABLE journal (journalid int,journalname varchar)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE field (fieldid int)CREATE TABLE author ... | SELECT DISTINCT dataset.datasetid FROM dataset, keyphrase, paperdataset, paperkeyphrase WHERE keyphrase.keyphrasename = 'semantic parsing' AND paperdataset.datasetid = dataset.datasetid AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paperkeyphrase.paperid = paperdataset.paperid |
who did the broncos play against during the last game of the season ? | CREATE TABLE table_203_730 (id number,"week" number,"date" text,"opponent" text,"result" text,"attendance" number,"bye" text) | SELECT "opponent" FROM table_203_730 ORDER BY "week" DESC LIMIT 1 |
list datasets for video segmentation | CREATE TABLE paperdataset (paperid int,datasetid int)CREATE TABLE dataset (datasetid int,datasetname varchar)CREATE TABLE paperkeyphrase (paperid int,keyphraseid int)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE paperfield (fieldid int,paperid... | SELECT DISTINCT dataset.datasetid FROM dataset, keyphrase, paperdataset, paperkeyphrase WHERE keyphrase.keyphrasename = 'video segmentation' AND paperdataset.datasetid = dataset.datasetid AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paperkeyphrase.paperid = paperdataset.paperid |
What Position has a Super League 1 Competition? | CREATE TABLE table_52535 ("Competition" text,"Played" real,"Drawn" real,"Lost" real,"Position" text,"Coach" text,"Captain" text,"Main Article" text) | SELECT "Position" FROM table_52535 WHERE "Competition" = 'super league 1' |
How many episodes were directed by james quinn? | CREATE TABLE table_2618061_1 (written_by VARCHAR,directed_by VARCHAR) | SELECT COUNT(written_by) FROM table_2618061_1 WHERE directed_by = "James Quinn" |
What is the latest season number that Eric Tuchman directed? | CREATE TABLE table_2219961_2 (season__number INTEGER,director VARCHAR) | SELECT MAX(season__number) FROM table_2219961_2 WHERE director = "Eric Tuchman" |
What is the music label with the catalogue number enocd 10? | CREATE TABLE table_57028 ("Country" text,"Release Date" real,"Music Label" text,"Media" text,"Catalogue Number" text) | SELECT "Music Label" FROM table_57028 WHERE "Catalogue Number" = 'enocd 10' |
What is the high grid for osella - alfa romeo, and a Laps larger than 61? | CREATE TABLE table_name_56 (grid INTEGER,constructor VARCHAR,laps VARCHAR) | SELECT MAX(grid) FROM table_name_56 WHERE constructor = "osella - alfa romeo" AND laps > 61 |
When charles bateman michael lyons is the gt3 winner and 9 is the round who is the gt4 winner? | CREATE TABLE table_31478 ("Round" real,"Circuit" text,"Date" text,"Length" text,"Pole Position" text,"GT3 Winner" text,"GT4 Winner" text) | SELECT "GT4 Winner" FROM table_31478 WHERE "Round" = '9' AND "GT3 Winner" = 'Charles Bateman Michael Lyons' |
Who is the player with a t10 place, from the United States, and has a score of 69-70-76=215? | CREATE TABLE table_name_61 (player VARCHAR,place VARCHAR,country VARCHAR,score VARCHAR) | SELECT player FROM table_name_61 WHERE place = "t10" AND country = "united states" AND score = 69 - 70 - 76 = 215 |
What model type has model designation 97500? | CREATE TABLE table_20866024_2 (model_type VARCHAR,model_designation VARCHAR) | SELECT model_type FROM table_20866024_2 WHERE model_designation = "97500" |
What was the call sign for ERP W of 99? | CREATE TABLE table_name_68 (call_sign VARCHAR,erp_w VARCHAR) | SELECT call_sign FROM table_name_68 WHERE erp_w = 99 |
give me the number of patients whose primary disease is coronary artery disease? | 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 WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE" |
Who was the home team that the Clippers played? | CREATE TABLE table_39965 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Record" text) | SELECT "Home" FROM table_39965 WHERE "Visitor" = 'clippers' |
How many rounds is the player Matthew Puempel associated with? | CREATE TABLE table_11803648_20 (round VARCHAR,player VARCHAR) | SELECT COUNT(round) FROM table_11803648_20 WHERE player = "Matthew Puempel" |
What is the score for the Chicago Black Hawks game with a record of 2-1? | CREATE TABLE table_name_36 (score VARCHAR,home VARCHAR,record VARCHAR) | SELECT score FROM table_name_36 WHERE home = "chicago black hawks" AND record = "2-1" |
count the number of patients whose days of hospital stay is greater than 5 and diagnoses short title is adv eff benzodiaz tranq? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "5" AND diagnoses.short_title = "Adv eff benzodiaz tranq" |
Show how many delegates in each party with a pie chart. | CREATE TABLE county (County_Id int,County_name text,Population real,Zip_code text)CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroller text,Attorney_General text,US_Senate text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text... | SELECT T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party |
What is the Frequency for Model Number c7 1.0? | CREATE TABLE table_76817 ("Model Number" text,"Frequency" text,"L2-Cache" text,"Front Side Bus" text,"Multiplier" text,"Voltage" text,"Socket" text,"Release Date" text) | SELECT "Frequency" FROM table_76817 WHERE "Model Number" = 'c7 1.0' |
How many years had a location at Forest Hills and a score of 6 3, 6 3 for John McEnroe? | CREATE TABLE table_49569 ("Location" text,"Year" real,"Champion" text,"Runner-up" text,"Score" text) | SELECT COUNT("Year") FROM table_49569 WHERE "Location" = 'forest hills' AND "Runner-up" = 'john mcenroe' AND "Score" = '6–3, 6–3' |
Who were the semi finalists when Alexia Dechaume-Balleret Sandrine testud was the runner-up? | CREATE TABLE table_name_81 (semi_finalists VARCHAR,runner_up VARCHAR) | SELECT semi_finalists FROM table_name_81 WHERE runner_up = "alexia dechaume-balleret sandrine testud" |
Name the sum of cuts with wins less than 2, top-25 more than 7 and top-10 less than 2 | CREATE TABLE table_name_80 (cuts_made INTEGER,top_10 VARCHAR,wins VARCHAR,top_25 VARCHAR) | SELECT SUM(cuts_made) FROM table_name_80 WHERE wins < 2 AND top_25 > 7 AND top_10 < 2 |
Highest scoring questions and answers in each tag. | CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance t... | SELECT TagName, QuestionID AS "post_link", q_.Score AS "q_score", AnswerID AS "post_link", a_.Score AS "a_score" FROM (SELECT TagName, (SELECT q.Id FROM Posts AS q INNER JOIN PostTags AS qt ON q.Id = qt.PostId WHERE qt.TagId = t.Id ORDER BY q.Score DESC LIMIT 1) AS QuestionID, (SELECT a.Id FROM Posts AS a INNER JOIN Po... |
what is insurance of subject id 2560? | 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 demographic.insurance FROM demographic WHERE demographic.subject_id = "2560" |
How many episodes were broadcast in 2010? | CREATE TABLE table_24212608_1 (episode VARCHAR,broadcast_date VARCHAR) | SELECT COUNT(episode) FROM table_24212608_1 WHERE broadcast_date = 2010 |
Name the total number of elementary schools for 31851 | CREATE TABLE table_2367847_2 (elementary_schools VARCHAR,district_wide VARCHAR) | SELECT COUNT(elementary_schools) FROM table_2367847_2 WHERE district_wide = 31851 |
how much larger was the 2009 population of chicago than the 2009 population of toronto ? | CREATE TABLE table_204_113 (id number,"rank" number,"area" text,"state/\nprovince" text,"csa/cma\n2009 population" number,"projected\n2025 population" number,"projected increase\n2009-2025" number) | SELECT (SELECT "csa/cma\n2009 population" FROM table_204_113 WHERE "area" = 'chicago') - (SELECT "csa/cma\n2009 population" FROM table_204_113 WHERE "area" = 'toronto') |
what total was the lowest and had a to par of e? | CREATE TABLE table_59196 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" text) | SELECT MIN("Total") FROM table_59196 WHERE "To par" = 'e' |
What is the Label of the release on Stereo vinyl LP with Catalog number SF-7635? | CREATE TABLE table_name_75 (label VARCHAR,format VARCHAR,catalog VARCHAR) | SELECT label FROM table_name_75 WHERE format = "stereo vinyl lp" AND catalog = "sf-7635" |
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, show me about the distribution of job_id and the sum of manager_id , and group by attribute job_id in a bar chart, and display by the y axis in desc please. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,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 regions (REGION_ID decimal(5,0),REGION_NAME varcha... | SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC |
Who is listed under mens singles when womens has wang nan zhang yining? | CREATE TABLE table_28138035_27 (mens_singles VARCHAR,womens_doubles VARCHAR) | SELECT mens_singles FROM table_28138035_27 WHERE womens_doubles = "Wang Nan Zhang Yining" |
Show me a bar chart for how many storms occured in each region? | CREATE TABLE affected_region (Region_id int,Storm_ID int,Number_city_affected real)CREATE TABLE region (Region_id int,Region_code text,Region_name text)CREATE TABLE storm (Storm_ID int,Name text,Dates_active text,Max_speed int,Damage_millions_USD real,Number_Deaths int) | SELECT Region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.Region_id = T2.Region_id GROUP BY T1.Region_id |
is there a LIMOUSINE service available from the PIT airport | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline te... | SELECT DISTINCT ground_service.transport_type FROM airport, ground_service WHERE airport.airport_code = 'PIT' AND ground_service.airport_code = airport.airport_code AND ground_service.transport_type = 'LIMOUSINE' |
what is the price of a FIRST class ticket from MILWAUKEE to SAN FRANCISCO round trip | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flight_number int,departure_time int,departure_airline text,departure_flight_number int,stop_time int)CR... | 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, fare_basis, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MILWAUKEE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code ... |
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 hire_date and the sum of salary bin hire_date by weekday, sort total number in desc 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 locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE regions (REGIO... | SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(SALARY) DESC |
Average reputation of users depending on number of posts. | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TA... | WITH postgroups_cte AS (SELECT u.Id AS uid, u.Reputation AS rep, CAST(COUNT(p.Id) / '##mult?100##' AS INT) AS pgroup FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id GROUP BY u.Id, u.Reputation) SELECT pgroup, AVG(CAST(rep AS FLOAT)) AS Average FROM postgroups_cte GROUP BY pgroup ORDER BY pgroup DESC |
What date did Sigurd Rushfeldt score less than 2 points in the UEFA Euro 2004 qualifying competition? | CREATE TABLE table_55324 ("Date" text,"Venue" text,"Result" text,"Competition" text,"Scored" real) | SELECT "Date" FROM table_55324 WHERE "Scored" < '2' AND "Competition" = 'uefa euro 2004 qualifying' |
count the number of people who were diagnosed with pleural effusion and didn't come back to the hospital during the same month until 4 years ago. | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealths... | SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pleural effusion' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-4 year')) AS t... |
What was the rainfall by volume in Huetar Atlantico where the rainfall depth (mm/year) was 3527? | CREATE TABLE table_28221 ("Region" text,"Land area (km 2)" text,"Rainfall by depth (mm/year)" real,"Rainfall by volume (km 3 /year)" text,"Surface run off (km 3 /year)" text,"Infiltration (km 3 /year)" text,"Evapotranspiration (km 3 /year)" text) | SELECT "Rainfall by volume (km 3 /year)" FROM table_28221 WHERE "Rainfall by depth (mm/year)" = '3527' |
Which Constructor has a Grid of 17? | CREATE TABLE table_name_87 (constructor VARCHAR,grid VARCHAR) | SELECT constructor FROM table_name_87 WHERE grid = 17 |
What is the greatest position when the points are less than 21, and the played greater than 14? | CREATE TABLE table_name_78 (position INTEGER,points VARCHAR,played VARCHAR) | SELECT MAX(position) FROM table_name_78 WHERE points < 21 AND played > 14 |
what are patient 006-76924's changes in bedside glucose second measured on the current hospital visit compared to the value first measured on the current hospital visit? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid numbe... | SELECT (SELECT 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 = '006-76924' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'bedsi... |
Which Placement in Miss Universe is armi barbara quiray crespo? | CREATE TABLE table_60445 ("Year" real,"Delegate" text,"Hometown" text,"Placement in Miss Universe" text,"Other awards" text) | SELECT "Placement in Miss Universe" FROM table_60445 WHERE "Delegate" = 'armi barbara quiray crespo' |
Which Place has a Score smaller than 72, and a To par of 1, and a Country of spain? | CREATE TABLE table_name_51 (place VARCHAR,country VARCHAR,score VARCHAR,to_par VARCHAR) | SELECT place FROM table_name_51 WHERE score < 72 AND to_par = "−1" AND country = "spain" |
How Many of my Answers have been the Accepted Answer. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId... | SELECT answers.Id AS "post_link", answers.Score AS pontuacao, answers.OwnerUserId AS "user_link", CAST(TIME_TO_STR(answers.CreationDate, '%d/%m/%Y') AS TEXT(30)) AS CreationDate FROM Posts AS answers INNER JOIN Posts AS all_posts ON all_posts.AcceptedAnswerId = answers.Id WHERE answers.OwnerUserId = @UserId AND answers... |
Which song is from Volume:Issue 64:11-12? | CREATE TABLE table_34330 ("Volume:Issue" text,"Issue date" text,"Weeks on numbe one" text,"Song" text,"Artist(s)" text) | SELECT "Song" FROM table_34330 WHERE "Volume:Issue" = '64:11-12' |
What's the count for obese children and adolescents ranked 48? | CREATE TABLE table_66571 ("State and District of Columbia" text,"Obese adults" text,"Overweight (incl. obese) adults" text,"Obese children and adolescents" text,"Obesity rank" real) | SELECT "Obese children and adolescents" FROM table_66571 WHERE "Obesity rank" = '48' |
How many questions for a tag. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,Re... | SELECT Id FROM Tags WHERE TagName = 'SCOM' |
What is Tries Against, when Points For is 98? | CREATE TABLE table_name_22 (tries_against VARCHAR,points_for VARCHAR) | SELECT tries_against FROM table_name_22 WHERE points_for = "98" |
What are all the distinct premise types? | CREATE TABLE mailshot_campaigns (mailshot_id number,product_category text,mailshot_name text,mailshot_start_date time,mailshot_end_date time)CREATE TABLE mailshot_customers (mailshot_id number,customer_id number,outcome_code text,mailshot_customer_date time)CREATE TABLE premises (premise_id number,premises_type text,pr... | SELECT DISTINCT premises_type FROM premises |
Which video has a 16:9 aspect? | CREATE TABLE table_name_77 (video VARCHAR,aspect VARCHAR) | SELECT video FROM table_name_77 WHERE aspect = "16:9" |
What was the date administered from a source of Rasmussen Reports and a lead margin over 32? | CREATE TABLE table_49514 ("Poll Source" text,"Dates administered" text,"Democrat: Vivian Davis Figures" text,"Republican: Jeff Sessions" text,"Lead Margin" real) | SELECT "Dates administered" FROM table_49514 WHERE "Poll Source" = 'rasmussen reports' AND "Lead Margin" > '32' |
how many of the male patients had hyperacusis? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.short_title = "Hyperacusis" |
had patient 8016 been tested on total protein, pleural since 14 months ago? | 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 admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admissi... | SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'total protein, pleural') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8016) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), ... |
What country scored 69-69-73=211? | CREATE TABLE table_name_24 (country VARCHAR,score VARCHAR) | SELECT country FROM table_name_24 WHERE score = 69 - 69 - 73 = 211 |
how many patients whose age is less than 80 and diagnoses long title is late effects of cerebrovascular disease, hemiplegia affecting unspecified side? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "80" AND diagnoses.long_title = "Late effects of cerebrovascular disease, hemiplegia affecting unspecified side" |
What is the highest game number? | CREATE TABLE table_13619027_10 (game INTEGER) | SELECT MAX(game) FROM table_13619027_10 |
what is the entrant for the ferrari v8 with points less than 4? | CREATE TABLE table_66902 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real) | SELECT "Entrant" FROM table_66902 WHERE "Engine" = 'ferrari v8' AND "Points" < '4' |
Which Reason is given when 1103 is the date for Became heir? | CREATE TABLE table_name_7 (reason VARCHAR,became_heir VARCHAR) | SELECT reason FROM table_name_7 WHERE became_heir = "1103" |
Weekly trend for python (last 100 weeks). | CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId nu... | SELECT 'Week ' + CAST(TIME_TO_STR(Posts.CreationDate, '%W') AS TEXT(2)) AS Week, YEAR(Posts.CreationDate) AS year, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId LEFT JOIN U... |
What draft pick number was Ric Jackman? | CREATE TABLE table_2840500_1 (pick INTEGER,player VARCHAR) | SELECT MIN(pick) FROM table_2840500_1 WHERE player = "Ric Jackman" |
What are the average wins that have great britain as the team? | CREATE TABLE table_name_80 (wins INTEGER,team VARCHAR) | SELECT AVG(wins) FROM table_name_80 WHERE team = "great britain" |
As far as labs go , are there any classes without them ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_fe... | SELECT DISTINCT name, number FROM course WHERE department = 'EECS' AND has_lab = 'N' |
When was a game played where the away team scored 12.14 (86)? | CREATE TABLE table_53066 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Date" FROM table_53066 WHERE "Away team score" = '12.14 (86)' |
Please show the names of aircrafts associated with airport with name 'London Gatwick'. | CREATE TABLE aircraft (aircraft_id number,aircraft text,description text,max_gross_weight text,total_disk_area text,max_disk_loading text)CREATE TABLE match (round number,location text,country text,date text,fastest_qualifying text,winning_pilot text,winning_aircraft text)CREATE TABLE airport (airport_id number,airport... | SELECT T1.aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.aircraft_id = T2.aircraft_id JOIN airport AS T3 ON T2.airport_id = T3.airport_id WHERE T3.airport_name = "London Gatwick" |
What is Balls, when Venue is 'Bristol', and when Score is '104*'? | CREATE TABLE table_62484 ("Name" text,"Score" text,"Balls" real,"Venue" text,"Date" text) | SELECT "Balls" FROM table_62484 WHERE "Venue" = 'bristol' AND "Score" = '104*' |
What was the result when incumbent Fred E. Busbey was elected? | CREATE TABLE table_1342013_12 (result VARCHAR,incumbent VARCHAR) | SELECT result FROM table_1342013_12 WHERE incumbent = "Fred E. Busbey" |
Top posts (Q&A) on the site.. | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUser... | SELECT Id AS "post_link", Score, CASE WHEN PostTypeId = 1 THEN 'Question' WHEN PostTypeId = 2 THEN 'Answer' END AS "Post Type", OwnerUserId AS "user_link" FROM Posts ORDER BY Score DESC LIMIT 100 |
Which player is the NHL right, who was born in Downers Grove, Illinois? | CREATE TABLE table_41746 ("Position" text,"Jersey #" real,"Name" text,"Height (cm)" real,"Weight (kg)" real,"Birthdate" text,"Birthplace" text,"2002\u20132003 Team" text,"NHL rights,if any" text) | SELECT "NHL rights, if any" FROM table_41746 WHERE "Birthplace" = 'downers grove, illinois' |
Show the number of accounts for each customer in a bar chart grouping by customer's last name, and rank from high to low by the total number. | CREATE TABLE Financial_Transactions (transaction_id INTEGER,account_id INTEGER,invoice_number INTEGER,transaction_type VARCHAR(15),transaction_date DATETIME,transaction_amount DECIMAL(19,4),transaction_comment VARCHAR(255),other_transaction_details VARCHAR(255))CREATE TABLE Product_Categories (production_type_code VARC... | SELECT customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC |
Which Result has an Opponent of washington redskins? | CREATE TABLE table_65451 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT "Result" FROM table_65451 WHERE "Opponent" = 'washington redskins' |
What is the total pick# played by Anton Rodin with a Reg GP over 0? | CREATE TABLE table_54773 ("Rd #" real,"Pick #" real,"Player" text,"Team (League)" text,"Reg GP" real,"Pl GP" real) | SELECT COUNT("Pick #") FROM table_54773 WHERE "Player" = 'anton rodin' AND "Reg GP" > '0' |
Which catalog contents has price above 700 dollars? Show their catalog entry names and capacities, list in desc by the x-axis. | CREATE TABLE Catalog_Contents_Additional_Attributes (catalog_entry_id INTEGER,catalog_level_number INTEGER,attribute_id INTEGER,attribute_value VARCHAR(255))CREATE TABLE Catalog_Structure (catalog_level_number INTEGER,catalog_id INTEGER,catalog_level_name VARCHAR(50))CREATE TABLE Catalog_Contents (catalog_entry_id INTE... | SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700 ORDER BY catalog_entry_name DESC |
which stadium seats the least number of people ? | CREATE TABLE table_204_750 (id number,"team" text,"stadium" text,"capacity" number,"seated" number) | SELECT "team" FROM table_204_750 ORDER BY "capacity" LIMIT 1 |
What is the average First Elected, when District is 'Massachusetts 3'? | CREATE TABLE table_59232 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text) | SELECT AVG("First elected") FROM table_59232 WHERE "District" = 'massachusetts 3' |
A bar chart about what are the destinations and number of flights to each one?, order total number in desc order. | CREATE TABLE employee (eid number(9,0),name varchar2(30),salary number(10,2))CREATE TABLE flight (flno number(4,0),origin varchar2(20),destination varchar2(20),distance number(6,0),departure_date date,arrival_date date,price number(7,2),aid number(9,0))CREATE TABLE certificate (eid number(9,0),aid number(9,0))CREATE TA... | SELECT destination, COUNT(*) FROM flight GROUP BY destination ORDER BY COUNT(*) DESC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.