instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What series was Dick Johnson Racing the team? | CREATE TABLE table_name_8 (series VARCHAR,team VARCHAR) | SELECT series FROM table_name_8 WHERE team = "dick johnson racing" |
provide the number of patients whose lab test name is wbc? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "WBC" |
count the number of current patients whose age is in their 60 or above. | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL AND patient.age >= 60 |
Name the innings for 5088 runs scored | CREATE TABLE table_24406 ("Name" text,"Career" text,"Matches" real,"Innings" real,"Not Out" real,"Runs scored" real,"High Score" text,"50s" real,"100s" real,"Average" text) | SELECT COUNT("Innings") FROM table_24406 WHERE "Runs scored" = '5088' |
Which Incumbent has a District of California 8? | CREATE TABLE table_74881 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text) | SELECT "Incumbent" FROM table_74881 WHERE "District" = 'california 8' |
List the writers of the books in ascending alphabetical order. | CREATE TABLE publication (publication_id number,book_id number,publisher text,publication_date text,price number)CREATE TABLE book (book_id number,title text,issues number,writer text) | SELECT writer FROM book ORDER BY writer |
What is the lowest number of dances with a rank larger than 4 and a place of 8? | CREATE TABLE table_33274 ("Rank by average" real,"Place" real,"Couple" text,"Total points" real,"Number of dances" real,"Average" real) | SELECT MIN("Number of dances") FROM table_33274 WHERE "Rank by average" > '4' AND "Place" = '8' |
When westcott 1935 is in division two how many leagues are in division three? | CREATE TABLE table_26981 ("Season" text,"Premier Division" text,"Division One" text,"Division Two" text,"Division Three" text,"Division Four" text,"Division Five" text) | SELECT COUNT("Division Three") FROM table_26981 WHERE "Division Two" = 'Westcott 1935' |
What is the lowest nuber of games drawn in the total column? | CREATE TABLE table_name_31 (drawn INTEGER,against VARCHAR) | SELECT MIN(drawn) FROM table_name_31 WHERE against = "total" |
What dates did Ferrari win races? | CREATE TABLE table_name_40 (date VARCHAR,constructor VARCHAR) | SELECT date FROM table_name_40 WHERE constructor = "ferrari" |
when did patient 59941 come to the hospital for the last time until 2104 via an phys referral/normal deli? | CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE microbio... | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 59941 AND admissions.admission_location = 'phys referral/normal deli' AND STRFTIME('%y', admissions.admittime) <= '2104' ORDER BY admissions.admittime DESC LIMIT 1 |
What is the result of the 2005 (78th) year ceremony? | CREATE TABLE table_22073745_1 (result VARCHAR,year__ceremony_ VARCHAR) | SELECT result FROM table_22073745_1 WHERE year__ceremony_ = "2005 (78th)" |
give me the number of patients whose admission location is emergency room admit and procedure short title is closed biopsy of tongue? | 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 procedures (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.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Closed biopsy of tongue" |
in the last hospital encounter, has patient 013-29856 been given any diagnosis? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventi... | SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-29856' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.ho... |
calculate the difference between patient 28048's total input and the total output until 01/30/2104. | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value 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 inputevents_cv... | SELECT (SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28048)) AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) <= '2104-01-30') - (SEL... |
When 720 is the t c ( c) what is the h ci (ka/m)? | CREATE TABLE table_25390 ("Magnet" text,"B r (T)" text,"H ci (kA/m)" text,"(BH) max (kJ/m 3)" text,"T c (\u00b0C)" text) | SELECT "H ci (kA/m)" FROM table_25390 WHERE "T c (\u00b0C)" = '720' |
Give me the comparison about the average of Weight over the Sex , and group by attribute Sex by a bar chart, I want to sort X in ascending order. | CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real) | SELECT Sex, AVG(Weight) FROM people GROUP BY Sex ORDER BY Sex |
what is the number of cylinders that a 5/9 ps has ? | CREATE TABLE table_204_108 (id number,"typ" text,"construction time" text,"cylinders" text,"capacity" text,"power" text,"top speed" text) | SELECT "cylinders" FROM table_204_108 WHERE "typ" = '5/9 ps' |
What is the average gold medals Uzbekistan, which has less than 24 total medals, has? | CREATE TABLE table_53222 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Gold") FROM table_53222 WHERE "Nation" = 'uzbekistan' AND "Total" < '24' |
what does patient 49578 have to pay for the hospital stay in their first hospital visit? | CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,ite... | SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49578 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) |
Which Ship has a Year larger than 2013? | CREATE TABLE table_name_54 (ship VARCHAR,year INTEGER) | SELECT ship FROM table_name_54 WHERE year > 2013 |
What is High Points, when High Rebounds is 'Dwight Howard (16)'? | CREATE TABLE table_name_8 (high_points VARCHAR,high_rebounds VARCHAR) | SELECT high_points FROM table_name_8 WHERE high_rebounds = "dwight howard (16)" |
On what Week was the Result W 17-14? | CREATE TABLE table_name_4 (week INTEGER,result VARCHAR) | SELECT AVG(week) FROM table_name_4 WHERE result = "w 17-14" |
what are the three most commonly ordered lab tests for patients that had previously received intracranial/cerebral perfusion pressure monitoring - ventriculostomy within 2 months during the last year? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,t... | SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'intracranial/cerebral perfusion pressure monitoring ... |
Who was the opponent for the game played with 54,136 people in attendance? | CREATE TABLE table_36023 ("Date" text,"Time" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" text,"Record" text) | SELECT "Opponent" FROM table_36023 WHERE "Attendance" = '54,136' |
How many total credits are offered by each department. Show bar chart. | CREATE TABLE classroom (building varchar(15),room_number varchar(7),capacity numeric(4,0))CREATE TABLE time_slot (time_slot_id varchar(4),day varchar(1),start_hr numeric(2),start_min numeric(2),end_hr numeric(2),end_min numeric(2))CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar... | SELECT dept_name, SUM(credits) FROM course GROUP BY dept_name |
what country is in draw 17 ? | CREATE TABLE table_204_809 (id number,"draw" number,"country" text,"language" text,"artist" text,"song" text,"english translation" text,"national final" text,"place" number,"points" number) | SELECT "country" FROM table_204_809 WHERE "draw" = 17 |
What the name of Peter White's party? | CREATE TABLE table_71585 ("Member" text,"Party" text,"Electorate" text,"State" text,"Term in office" text) | SELECT "Party" FROM table_71585 WHERE "Member" = 'peter white' |
what are patient 13703's arterial bp [diastolic] differences second measured on the first intensive care unit visit compared to the value first measured on the first intensive care unit visit? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status ... | SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13703) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.item... |
What was the ratings for episode 11? | CREATE TABLE table_26591434_1 (ratings__kanto_ VARCHAR,episode VARCHAR) | SELECT ratings__kanto_ FROM table_26591434_1 WHERE episode = 11 |
provide the number of patients whose diagnoses short title is polycythemia vera and drug type is main? | 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 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 = "Polycythemia vera" AND prescriptions.drug_type = "MAIN" |
Where did North Melbourne play as the home team? | CREATE TABLE table_name_25 (venue VARCHAR,home_team VARCHAR) | SELECT venue FROM table_name_25 WHERE home_team = "north melbourne" |
If the representative is Dave Hall, when was the term limited? | CREATE TABLE table_26131768_4 (term_limited VARCHAR,representative VARCHAR) | SELECT term_limited FROM table_26131768_4 WHERE representative = "Dave Hall" |
What is the total number drawn with goals against less than 55, and a total of 14 losses? | CREATE TABLE table_79099 ("Position" real,"Team" text,"Played" real,"Drawn" real,"Lost" real,"Goals For" real,"Goals Against" real,"Goal Difference" text,"Points 1" real) | SELECT COUNT("Drawn") FROM table_79099 WHERE "Goals Against" < '55' AND "Lost" = '14' |
Average score for accepted post. | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)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 Badges (Id number,UserId number,Name text,Date ti... | SELECT AVG(Score) AS avg_score, Id FROM Posts WHERE PostTypeId = 2 GROUP BY Id ORDER BY avg_score DESC |
count the number of patients whose admission type is emergency and diagnoses short title is malig neo tongue nec? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.short_title = "Malig neo tongue NEC" |
What is the 3utr sequence when the genbank id is hq021437? | CREATE TABLE table_14332822_1 (genbank_id VARCHAR) | SELECT 3 AS ’utr_sequence FROM table_14332822_1 WHERE genbank_id = "HQ021437" |
what is the new prescriptions of patient 17462 today compared to the prescriptions yesterday? | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value 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 inputevents_cv... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17462) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE... |
the first person to finish in heat 1 ? | CREATE TABLE table_204_401 (id number,"rank" number,"lane" number,"name" text,"nationality" text,"react" number,"time" number,"notes" text) | SELECT "name" FROM table_204_401 WHERE "rank" = 1 |
Where was the UFC 154 match held? | CREATE TABLE table_name_18 (location VARCHAR,event VARCHAR) | SELECT location FROM table_name_18 WHERE event = "ufc 154" |
For Amazon.com's device with a weight of 221g (7.8oz) how many screen pixels does the device have? | CREATE TABLE table_name_66 (screen_pixels VARCHAR,maker VARCHAR,weight VARCHAR) | SELECT screen_pixels FROM table_name_66 WHERE maker = "amazon.com" AND weight = "221g (7.8oz)" |
For the week 1 show and order 2, what was the theme? | CREATE TABLE table_name_59 (theme VARCHAR,show VARCHAR,order VARCHAR) | SELECT theme FROM table_name_59 WHERE show = "week 1" AND order = "2" |
What is Date, when High Rebounds is 'Amar'e Stoudemire (13)'? | CREATE TABLE table_44933 ("Game" real,"Date" text,"Team" text,"Score" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Date" FROM table_44933 WHERE "High rebounds" = 'amar''e stoudemire (13)' |
What is the total number of wins with 10 cuts made and a score average under 74.09? | CREATE TABLE table_name_52 (wins VARCHAR,cuts_made VARCHAR,scoring_average VARCHAR) | SELECT COUNT(wins) FROM table_name_52 WHERE cuts_made = 10 AND scoring_average < 74.09 |
What is K236AM's lowest frequency in MHz? | CREATE TABLE table_39417 ("Call sign" text,"Frequency MHz" real,"City of license" text,"ERP W" real,"Class" text,"FCC info" text) | SELECT MIN("Frequency MHz") FROM table_39417 WHERE "Call sign" = 'k236am' |
Which people severed as comptroller most frequently? Give me the name of the person and the frequency count. | CREATE TABLE election (election_id number,counties_represented text,district number,delegate text,party number,first_elected number,committee text)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 (... | SELECT comptroller, COUNT(*) FROM party GROUP BY comptroller ORDER BY COUNT(*) DESC LIMIT 1 |
what flights from SEATTLE to SALT LAKE CITY | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_spe... | 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 = 'SEATTLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SALT L... |
When was the ensemble closed that went on air in June 2003? | CREATE TABLE table_4488 ("Region" text,"Operator" text,"Licence award date" text,"On air date" text,"Closure date" text) | SELECT "Closure date" FROM table_4488 WHERE "On air date" = 'june 2003' |
For those records from the products and each product's manufacturer, give me the comparison about the sum of price over the name , and group by attribute name, and list by the total number in descending. | 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 T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Price DESC |
what is the number of patients whose marital status is widowed and procedure long title is spinal tap? | 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 = "WIDOWED" AND procedures.long_title = "Spinal tap" |
Who wrote 'Academic Octathalon'? | CREATE TABLE table_22607 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text) | SELECT "Written by" FROM table_22607 WHERE "Title" = 'Academic Octathalon' |
Name the qual for year of 1960 | CREATE TABLE table_name_25 (qual VARCHAR,year VARCHAR) | SELECT qual FROM table_name_25 WHERE year = "1960" |
Most popular tags since 2012 started.. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE Users (Id number,Reputation number,Creati... | SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS MayRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AN... |
A bar chart about how films are produced by each studio?, and show Y-axis in asc order. | CREATE TABLE film_market_estimation (Estimation_ID int,Low_Estimate real,High_Estimate real,Film_ID int,Type text,Market_ID int,Year int)CREATE TABLE market (Market_ID int,Country text,Number_cities int)CREATE TABLE film (Film_ID int,Title text,Studio text,Director text,Gross_in_dollar int) | SELECT Studio, COUNT(*) FROM film GROUP BY Studio ORDER BY COUNT(*) |
What is the status of the county with per capita market income of $24,326? | CREATE TABLE table_73447 ("County" text,"Population" real,"Unemployment Rate" text,"Market Income Per Capita" text,"Poverty Rate" text,"Status" text) | SELECT "Status" FROM table_73447 WHERE "Market Income Per Capita" = '$24,326' |
What is the highest grid that has 55 laps? | CREATE TABLE table_name_1 (grid INTEGER,laps VARCHAR) | SELECT MAX(grid) FROM table_name_1 WHERE laps = 55 |
For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars. | CREATE TABLE rating (rid number,mid number,stars number,ratingdate time)CREATE TABLE movie (mid number,title text,year number,director text)CREATE TABLE reviewer (rid number,name text) | SELECT DISTINCT T3.name, T2.title, T1.stars FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid JOIN reviewer AS T3 ON T1.rid = T3.rid WHERE T2.director = T3.name |
how many patients less than 72 years of age have midazbase drug code? | 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 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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "72" AND prescriptions.formulary_drug_cd = "MIDAZBASE" |
were there any results of the microbiology tests for patient 24921 in 09/last year? | CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,... | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24921) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', microbiologyevents.chartti... |
What was the winning score when the runner-up was Beth Daniel and the margin of victory was 7 strokes? | CREATE TABLE table_name_42 (winning_score VARCHAR,runner_s__up VARCHAR,margin_of_victory VARCHAR) | SELECT winning_score FROM table_name_42 WHERE runner_s__up = "beth daniel" AND margin_of_victory = "7 strokes" |
Owners of the most yearling badges. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,... | SELECT Users.Id AS "user_link", Users.Id, Users.Reputation, COUNT(*) OVER (PARTITION BY Users.Id) AS Count, Badges.Date FROM Badges, Users WHERE Badges.Name = 'Yearling' AND Badges.UserId = Users.Id ORDER BY Count DESC, Users.Reputation, Users.Id, Badges.Date |
where did camerin win singles after cagnes sur mer ? | CREATE TABLE table_204_562 (id number,"no." number,"date" text,"location" text,"surface" text,"opponent in final" text,"score" text) | SELECT "location" FROM table_204_562 WHERE "date" > (SELECT "date" FROM table_204_562 WHERE "location" = 'cagnes-sur-mer, france $100,000') ORDER BY "date" LIMIT 1 |
Bar chart x axis dept code y axis minimal stu gpa, I want to rank in ascending by the y axis. | 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 COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE EMPLOYEE (EMP_NUM int,EMP_LNAME varchar(... | SELECT DEPT_CODE, MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE ORDER BY MIN(STU_GPA) |
What won best pc intro when my kingdom (haujobb & scoopex) won best amiga demo? | CREATE TABLE table_2490289_1 (pc_intro VARCHAR,amiga_demo VARCHAR) | SELECT pc_intro FROM table_2490289_1 WHERE amiga_demo = "My Kingdom (Haujobb & Scoopex)" |
Who was the runner-up for the event that ended with a winning score of 15 (66-67-70-70=273)? | CREATE TABLE table_70470 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text) | SELECT "Runner(s)-up" FROM table_70470 WHERE "Winning score" = '–15 (66-67-70-70=273)' |
How many grids had more than 61 laps? | CREATE TABLE table_name_9 (grid INTEGER,laps INTEGER) | SELECT SUM(grid) FROM table_name_9 WHERE laps > 61 |
Who's the Communist ticket with an American Labor ticket of joseph v. o'leary? | CREATE TABLE table_40850 ("Republican ticket" text,"Democratic ticket" text,"American Labor ticket" text,"Communist ticket" text,"Socialist ticket" text) | SELECT "Communist ticket" FROM table_40850 WHERE "American Labor ticket" = 'joseph v. o''leary' |
How many nationalities does Tom Colley have? | CREATE TABLE table_23126 ("Pick #" real,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text) | SELECT COUNT("Nationality") FROM table_23126 WHERE "Player" = 'Tom Colley' |
what is the average age of patients with white ethnicity and admitted in or after 2115? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.admityear >= "2115" |
How many first downs were there when the attendance was 13196? | CREATE TABLE table_14877831_2 (first_downs INTEGER,attendance VARCHAR) | SELECT MIN(first_downs) FROM table_14877831_2 WHERE attendance = 13196 |
What is the sum of all points when number played is less than 18? | CREATE TABLE table_name_40 (points INTEGER,played INTEGER) | SELECT SUM(points) FROM table_name_40 WHERE played < 18 |
What round was adelaide united the opposition with an attendance of 18,345? | CREATE TABLE table_name_32 (round VARCHAR,opposition VARCHAR,attendance VARCHAR) | SELECT round FROM table_name_32 WHERE opposition = "adelaide united" AND attendance = "18,345" |
Game site of shea stadium, and a Week smaller than 10, and a Opponent of baltimore colts happened on what date? | CREATE TABLE table_6223 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Game site" text,"Attendance" real) | SELECT "Date" FROM table_6223 WHERE "Game site" = 'shea stadium' AND "Week" < '10' AND "Opponent" = 'baltimore colts' |
When the game was played at the Venue of Lake Oval, what was the home team score? | CREATE TABLE table_11471 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team score" FROM table_11471 WHERE "Venue" = 'lake oval' |
If the class is total, what is the total number of podiums? | CREATE TABLE table_name_93 (podiums VARCHAR,class VARCHAR) | SELECT COUNT(podiums) FROM table_name_93 WHERE class = "total" |
Which team has a qualifying 2 time under 59.612 and a best of 59.14? | CREATE TABLE table_name_58 (team VARCHAR,qual_2 VARCHAR,best VARCHAR) | SELECT team FROM table_name_58 WHERE qual_2 < 59.612 AND best = 59.14 |
What is Jay Bruce's hometown? | CREATE TABLE table_11677100_11 (hometown VARCHAR,player VARCHAR) | SELECT hometown FROM table_11677100_11 WHERE player = "Jay Bruce" |
how many patients whose death status is 1 and drug name is levofloxacin? | 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.expire_flag = "1" AND prescriptions.drug = "Levofloxacin" |
how many wins did pitcher jon matlack category:articles with hcards achieve | CREATE TABLE table_19864214_3 (wins VARCHAR,pitcher VARCHAR) | SELECT COUNT(wins) FROM table_19864214_3 WHERE pitcher = "Jon Matlack Category:Articles with hCards" |
What was Week 15 when Week 12 was Washington (9-1)? | CREATE TABLE table_58979 ("Week 9 Oct 23" text,"Week 10 Oct 30" text,"Week 11 Nov 6" text,"Week 12 Nov 13" text,"Week 13 Nov 20" text,"Week 14 Nov 27" text,"Week 15 (Final) Dec 3" text) | SELECT "Week 15 (Final) Dec 3" FROM table_58979 WHERE "Week 12 Nov 13" = 'washington (9-1)' |
What is the result from 2003 from the US Open? | CREATE TABLE table_41429 ("Tournament" text,"2003" text,"2004" text,"2012" text,"2013" text) | SELECT "2003" FROM table_41429 WHERE "Tournament" = 'us open' |
What is the status of the pterosaur named Cathayopterus? | CREATE TABLE table_40089 ("Name" text,"Status" text,"Authors" text,"Unit" text,"Location" text) | SELECT "Status" FROM table_40089 WHERE "Name" = 'cathayopterus' |
When was the game with a record of 9-3? | CREATE TABLE table_39692 ("Date" text,"Opponent" text,"Result" text,"Game site" text,"Game time" text,"Record" text) | SELECT "Date" FROM table_39692 WHERE "Record" = '9-3' |
How many snatches were there with a total of 267.5? | CREATE TABLE table_78258 ("Athlete" text,"Event" text,"Snatch" real,"Clean & Jerk" real,"Total" real) | SELECT COUNT("Snatch") FROM table_78258 WHERE "Total" < '267.5' |
what number of patients whose admission type is elective were born before the year 2078? | 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 WHERE demographic.admission_type = "ELECTIVE" AND demographic.dob_year < "2078" |
How many images have been uploaded to the site?. Counts the number of posts containing images hosted by imgur.com after image uploading was implemented on the site. | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTask... | WITH c AS (SELECT OwnerUserId, Body, 1 AS t FROM Posts WHERE CreationDate >= 'August 13, 2010') SELECT OwnerUserId AS "user_link", SUM(t) AS Count FROM c WHERE Body LIKE '%imgur.com%' GROUP BY OwnerUserId WITH ROLLUP ORDER BY SUM(t) DESC |
What is the average number of electorates (2003) reserved for sc with a constituency number of 50? | CREATE TABLE table_64041 ("Constituency number" text,"Name" text,"Reserved for (SC / ST /None)" text,"District" text,"Number of electorates (2003)" real) | SELECT AVG("Number of electorates (2003)") FROM table_64041 WHERE "Reserved for ( SC / ST /None)" = 'sc' AND "Constituency number" = '50' |
how many days has it been since the last time patient 027-149724 stayed on this hospital visit in the ward 957? | CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim... | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '027-149724' AND patient.wardid = 957 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1 |
Which Score has an Attendance larger than 16,851, and an Away team of sheffield united? | CREATE TABLE table_61414 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" real) | SELECT "Score" FROM table_61414 WHERE "Attendance" > '16,851' AND "Away team" = 'sheffield united' |
serum calcium > 10.5 mg / dl | CREATE TABLE table_train_210 ("id" int,"serum_potassium" float,"serum_calcium" float,"estimated_glomerular_filtration_rate_egfr" int,"body_mass_index_bmi" float,"age" float,"NOUSE" float) | SELECT * FROM table_train_210 WHERE serum_calcium > 10.5 |
Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts with a pie chart. | CREATE TABLE Apartment_Buildings (building_id INTEGER,building_short_name CHAR(15),building_full_name VARCHAR(80),building_description VARCHAR(255),building_address VARCHAR(255),building_manager VARCHAR(50),building_phone VARCHAR(80))CREATE TABLE Apartments (apt_id INTEGER,building_id INTEGER,apt_type_code CHAR(15),apt... | SELECT gender_code, COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC |
What was the H/A when the scorer was Hughes? | CREATE TABLE table_47944 ("Date" text,"Opponents" text,"H / A" text,"Result F \u2013 A" text,"Scorers" text) | SELECT "H / A" FROM table_47944 WHERE "Scorers" = 'hughes' |
What is Tournament, when Outcome is Winner, and when Date is 13 July 2013? | CREATE TABLE table_44801 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text) | SELECT "Tournament" FROM table_44801 WHERE "Outcome" = 'winner' AND "Date" = '13 july 2013' |
What was the result of the game when the raptors played @ cleveland? | CREATE TABLE table_17291 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Score" FROM table_17291 WHERE "Team" = '@ Cleveland' |
count the number of patients whose insurance is self pay and lab test name is rbc, csf? | 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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Self Pay" AND lab.label = "RBC, CSF" |
Give me a pie chart showing the number of engineers for different skill description, and display skill_description in descending order. | CREATE TABLE Fault_Log_Parts (fault_log_entry_id INTEGER,part_fault_id INTEGER,fault_status VARCHAR(10))CREATE TABLE Fault_Log (fault_log_entry_id INTEGER,asset_id INTEGER,recorded_by_staff_id INTEGER,fault_log_entry_datetime DATETIME,fault_description VARCHAR(255),other_fault_details VARCHAR(255))CREATE TABLE Engineer... | SELECT skill_description, COUNT(skill_description) FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY skill_description ORDER BY skill_description DESC |
In what division was there a population density in km2 of 4,491.8 in 2011? | CREATE TABLE table_24027047_1 (administrative_division VARCHAR,population_density___km²_2011_ VARCHAR) | SELECT administrative_division FROM table_24027047_1 WHERE population_density___km²_2011_ = "4,491.8" |
What is the most silver medals when the total is less than 4 and the rank is 12? | CREATE TABLE table_43126 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT MAX("Silver") FROM table_43126 WHERE "Total" < '4' AND "Rank" = '12' |
what are the top five most frequent diagnoses in 2104 that patients were diagnosed with within the same month after having been diagnosed with hx of thyroid malignancy? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE microbiologyevents (row_id number,subject_id number,had... | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions... |
What is the highest number of laps with a time of +6.643 and grid less than 2? | CREATE TABLE table_name_58 (laps INTEGER,time_retired VARCHAR,grid VARCHAR) | SELECT MAX(laps) FROM table_name_58 WHERE time_retired = "+6.643" AND grid < 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.