instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What location had 25/25 fatalities? | CREATE TABLE table_name_15 (location VARCHAR,fatalities VARCHAR) | SELECT location FROM table_name_15 WHERE fatalities = "25/25" |
Return a histogram on how many invoices were billed from each state?, and sort x axis from low to high order. | CREATE TABLE artists (id INTEGER,name VARCHAR(120))CREATE TABLE playlists (id INTEGER,name VARCHAR(120))CREATE TABLE invoice_lines (id INTEGER,invoice_id INTEGER,track_id INTEGER,unit_price NUMERIC(10,2),quantity INTEGER)CREATE TABLE playlist_tracks (playlist_id INTEGER,track_id INTEGER)CREATE TABLE sqlite_sequence (na... | SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY billing_state |
patient 016-34475 was diagnosed until 4 years ago for the last time with what? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE lab (labid number,patientunitstayid number,lab... | SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-34475')) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CU... |
Of all the courses which are worth 7 credits ? | CREATE TABLE semester (semester_id int,semester varchar,year int)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 va... | SELECT DISTINCT name, number FROM course WHERE credits = 7 AND department = 'EECS' |
when was the first hospital admission time when patient 035-20156 was admitted a year before via the direct admit? | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,l... | SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '035-20156' AND patient.hospitaladmitsource = 'direct admit' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY patient.hospitaladmittime LIMIT 1 |
Name the least pick # for doug gibson | CREATE TABLE table_1965650_3 (pick__number INTEGER,player VARCHAR) | SELECT MIN(pick__number) FROM table_1965650_3 WHERE player = "Doug Gibson" |
What is the highest number of gold medals for the team ranked 7 with less than 3 bronze? | CREATE TABLE table_name_19 (gold INTEGER,rank VARCHAR,bronze VARCHAR) | SELECT MAX(gold) FROM table_name_19 WHERE rank = "7" AND bronze < 3 |
When was Kamba active? | CREATE TABLE table_16206 ("Name" text,"Dates active" text,"Peak classification" text,"Windspeeds" text,"Pressure" text,"Areas affected" text,"Damage (USD)" text,"Deaths" text,"Refs" text) | SELECT "Dates active" FROM table_16206 WHERE "Name" = 'Kamba' |
Name the total number of previous br number for number 21 | CREATE TABLE table_23921 ("Number" text,"Previous BR No." real,"Taken into deptal stock" real,"Withdrawn" real,"Disposal" text) | SELECT COUNT("Previous BR No.") FROM table_23921 WHERE "Number" = '21' |
known hypersensitivity or prior exposure to formoterol. | CREATE TABLE table_train_99 ("id" int,"mini_mental_state_examination_mmse" int,"language" string,"renal_disease" bool,"hepatic_disease" bool,"allergy_to_formoterol" bool,"geriatric_depression_scale_gds" int,"NOUSE" float) | SELECT * FROM table_train_99 WHERE allergy_to_formoterol = 1 |
What is the gross revenue in 2011 for MO? | CREATE TABLE table_name_8 (gross_revenue__2011_ VARCHAR,state VARCHAR) | SELECT gross_revenue__2011_ FROM table_name_8 WHERE state = "mo" |
pg andersson and toni gardemeister were both driving what type of car ? | CREATE TABLE table_203_399 (id number,"pos." text,"driver" text,"co-driver" text,"car" text,"time" text,"difference" text,"points" number) | SELECT "car" FROM table_203_399 WHERE "driver" = 'pg andersson' |
provide the number of patients whose insurance is private and year of birth is less than 2023? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.dob_year < "2023" |
did patient 97330 have a obstructive sleep apnea diagnosis during their current hospital encounter? | CREATE TABLE diagnoses_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 labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABL... | SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'obstructive sleep apnea') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97330 AND admissions.dischtim... |
what's the airport with total passengers 2009 being 157933 | CREATE TABLE table_13836704_4 (airport VARCHAR,total_passengers_2009 VARCHAR) | SELECT airport FROM table_13836704_4 WHERE total_passengers_2009 = 157933 |
Distribution of users by the number of upvotes. | 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 ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE Votes (Id number,PostId n... | SELECT UpVotes AS upvotes, COUNT(*) AS total_users FROM Users WHERE Reputation >= 15 GROUP BY UpVotes ORDER BY UpVotes |
Who is every contestant for the position of 4th? | CREATE TABLE table_26787 ("Contestant" text,"Starting Weight (kg)" text,"Final Weight (kg)" text,"Weight Lost (kg)" text,"Percentage Lost" text,"Position (out of Eliminated Contestants)" text) | SELECT "Contestant" FROM table_26787 WHERE "Position (out of Eliminated Contestants)" = '4th' |
Which team did the Patriots play when there was a game attendance of 73,369? | CREATE TABLE table_name_48 (opponent VARCHAR,attendance VARCHAR) | SELECT opponent FROM table_name_48 WHERE attendance = "73,369" |
With a dail of 24th and more than 57 seats, what is the election? | CREATE TABLE table_51790 ("Election" text,"D\u00e1il" text,"Share of votes" text,"Seats" real,"Total seats" real) | SELECT "Election" FROM table_51790 WHERE "Seats" > '57' AND "D\u00e1il" = '24th' |
Who was number 7 when Olivia was number 5 and Emma was number 2? | CREATE TABLE table_47553 ("Region (year)" text,"No. 1" text,"No. 2" text,"No. 3" text,"No. 4" text,"No. 5" text,"No. 6" text,"No. 7" text,"No. 8" text,"No. 9" text,"No. 10" text) | SELECT "No. 7" FROM table_47553 WHERE "No. 5" = 'olivia' AND "No. 2" = 'emma' |
Which average Against has Points of 6, and a Played smaller than 9? | CREATE TABLE table_name_65 (against INTEGER,points VARCHAR,played VARCHAR) | SELECT AVG(against) FROM table_name_65 WHERE points = 6 AND played < 9 |
Name the total number of district for population may being 478 | CREATE TABLE table_23822 ("Barangay" text,"District" text,"Population (May 1,2000)" real,"Population (August 1,2007)" real,"Population (May 1,2010)" text) | SELECT COUNT("District") FROM table_23822 WHERE "Population (May 1, 2010)" = '478' |
How many million u.s. viewers saw the episode that was directed by roger young and written by debra j. fisher? | CREATE TABLE table_28037619_2 (us_viewers__million_ VARCHAR,directed_by VARCHAR,written_by VARCHAR) | SELECT us_viewers__million_ FROM table_28037619_2 WHERE directed_by = "Roger Young" AND written_by = "Debra J. Fisher" |
how many of the patients admitted to emergency had item id 50902? | 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.admission_location = "EMERGENCY ROOM ADMIT" AND lab.itemid = "50902" |
count the number of patients whose primary disease is abdominal abscess and admission year is less than 2162? | 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 demographic (subject_id text,hadm_id text,name text,marita... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL ABSCESS" AND demographic.admityear < "2162" |
What is the format for the album under the label, luaka bop, that had a catalog number of 3645 and dated after 1981? | CREATE TABLE table_name_15 (format VARCHAR,label VARCHAR,catalog VARCHAR,date VARCHAR) | SELECT format FROM table_name_15 WHERE catalog = "3645" AND date > 1981 AND label = "luaka bop" |
What is the format for the station owned by Dakota Broadcasting? | CREATE TABLE table_2709_4 (format VARCHAR,owner VARCHAR) | SELECT format FROM table_2709_4 WHERE owner = "Dakota Broadcasting" |
Chassis model Scania K360ua has what minimum number in fleet? | CREATE TABLE table_1425948_1 (number_in_fleet INTEGER,chassis_model VARCHAR) | SELECT MIN(number_in_fleet) FROM table_1425948_1 WHERE chassis_model = "Scania K360UA" |
What is the original air date of the episode with the production code 1115? | CREATE TABLE table_22296 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real) | SELECT "Original air date" FROM table_22296 WHERE "Production code" = '1115' |
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, give me the comparison about the average of manager_id over the hire_date bin hire_date by weekday by a bar chart. | 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 HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
Which venue had more than 9 goals and a final result of 4-1? | CREATE TABLE table_name_82 (venue VARCHAR,goal VARCHAR,result VARCHAR) | SELECT venue FROM table_name_82 WHERE goal > 9 AND result = "4-1" |
Which Date has a Road Team of chicago, and a Result of 88-85 (ot)? | CREATE TABLE table_58699 ("Game" text,"Date" text,"Home Team" text,"Result" text,"Road Team" text) | SELECT "Date" FROM table_58699 WHERE "Road Team" = 'chicago' AND "Result" = '88-85 (ot)' |
how many wins did players earning less than $10,484,065 have? | CREATE TABLE table_34262 ("Rank" real,"Player" text,"Country" text,"Earnings ($)" real,"Wins" real) | SELECT SUM("Wins") FROM table_34262 WHERE "Earnings ( $ )" < '10,484,065' |
WHo is Winner/2nd that has c. symons? | CREATE TABLE table_name_84 (winner_2nd VARCHAR,jockey VARCHAR) | SELECT winner_2nd FROM table_name_84 WHERE jockey = "c. symons" |
Which L1 Cache has an FSB speed of 800mhz and a clock speed of 1.2ghz? | CREATE TABLE table_name_35 (l1_cache VARCHAR,fsb_speed VARCHAR,clock_speed VARCHAR) | SELECT l1_cache FROM table_name_35 WHERE fsb_speed = "800mhz" AND clock_speed = "1.2ghz" |
what is the number of patients whose ethnicity is american indian/alaska native and procedure icd9 code is 7761? | 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 demographic (subject_id text,hadm_id text,name text,marital... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.icd9_code = "7761" |
What is the latest year that Cicely Tyson is the Golden Globe Award actor? | CREATE TABLE table_41053 ("Year" real,"Actor" text,"Award" text,"Motion Picture" text,"Result" text) | SELECT MAX("Year") FROM table_41053 WHERE "Actor" = 'cicely tyson' |
What is the smallest silver with a Bronze smaller than 6, a Total of 3, and a Rank smaller than 9? | CREATE TABLE table_name_33 (silver INTEGER,rank VARCHAR,bronze VARCHAR,total VARCHAR) | SELECT MIN(silver) FROM table_name_33 WHERE bronze < 6 AND total = 3 AND rank < 9 |
what are the top three common diagnoses of patients of age 30s? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number... | SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3 |
What is the first name and last name of the customer that has email 'luisg@embraer.com.br'? | CREATE TABLE CUSTOMER (FirstName VARCHAR,LastName VARCHAR,Email VARCHAR) | SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br" |
What is the location of thierry boutsen? | CREATE TABLE table_16668 ("Round" real,"Grand Prix" text,"Date" text,"Location" text,"Pole Position" text,"Fastest Lap" text,"Winning Driver" text,"Winning Constructor" text,"Report" text) | SELECT "Location" FROM table_16668 WHERE "Fastest Lap" = 'Thierry Boutsen' |
What engine does the Fuzzy's Ultra Premium Vodka sponsored car use? | CREATE TABLE table_3203 ("Team" text,"#" real,"Car Sponsor(s)" text,"Driver(s)" text,"Listed Owner(s)" text,"Engine" text,"Chassis" text) | SELECT "Engine" FROM table_3203 WHERE "Car Sponsor(s)" = 'Fuzzy''s Ultra Premium Vodka' |
How many perpetrators are there? | CREATE TABLE perpetrator (Id VARCHAR) | SELECT COUNT(*) FROM perpetrator |
What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds? | CREATE TABLE weather (date VARCHAR,mean_temperature_f VARCHAR,mean_humidity VARCHAR,max_gust_speed_mph VARCHAR) | SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3 |
What was the score in January that was less than 4? | CREATE TABLE table_name_92 (score VARCHAR,january INTEGER) | SELECT score FROM table_name_92 WHERE january < 4 |
What is the To par has the presence of Vijay Singh? | CREATE TABLE table_name_67 (to_par VARCHAR,player VARCHAR) | SELECT to_par FROM table_name_67 WHERE player = "vijay singh" |
What is the sum of Bronze when the total is more than 27? | CREATE TABLE table_name_91 (bronze INTEGER,total INTEGER) | SELECT SUM(bronze) FROM table_name_91 WHERE total > 27 |
What person was played against when the playing surface was hard? | CREATE TABLE table_39056 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponent" text,"Score" text) | SELECT "Opponent" FROM table_39056 WHERE "Surface" = 'hard' |
What runner-up has 2008 as the year? | CREATE TABLE table_name_95 (runner_up VARCHAR,year VARCHAR) | SELECT runner_up FROM table_name_95 WHERE year = "2008" |
What team was the Away team when the Tie no was 3? | CREATE TABLE table_42785 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" text) | SELECT "Away team" FROM table_42785 WHERE "Tie no" = '3' |
What is the date of entered service for the locomotive with a broad gauge and a serial no of 83-1018? | CREATE TABLE table_55815 ("Locomotive" text,"Serial No" text,"Entered service" text,"Gauge" text,"Livery" text) | SELECT "Entered service" FROM table_55815 WHERE "Gauge" = 'broad' AND "Serial No" = '83-1018' |
Name the sum of frequecy with brand of exa fm | CREATE TABLE table_68581 ("Frequency" real,"Callsign" text,"Brand" text,"Format" text,"City of License" text,"Website" text,"Webcast" text) | SELECT SUM("Frequency") FROM table_68581 WHERE "Brand" = 'exa fm' |
how many players tied for fourth place ? | CREATE TABLE table_203_134 (id number,"place" text,"player" text,"country" text,"score" text,"to par" number) | SELECT COUNT("player") FROM table_203_134 WHERE "place" = 4 |
Who appointed Judge Edward E. Cushman? | CREATE TABLE table_name_73 (appointed_by VARCHAR,judge VARCHAR) | SELECT appointed_by FROM table_name_73 WHERE judge = "edward e. cushman" |
Bar chart x axis country y axis the total number, and list by the total number from low to high. | CREATE TABLE perpetrator (Perpetrator_ID int,People_ID int,Date text,Year real,Location text,Country text,Killed int,Injured int)CREATE TABLE people (People_ID int,Name text,Height real,Weight real,"Home Town" text) | SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*) |
in a day before what was the temperature minimum value of patient 033-22108? | 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 cost (costid number,uniquepid text,patienthealthsystemstayid number,... | SELECT MIN(vitalperiodic.temperature) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-22108')) AND NOT vitalperiodic.temperature IS ... |
state the winnings of yates racing front row motorsports where poles were 0 | CREATE TABLE table_23555 ("Year" real,"Starts" real,"Wins" real,"Top 10" real,"Poles" real,"Avg. Start" text,"Avg. Finish" text,"Winnings" text,"Position" text,"Team(s)" text) | SELECT "Winnings" FROM table_23555 WHERE "Poles" = '0' AND "Team(s)" = 'Yates Racing Front Row Motorsports' |
What team has a Venue at Lake Oval? | CREATE TABLE table_53966 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Away team" FROM table_53966 WHERE "Venue" = 'lake oval' |
how many skaters had points greater than 2600 ? | CREATE TABLE table_204_291 (id number,"rank" number,"name" text,"nation" text,"cp" number,"fp" number,"points" number,"placings" number) | SELECT COUNT("name") FROM table_204_291 WHERE "points" > 2600 |
High rep through prolific bad answers. A list of the 100 above-30k users with the lowest average answer score excluding
community wiki / closed posts or users with less than 100 answers | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number... | SELECT Users.Id AS "user_link", Users.Reputation AS Reputation, COUNT(Posts.Id) AS Answers, CAST(AVG(CAST(Score AS FLOAT)) AS FLOAT(6, 2)) AS "average_answer_score" FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE PostTypeId = 2 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND Users.Reputation > 500... |
What's the duration of the Archers with Pauline Seville acting? | CREATE TABLE table_name_45 (duration VARCHAR,soap_opera VARCHAR,actor VARCHAR) | SELECT duration FROM table_name_45 WHERE soap_opera = "the archers" AND actor = "pauline seville" |
What was the average score for the couple that had 4 dances? | CREATE TABLE table_26236 ("Rank by Average" real,"Place" real,"Couple" text,"Total Points Earned" real,"Number of Dances" real,"Average" text) | SELECT "Average" FROM table_26236 WHERE "Number of Dances" = '4' |
Find users who offered the most bounties per post. | CREATE TABLE PostTypes (Id number,Name text)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 PostTags (PostId nu... | SELECT UserId AS "user_link", PostId AS "post_link", COUNT(*) AS Bounties FROM Votes WHERE VoteTypeId = 8 AND CreationDate >= '2011-09-09 11:00:00' GROUP BY UserId, PostId ORDER BY Bounties DESC |
What is the lowest Game, when Opponent is 'Boston Bruins'? | CREATE TABLE table_9971 ("Game" real,"March" real,"Opponent" text,"Score" text,"Record" text) | SELECT MIN("Game") FROM table_9971 WHERE "Opponent" = 'boston bruins' |
how many patients aged below 45 years have parenteral infusion of concentrated nutritional substances as the procedure long title? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "45" AND procedures.long_title = "Parenteral infusion of concentrated nutritional substances" |
Name the event 3 deadlift for hennie jordan | CREATE TABLE table_28540428_3 (event_3_deadlift VARCHAR,name VARCHAR) | SELECT event_3_deadlift FROM table_28540428_3 WHERE name = "Hennie Jordan" |
What is the rank of the reynard 2ki chassis before 2002? | CREATE TABLE table_name_50 (rank VARCHAR,year VARCHAR,chassis VARCHAR) | SELECT rank FROM table_name_50 WHERE year < 2002 AND chassis = "reynard 2ki" |
what is the number of patients whose diagnoses short title is fall on stair/step nec and drug route is buccal? | 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Fall on stair/step NEC" AND prescriptions.route = "BUCCAL" |
During the quarter 2012 Q4, how many millions of android phones were shipped? | CREATE TABLE table_972 ("Quarter" text,"Android" text,"iOS" text,"Symbian" text,"BlackBerry OS" text,"Linux" text,"Windows Phone" text,"Other" text,"Total" text) | SELECT COUNT("Android") FROM table_972 WHERE "Quarter" = '2012 Q4' |
Which NCAA Tournament Appearances have Conference Titles that are larger than 0, NCAA Titles of 0, and were coached by Lou Watson? | CREATE TABLE table_name_3 (ncaa_tourn_appearances VARCHAR,coach VARCHAR,conference_titles VARCHAR,ncaa_titles VARCHAR) | SELECT ncaa_tourn_appearances FROM table_name_3 WHERE conference_titles > "0" AND ncaa_titles = "0" AND coach = "lou watson" |
What is the result where the original artist is Prince and the Revolution? | CREATE TABLE table_27625 ("Episode" text,"Theme" text,"Song choice" text,"Original artist" text,"Order #" text,"Result" text) | SELECT "Result" FROM table_27625 WHERE "Original artist" = 'Prince and The Revolution' |
What are the characters and duration of actors? | CREATE TABLE actor (actor_id number,name text,musical_id number,character text,duration text,age number)CREATE TABLE musical (musical_id number,name text,year number,award text,category text,nominee text,result text) | SELECT character, duration FROM actor |
tell me the number of times they won . | CREATE TABLE table_204_933 (id number,"year" number,"competition" text,"date" text,"location" text,"opponent" text,"score" text,"result" text,"bye" text) | SELECT COUNT(*) FROM table_204_933 WHERE "result" = 'win' |
What is the 2004 that has a of grand slam tournaments in2006 ? | CREATE TABLE table_name_82 (Id VARCHAR) | SELECT 2004 FROM table_name_82 WHERE 2006 = "grand slam tournaments" |
What is the lowest Ovrs, when Wkts is greater than 13, and when Econ is less than 3.21? | CREATE TABLE table_8298 ("Player" text,"Wkts" real,"Runs" real,"Econ" real,"Ovrs" real) | SELECT MIN("Ovrs") FROM table_8298 WHERE "Wkts" > '13' AND "Econ" < '3.21' |
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of headquarter and the average of code , and group by attribute headquarter, could you sort y axis in ascending order? | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code |
Deep Learning over Time SO. | CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE Tags (Id number,TagName... | SELECT CAST(TIME_TO_STR(CreationDate, '%Y-%m-%d %H:%M:%S') AS TEXT(7)) AS "month", COUNT(*) AS "torch_count" FROM Posts AS p WHERE p.PostTypeId = 1 AND p.Tags LIKE '%<torch>%' GROUP BY CAST(TIME_TO_STR(CreationDate, '%Y-%m-%d %H:%M:%S') AS TEXT(7)) ORDER BY month |
count the number of patients for whom sennosides was prescribed within 2 months after they had been diagnosed with sepsis this year. | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,pat... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sepsis' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '... |
what are the top four prescribed drugs among patients with age 20s until 3 years ago? | 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 t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 20 AND 29) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY pres... |
Show all the information about election. | CREATE TABLE party (party_id number,year number,party text,governor text,lieutenant_governor text,comptroller text,attorney_general text,us_senate text)CREATE TABLE county (county_id number,county_name text,population number,zip_code text)CREATE TABLE election (election_id number,counties_represented text,district numb... | SELECT * FROM election |
What year was the Spanish Grand Prix where Emerson Fittipaldi drove? | CREATE TABLE table_67128 ("Year" real,"Event" text,"Venue" text,"Driver" text,"Result" text) | SELECT "Year" FROM table_67128 WHERE "Event" = 'spanish grand prix' AND "Driver" = 'emerson fittipaldi' |
What is the average number of laps for the driver Piero Taruffi? | CREATE TABLE table_57510 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT AVG("Laps") FROM table_57510 WHERE "Driver" = 'piero taruffi' |
For those employees who was hired before 2002-06-21, find job_id and the average of department_id , and group by attribute job_id, and visualize them by a bar chart, I want to display in ascending by the total number. | 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),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,... | SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID) |
What was the round for 29 January 1949, when the against was 1? | CREATE TABLE table_name_52 (round VARCHAR,against VARCHAR,date VARCHAR) | SELECT round FROM table_name_52 WHERE against = 1 AND date = "29 january 1949" |
What is the lowest overall amount of assists? | CREATE TABLE table_25016555_5 (assists INTEGER) | SELECT MIN(assists) FROM table_25016555_5 |
What is the name of the opponent for the Sutton tournament? | CREATE TABLE table_55200 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents" text,"Score" text) | SELECT "Opponents" FROM table_55200 WHERE "Tournament" = 'sutton' |
what is the number of players who have points less than 30 for each position?, show y axis from low to high order. | CREATE TABLE competition_result (Competition_ID int,Club_ID_1 int,Club_ID_2 int,Score text)CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE club_rank (Rank real,Club_ID int,Gold real,Silver real,Bronze real,Total real)CREATE TABLE competition (Competition_ID int,Year real,Competition_ty... | SELECT Position, COUNT(*) FROM player WHERE Points < 30 GROUP BY Position ORDER BY COUNT(*) |
How many total golds do teams have when the total medals is less than 1? | CREATE TABLE table_76572 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Gold") FROM table_76572 WHERE "Total" < '1' |
What is the high earnings for players with 34 events and over 2 wins? | CREATE TABLE table_55476 ("Rank" real,"Player" text,"Country" text,"Earnings ($)" real,"Events" real,"Wins" real) | SELECT MAX("Earnings ( $ )") FROM table_55476 WHERE "Events" = '34' AND "Wins" > '2' |
IN WHAT ISSUE OF PLAYBOY WAS SHEPARD SMITH INTERVIEWED? | CREATE TABLE table_20250 ("Date" text,"Cover model" text,"Centerfold model" text,"Interview subject" text,"20 Questions" text,"Pictorials" text) | SELECT "Date" FROM table_20250 WHERE "Interview subject" = 'Shepard Smith' |
What is the earliest year for 9 points? | CREATE TABLE table_name_79 (year INTEGER,points VARCHAR) | SELECT MIN(year) FROM table_name_79 WHERE points = 9 |
What was the earliest year for the Ligier Gitanes? | CREATE TABLE table_68427 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real) | SELECT MIN("Year") FROM table_68427 WHERE "Entrant" = 'ligier gitanes' |
What is the total attendance in a week less than 5 when the result was l 24-20? | CREATE TABLE table_name_16 (attendance VARCHAR,result VARCHAR,week VARCHAR) | SELECT COUNT(attendance) FROM table_name_16 WHERE result = "l 24-20" AND week < 5 |
what team won the friendly match | CREATE TABLE table_37593 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Result" FROM table_37593 WHERE "Competition" = 'friendly match' |
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by time, rank by the Y from low to high. | 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 job_history (EMPLOYEE_ID decimal(6,0),START_DA... | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(DEPARTMENT_ID) |
What was average attendance when total attendance was 541380? | CREATE TABLE table_74336 ("Team" text,"Stadium" text,"Home Games" real,"Average Attendance" real,"Total Attendance" real,"Capacity Percentage" text) | SELECT "Average Attendance" FROM table_74336 WHERE "Total Attendance" = '541380' |
all flights from WASHINGTON to SAN FRANCISCO leaving after 200 | CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time_elapsed int,to_airport varchar)CREATE TABLE days (days_code ... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time > 200 AND flight.to_airport = AIRPORT_SERVICE_1.... |
what types of ground transportation are there to SFO airport | CREATE TABLE time_interval (period text,begin_time int,end_time int)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)CREATE TABLE re... | SELECT DISTINCT ground_service.transport_type FROM airport, ground_service WHERE airport.airport_code = 'SFO' AND ground_service.airport_code = airport.airport_code |
Give me a pie to show how many home team from different home team. | CREATE TABLE stadium (id int,name text,Home_Games int,Average_Attendance real,Total_Attendance real,Capacity_Percentage real)CREATE TABLE game (stadium_id int,id int,Season int,Date text,Home_team text,Away_team text,Score text,Competition text)CREATE TABLE injury_accident (game_id int,id int,Player text,Injury text,Nu... | SELECT Home_team, COUNT(Home_team) FROM game GROUP BY Home_team |
what is the change in the bedside glucose of patient 007-1517's value last measured on the first hospital visit compared to the value second to last measured on the first hospital visit? | 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 (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 = '007-1517' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.