instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the average number of Byes when there were less than 0 losses and were against 1247? | CREATE TABLE table_75807 ("Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real) | SELECT AVG("Byes") FROM table_75807 WHERE "Against" = '1247' AND "Draws" < '0' |
What is the transfer window in esp with promoted type and more than 2010 ends? | CREATE TABLE table_70767 ("Name" text,"Country" text,"Type" text,"Moving from" text,"Transfer window" text,"Ends" real,"Transfer fee" text,"Source" text) | SELECT "Transfer window" FROM table_70767 WHERE "Country" = 'esp' AND "Type" = 'promoted' AND "Ends" > '2010' |
When did the Metrostars have their first Rookie of the Year winner? | CREATE TABLE table_1004033_1 (season INTEGER,team VARCHAR) | SELECT MIN(season) FROM table_1004033_1 WHERE team = "MetroStars" |
What is the date of the game with Detroit as the visitor team? | CREATE TABLE table_name_23 (date VARCHAR,visitor VARCHAR) | SELECT date FROM table_name_23 WHERE visitor = "detroit" |
What was the crowd size on 4 july 1981, and a Away team of essendon? | CREATE TABLE table_54824 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Crowd" FROM table_54824 WHERE "Date" = '4 july 1981' AND "Away team" = 'essendon' |
Who coached the team in the season with a 6-1 conference record? | CREATE TABLE table_23656 ("Season" real,"Division" text,"Coach" text,"Overall Record" text,"Conference Record" text,"Result" text,"Attendance" real) | SELECT "Coach" FROM table_23656 WHERE "Conference Record" = '6-1' |
What was the average number of fastest laps with less than 0 poles? | CREATE TABLE table_name_5 (fastest_laps INTEGER,poles INTEGER) | SELECT AVG(fastest_laps) FROM table_name_5 WHERE poles < 0 |
count the number of patients less than 45 years of age who had open biopsy of liver. | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "45" AND procedures.long_title = "Open biopsy of liver" |
What is the largest number of seats with more than 32 of a MCI make? | CREATE TABLE table_38676 ("Make" text,"Year placed in service" text,"Quantity" real,"Number of seats" real,"Wheelchair accessible? ()" text,"Current status" text) | SELECT MAX("Number of seats") FROM table_38676 WHERE "Make" = 'mci' AND "Quantity" > '32' |
What date is listed at place 13 | CREATE TABLE table_1140103_6 (date VARCHAR,_number VARCHAR) | SELECT date FROM table_1140103_6 WHERE _number = 13 |
what is the number of patients whose admission year is less than 2108 and procedure long title is continuous invasive mechanical ventilation for less than 96 consecutive hours? | CREATE TABLE diagnoses (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 tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2108" AND procedures.long_title = "Continuous invasive mechanical ventilation for less than 96 consecutive hours" |
calculate the minimum age of patients with brain mass; intracranial hemorrhage primary disease who had psychiatric facility-partial hospitalization discharge. | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" |
Show the number of documents in different starting date. Bin starting date by weekday and group by location code with a stacked bar chart. | CREATE TABLE Ref_Calendar (Calendar_Date DATETIME,Day_Number INTEGER)CREATE TABLE All_Documents (Document_ID INTEGER,Date_Stored DATETIME,Document_Type_Code CHAR(15),Document_Name CHAR(255),Document_Description CHAR(255),Other_Details VARCHAR(255))CREATE TABLE Documents_to_be_Destroyed (Document_ID INTEGER,Destruction_... | SELECT Date_in_Location_From, COUNT(Date_in_Location_From) FROM Document_Locations GROUP BY Location_Code |
provide the number of patients whose admission type is elective and admission year is less than 2135? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admityear < "2135" |
How much Avg/G has a Gain smaller than 1571, and a Long smaller than 46? | CREATE TABLE table_77060 ("Name" text,"Gain" real,"Loss" real,"Long" real,"Avg/G" real) | SELECT COUNT("Avg/G") FROM table_77060 WHERE "Gain" < '1571' AND "Long" < '46' |
Name the drawn for tries for of 42 | CREATE TABLE table_name_95 (drawn VARCHAR,tries_for VARCHAR) | SELECT drawn FROM table_name_95 WHERE tries_for = "42" |
What is the highest rank of the player with less than 32 points? | CREATE TABLE table_name_24 (rank INTEGER,points INTEGER) | SELECT MAX(rank) FROM table_name_24 WHERE points < 32 |
count the number of patients who had urgent hospital admission and are prescribed paroxetine hcl medication. | 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.admission_type = "URGENT" AND prescriptions.drug = "Paroxetine HCl" |
what is average age of male for different job title? | CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER) | SELECT job, AVG(age) FROM Person WHERE gender = 'male' GROUP BY job |
What is I/O bus when socket is socket g1bga-1288? | CREATE TABLE table_13615 ("Model number" text,"sSpec number" text,"Frequency" text,"Turbo" text,"GPU frequency" text,"Cores" text,"L2 cache" text,"L3 cache" text,"I/O bus" text,"Mult." text,"Memory" text,"Voltage" text,"Socket" text,"Release date" text,"Part number(s)" text,"Release price (USD)" text) | SELECT "I/O bus" FROM table_13615 WHERE "Socket" = 'socket g1bga-1288' |
papers using WordNet or Dbpedia | CREATE TABLE field (fieldid int)CREATE TABLE paperfield (fieldid int,paperid int)CREATE TABLE venue (venueid int,venuename varchar)CREATE TABLE author (authorid int,authorname varchar)CREATE TABLE dataset (datasetid int,datasetname varchar)CREATE TABLE cite (citingpaperid int,citedpaperid int)CREATE TABLE keyphrase (ke... | SELECT DISTINCT paper.paperid FROM dataset, paper, paperdataset WHERE dataset.datasetname IN ('WordNet', 'Dbpedia') AND paperdataset.datasetid = dataset.datasetid AND paper.paperid = paperdataset.paperid GROUP BY paper.paperid |
how much do the magnesium, urine actually cost? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title te... | SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'magnesium, urine')) |
Very short answers with high score. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TAB... | SELECT Id AS "post_link", Body, Score FROM Posts WHERE LENGTH(Body) < 256 AND Score > 5 AND PostTypeId = 2 |
give me the number of patients with private health insurance admitted before 2167. | 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 demographic (subject_id text,hadm_id t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.admityear < "2167" |
Who is the partner with a runner-up outcome on April 6, 1992? | CREATE TABLE table_name_26 (partner VARCHAR,outcome VARCHAR,date VARCHAR) | SELECT partner FROM table_name_26 WHERE outcome = "runner-up" AND date = "april 6, 1992" |
What are dates of birth of all the guests whose gender is 'Male'? | CREATE TABLE apartment_buildings (building_id number,building_short_name text,building_full_name text,building_description text,building_address text,building_manager text,building_phone text)CREATE TABLE apartment_facilities (apt_id number,facility_code text)CREATE TABLE apartment_bookings (apt_booking_id number,apt_i... | SELECT date_of_birth FROM guests WHERE gender_code = "Male" |
retrieve the top five most commonly prescribed drugs until 1 year ago for patients of age 40s. | 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 t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-1 year') GR... |
Who wrote the title that received 1.211 million total viewers? | CREATE TABLE table_12419515_4 (written_by VARCHAR,total_viewers__in_millions_ VARCHAR) | SELECT written_by FROM table_12419515_4 WHERE total_viewers__in_millions_ = "1.211" |
how many winners from vietnam | CREATE TABLE table_17606 ("#" real,"Nation" text,"Winners" real,"Runners-up" real,"3rd Place" real,"4th Place" real) | SELECT "Winners" FROM table_17606 WHERE "Nation" = 'Vietnam' |
Posts most edited by user. | CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)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 Tags (Id num... | SELECT Posts.Id AS "post_link", Posts.OwnerUserId AS "user_link", COUNT(DISTINCT PostHistory.RevisionGUID) AS Edits, MIN(PostHistory.CreationDate) AS Earliest, MAX(PostHistory.CreationDate) AS Latest FROM Posts JOIN PostHistory ON PostHistory.PostId = Posts.Id WHERE PostHistory.UserId = '##UserId##' AND PostHistory.Pos... |
What are the school colors of the University of New Hampshire? | CREATE TABLE table_1221089_1 (colors VARCHAR,institution VARCHAR) | SELECT colors FROM table_1221089_1 WHERE institution = "University of New Hampshire" |
Name the launch date for duration days 174.14 | CREATE TABLE table_1906515_1 (launch_date VARCHAR,duration__days_ VARCHAR) | SELECT launch_date FROM table_1906515_1 WHERE duration__days_ = "174.14" |
what number of patients who received a insert endotracheal tube procedure in the same hospital visit after having been diagnosed with alcohol abuse-unspec during this year? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)C... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =... |
What is the average overall that has a pick less than 20, North Carolina as the college, with a round less than 8? | CREATE TABLE table_76922 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT AVG("Overall") FROM table_76922 WHERE "Pick" < '20' AND "College" = 'north carolina' AND "Round" < '8' |
What is the expiring term for Daryl Hecht when the appointing governor is Tom Vilsack? | CREATE TABLE table_11789 ("Name" text,"Appointed/Elected" text,"Term expires" text,"Appointing Governor" text,"Governor's Party Affiliation" text) | SELECT "Term expires" FROM table_11789 WHERE "Appointing Governor" = 'tom vilsack' AND "Name" = 'daryl hecht' |
who was the last president from the republican party ? | CREATE TABLE table_203_800 (id number,"#" number,"president" text,"president's party" text,"senate with" number,"senate opposed" number,"house with" number,"house opposed" number,"years served" number,"elections won" number) | SELECT "president" FROM table_203_800 WHERE "president's party" = 'republican' ORDER BY "#" DESC LIMIT 1 |
What is the age distribution for the users?. | CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwne... | SELECT t2.age, COUNT(t2.Id) AS Count_of_users_by_age FROM Users AS t2 GROUP BY t2.age ORDER BY t2.age |
For those employees who did not have any job in the past, give me the comparison about the average of manager_id over the hire_date bin hire_date by time, sort in descending by the total number. | 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 HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(MANAGER_ID) DESC |
Name the Daytime which has a Name of exmouth? | CREATE TABLE table_name_22 (daytime VARCHAR,name VARCHAR) | SELECT daytime FROM table_name_22 WHERE name = "exmouth" |
Who was the home team in the match against Luton Town? | CREATE TABLE table_name_21 (home_team VARCHAR,away_team VARCHAR) | SELECT home_team FROM table_name_21 WHERE away_team = "luton town" |
select * from Posts wheere AnswerCount>0. | 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 * FROM Posts WHERE AnswerCount > 0 |
give me the number of patients whose diagnoses icd9 code is v4987? | 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 WHERE diagnoses.icd9_code = "V4987" |
Plot salary by grouped by email as a bar graph, and show y-axis in descending order. | 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 EMAIL, SALARY FROM employees ORDER BY SALARY DESC |
What are the names and year of joining for artists that do not have the country 'United States'? | CREATE TABLE exhibition_record (exhibition_id number,date text,attendance number)CREATE TABLE artist (artist_id number,name text,country text,year_join number,age number)CREATE TABLE exhibition (exhibition_id number,year number,theme text,artist_id number,ticket_price number) | SELECT name, year_join FROM artist WHERE country <> 'United States' |
Who were the candidates in the Maryland 5 district election? | CREATE TABLE table_18104 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text,"Candidates" text) | SELECT "Candidates" FROM table_18104 WHERE "District" = 'Maryland 5' |
What's the sum of Opening Weekend Net Gross at the Studio of UTV Motion Pictures? | CREATE TABLE table_name_8 (opening_weekend_net_gross INTEGER,studio_s_ VARCHAR) | SELECT SUM(opening_weekend_net_gross) FROM table_name_8 WHERE studio_s_ = "utv motion pictures" |
What is the programming for Kanal 5? | CREATE TABLE table_name_20 (programming VARCHAR,name VARCHAR) | SELECT programming FROM table_name_20 WHERE name = "kanal 5" |
What competition has a score of 1-3? | CREATE TABLE table_name_47 (competition VARCHAR,score VARCHAR) | SELECT competition FROM table_name_47 WHERE score = "1-3" |
What's the against of South Warrnambool when the draw is less than 0? | CREATE TABLE table_name_31 (against INTEGER,club VARCHAR,draws VARCHAR) | SELECT SUM(against) FROM table_name_31 WHERE club = "south warrnambool" AND draws < 0 |
Rome is in which country? | CREATE TABLE table_72595 ("Tournament" text,"Country" text,"Location" text,"Current Venue" text,"Began" real,"Court surface" text) | SELECT "Country" FROM table_72595 WHERE "Location" = 'Rome' |
Which sum of Seasons in league has a Best Position of 5th (2007)? | CREATE TABLE table_name_82 (seasons_in_league INTEGER,best_position VARCHAR) | SELECT SUM(seasons_in_league) FROM table_name_82 WHERE best_position = "5th (2007)" |
What party did incumbent Brooks Hays belong to? | CREATE TABLE table_1342249_5 (party VARCHAR,incumbent VARCHAR) | SELECT party FROM table_1342249_5 WHERE incumbent = "Brooks Hays" |
what's the extroverted, relationship-oriented where date is c. 1928 | CREATE TABLE table_11256021_1 (extroverted VARCHAR,_relationship_oriented VARCHAR,date VARCHAR) | SELECT extroverted, _relationship_oriented FROM table_11256021_1 WHERE date = "c. 1928" |
what is the turbo when the part number is cm8062300834302bx80623i72600bxc80623i72600? | CREATE TABLE table_name_62 (turbo VARCHAR,part_number_s_ VARCHAR) | SELECT turbo FROM table_name_62 WHERE part_number_s_ = "cm8062300834302bx80623i72600bxc80623i72600" |
Who was the runner-up at the Broadmoor Arena before 2008? | CREATE TABLE table_name_43 (runner_up VARCHAR,year VARCHAR,arena VARCHAR) | SELECT runner_up FROM table_name_43 WHERE year < 2008 AND arena = "broadmoor arena" |
what are all flights from BOSTON to DENVER | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER'... |
Bar chart x axis carrier y axis the number of carrier, display bar from high to low order. | CREATE TABLE phone (Name text,Phone_ID int,Memory_in_G int,Carrier text,Price real)CREATE TABLE market (Market_ID int,District text,Num_of_employees int,Num_of_shops real,Ranking int)CREATE TABLE phone_market (Market_ID int,Phone_ID text,Num_of_stock int) | SELECT Carrier, COUNT(Carrier) FROM phone GROUP BY Carrier ORDER BY Carrier DESC |
what's the total amount of input of patient 028-8188? | 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 vitalperiodic (vitalperiodicid number,patientunitstayid number,tempe... | SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-8188')) AND intakeoutput.cellpath LIKE '%int... |
what is the total quantity of or out pacu urine output patient 32592 had until 09/25/2104? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE patients (row_id numbe... | SELECT SUM(outputevents.value) 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 = 32592)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'or ... |
What is the average rating for a Flyde that has a Burnley less than 0? | CREATE TABLE table_name_57 (fylde INTEGER,burnley INTEGER) | SELECT AVG(fylde) FROM table_name_57 WHERE burnley < 0 |
What is the total number of draws for Wakool when there are more than 11 losses and fewer than 4 wins? | CREATE TABLE table_60689 ("Golden Rivers" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real) | SELECT COUNT("Draws") FROM table_60689 WHERE "Losses" > '11' AND "Wins" < '4' AND "Golden Rivers" = 'wakool' |
What is the Index number of Chen Bangjun Andie from Singapore? | CREATE TABLE table_70963 ("Index" text,"Name" text,"Chinese Name" text,"Country" text,"Status" text) | SELECT "Index" FROM table_70963 WHERE "Country" = 'singapore' AND "Name" = 'chen bangjun andie' |
Name the total number of pitcher for 9 overall rank | CREATE TABLE table_26720 ("Pitcher" text,"Strikeouts" real,"Season" real,"Team" text,"League" text,"Overall Rank" real) | SELECT COUNT("Pitcher") FROM table_26720 WHERE "Overall Rank" = '9' |
What make of car did Brian Vickers drive? | CREATE TABLE table_74730 ("Driver" text,"Car #" real,"Make" text,"Points" text,"Laps" real,"Winnings" text) | SELECT "Make" FROM table_74730 WHERE "Driver" = 'brian vickers' |
what date was mallala motor sport park the circuit? | CREATE TABLE table_68492 ("Circuit" text,"Location / State" text,"Date" text,"Winning driver" text,"Team" text) | SELECT "Date" FROM table_68492 WHERE "Circuit" = 'mallala motor sport park' |
What is the id and name of the department store that has both marketing and managing department? | CREATE TABLE department_stores (dept_store_id VARCHAR,store_name VARCHAR)CREATE TABLE departments (dept_store_id VARCHAR,department_name VARCHAR) | SELECT T2.dept_store_id, T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "marketing" INTERSECT SELECT T2.dept_store_id, T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.de... |
What is the rank of Japan? | CREATE TABLE table_63711 ("Rank" real,"Lane" real,"Name" text,"Nationality" text,"Time" text) | SELECT "Rank" FROM table_63711 WHERE "Nationality" = 'japan' |
Can you tell me the total number of Total votes that has the Election larger than 2009, and the Candidates fielded larger than 61? | CREATE TABLE table_45696 ("Election" real,"Candidates fielded" real,"# of seats won" real,"Total votes" real,"% of popular vote" text,"Place" text) | SELECT COUNT("Total votes") FROM table_45696 WHERE "Election" > '2009' AND "Candidates fielded" > '61' |
what is the number of patients whose admission location is transfer from hosp/extram and drug name is ipratropium bromide mdi? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND prescriptions.drug = "Ipratropium Bromide MDI" |
On what date was the attendance larger than 29,319 and had a score of 7-6? | CREATE TABLE table_15107 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real) | SELECT "Date" FROM table_15107 WHERE "Attendance" > '29,319' AND "Score" = '7-6' |
How many Games has a Name of st phane dumas and a Rank larger than 5? | CREATE TABLE table_7430 ("Rank" real,"Name" text,"Team" text,"Games" real,"Points" real) | SELECT AVG("Games") FROM table_7430 WHERE "Name" = 'stéphane dumas' AND "Rank" > '5' |
Comments qualifying for Think! hat. | CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId n... | SELECT DISTINCT (p.Id) AS "post_link" FROM Posts AS p INNER JOIN Comments AS c ON c.PostId = p.Id WHERE c.CreationDate >= '2019-12-07' AND c.UserId = '##userid:int##' AND c.Score > 0 |
Contributing users and id-request-first users - how much do they overlap?. | CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,R... | SELECT u.Id AS "user_link", p.Id AS "post_link", p.CreationDate, (CASE WHEN p.PostTypeId = 1 THEN p.Tags WHEN p.PostTypeId = 2 THEN (SELECT Tags FROM Posts AS p3 WHERE p3.Id = p.ParentId) END) AS "tags" FROM Users AS u INNER JOIN (SELECT p2.OwnerUserId, MIN(p2.Id) AS "id", MIN(p2.CreationDate) AS "creationdate", MIN(p2... |
How many users have actually read the entire Tour page? (statistically). Counts how many users have actually read the entire Tour page, based on how many who has received the 'Informed' badge. | CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)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 PostFeedback (Id numbe... | SELECT (SELECT COUNT(Id) FROM Users) AS Users, COUNT(b.UserId) AS BadgeHolders, (CAST(COUNT(b.UserId) AS FLOAT) / (SELECT COUNT(Id) FROM Users) * 100) AS Percentage FROM Users AS u LEFT JOIN Badges AS b ON b.UserId = u.Id WHERE b.Name = 'Informed' |
when did patient 004-32341 first receive a prescription for fentanyl (pf) 50 mcg/1 ml 2 ml inj? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight... | SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-32341')) AND medication.drugname = 'fentanyl (pf) 50 mcg/1... |
Who was the director for the episode in season #50? | CREATE TABLE table_16471432_4 (directed_by VARCHAR,series__number VARCHAR) | SELECT directed_by FROM table_16471432_4 WHERE series__number = 50 |
For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and employee_id , and visualize them by a bar chart, rank by the names in desc please. | 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 countries (COUNTRY_ID varchar(2),COUNTRY_NAME varc... | 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 FIRST_NAME DESC |
What is the production code that had 24.8 million u.s. viewers? | CREATE TABLE table_27713890_1 (production_code INTEGER,us_viewers__millions_ VARCHAR) | SELECT MAX(production_code) FROM table_27713890_1 WHERE us_viewers__millions_ = "24.8" |
What was the location attendance on the date of November 15? | CREATE TABLE table_11960610_6 (location_attendance VARCHAR,date VARCHAR) | SELECT location_attendance FROM table_11960610_6 WHERE date = "November 15" |
how many registed students do each course have? List course name and the number of their registered students?, and I want to show from low to high by the y-axis. | CREATE TABLE Courses (course_id VARCHAR(100),course_name VARCHAR(120),course_description VARCHAR(255),other_details VARCHAR(255))CREATE TABLE People (person_id INTEGER,first_name VARCHAR(255),middle_name VARCHAR(255),last_name VARCHAR(255),cell_mobile_number VARCHAR(40),email_address VARCHAR(40),login_name VARCHAR(40),... | SELECT course_name, COUNT(*) FROM Students AS T1 JOIN Student_Course_Registrations AS T2 ON T1.student_id = T2.student_id JOIN Courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id ORDER BY COUNT(*) |
what is the average total when silver is more than 2, bronze is 12 and gold is less than 12? | CREATE TABLE table_64767 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Total") FROM table_64767 WHERE "Silver" > '2' AND "Bronze" = '12' AND "Gold" < '12' |
what are the three most frequently prescribed drugs for patients that had previously received vaccination nec within 2 months, until 2101? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id numbe... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures ... |
calculate the number of patients who had received a cl reduc disloc-elbow procedure until 2104. | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 prescriptio... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id 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 reduc disloc-elbow') AND STRFTIME('%y', procedure... |
Display a bar chart for how many climbers are from each country? | CREATE TABLE climber (Climber_ID int,Name text,Country text,Time text,Points real,Mountain_ID int)CREATE TABLE mountain (Mountain_ID int,Name text,Height real,Prominence real,Range text,Country text) | SELECT Country, COUNT(*) FROM climber GROUP BY Country |
What is the date of the game at Junction Oval? | CREATE TABLE table_name_55 (date VARCHAR,venue VARCHAR) | SELECT date FROM table_name_55 WHERE venue = "junction oval" |
when was the first time patient 30171 got a lab test until 05/2105 for bicarbonate? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,ward... | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bicarbonate') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30171) AND STRFTIME('%y-%m', labevents.charttime) <= '2105-05' ORDER BY ... |
Find the max and min grade point for all letter grade. | CREATE TABLE GRADECONVERSION (gradepoint INTEGER) | SELECT MAX(gradepoint), MIN(gradepoint) FROM GRADECONVERSION |
For those employees who do not work in departments with managers that have ids between 100 and 200, a scatter chart shows the correlation between employee_id and salary . | 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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),CO... | SELECT EMPLOYEE_ID, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
Can you tell me the average December rhat has the Opponent of @ toronto maple leafs? | CREATE TABLE table_49874 ("Game" real,"December" real,"Opponent" text,"Score" text,"Record" text) | SELECT AVG("December") FROM table_49874 WHERE "Opponent" = '@ toronto maple leafs' |
Who did they play when there were only 751 in attendance? | CREATE TABLE table_51075 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real,"Competition" text,"Man of the Match" text) | SELECT "Opponent" FROM table_51075 WHERE "Attendance" < '751' |
Count of Questions in Period with Tag. | CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId nu... | SELECT t.TagName, COUNT(DISTINCT q.Id) AS Question FROM PostTags AS pt JOIN Posts AS q ON q.Id = pt.PostId JOIN Tags AS t ON t.Id = pt.TagId WHERE PostTypeId = 1 AND t.TagName LIKE '%daml%' AND q.CreationDate > '2019-03-31 00:00:00' GROUP BY t.TagName ORDER BY Question DESC |
What is the highest number of laps when there are less than 5 points for team garry rogers motorsport and the grid number is under 23? | CREATE TABLE table_name_49 (laps INTEGER,grid VARCHAR,points VARCHAR,team VARCHAR) | SELECT MAX(laps) FROM table_name_49 WHERE points < 5 AND team = "garry rogers motorsport" AND grid < 23 |
What was the loss on September 2? | CREATE TABLE table_name_16 (loss VARCHAR,date VARCHAR) | SELECT loss FROM table_name_16 WHERE date = "september 2" |
in 2103 what was patient 67481's first hospital discharge time? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE d_items (row_id numbe... | SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 67481 AND STRFTIME('%y', admissions.dischtime) = '2103' ORDER BY admissions.dischtime LIMIT 1 |
systolic blood pressure greater than 160 mmhg, or diastolic blood pressure greater than 100 mmhg at screening | CREATE TABLE table_dev_28 ("id" int,"gender" string,"systolic_blood_pressure_sbp" int,"consent" bool,"hemoglobin_a1c_hba1c" float,"hematocrit_hct" float,"fasting_triglycerides" int,"fasting_blood_glucose_fbg" float,"diastolic_blood_pressure_dbp" int,"hba1c" float,"metformin" bool,"age" float,"NOUSE" float) | SELECT * FROM table_dev_28 WHERE systolic_blood_pressure_sbp > 160 OR diastolic_blood_pressure_dbp > 100 |
Count different addresses of each school with a bar chart, I want to order Y from low to high order. | CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(... | SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_ADDRESS) FROM DEPARTMENT ORDER BY COUNT(DISTINCT DEPT_ADDRESS) |
What was the score when Donald Bradman in 9 innings? | CREATE TABLE table_16570286_2 (highest_score VARCHAR,innings VARCHAR,player VARCHAR) | SELECT highest_score FROM table_16570286_2 WHERE innings = 9 AND player = "Donald Bradman" |
What is the class of team liqui moly equipe, which has less than 71 laps? | CREATE TABLE table_name_85 (class VARCHAR,laps VARCHAR,team VARCHAR) | SELECT class FROM table_name_85 WHERE laps < 71 AND team = "liqui moly equipe" |
Name the year for reportaje a la muerte | CREATE TABLE table_20963074_1 (year__ceremony_ VARCHAR,original_title VARCHAR) | SELECT year__ceremony_ FROM table_20963074_1 WHERE original_title = "Reportaje a la muerte" |
What yeae has 6-08 (24) as a waterford score? | CREATE TABLE table_65924 ("Year" real,"Venue" text,"Competition" text,"Kilkenny score" text,"Waterford score" text) | SELECT "Year" FROM table_65924 WHERE "Waterford score" = '6-08 (24)' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.