instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Create a bar chart showing how many location across location | CREATE TABLE stock (Shop_ID int,Device_ID int,Quantity int)CREATE TABLE device (Device_ID int,Device text,Carrier text,Package_Version text,Applications text,Software_Platform text)CREATE TABLE shop (Shop_ID int,Shop_Name text,Location text,Open_Date text,Open_Year int) | SELECT Location, COUNT(Location) FROM shop GROUP BY Location |
DBA - Total Posts by Database Server Per Month - MongoDB. | 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 PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate ... | SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'MongoDB' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'mongodb%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER B... |
Name the launch date for vladimir lyakhov , aleksandr pavlovich aleksandrov | CREATE TABLE table_245801_1 (launch_date VARCHAR,crew VARCHAR) | SELECT launch_date FROM table_245801_1 WHERE crew = "Vladimir Lyakhov , Aleksandr Pavlovich Aleksandrov" |
When has an Opponent of at Seattle mariners? | CREATE TABLE table_38927 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Save" text) | SELECT "Date" FROM table_38927 WHERE "Opponent" = 'at seattle mariners' |
How many different services are provided by all stations? | CREATE TABLE station (id number,network_name text,services text,local_authority text)CREATE TABLE train (id number,train_number number,name text,origin text,destination text,time text,interval text)CREATE TABLE weekly_weather (station_id number,day_of_week text,high_temperature number,low_temperature number,precipitati... | SELECT COUNT(DISTINCT services) FROM station |
The common of Chieri has what population density? | CREATE TABLE table_1449176_1 (density__inhabitants_km_2__ VARCHAR,common_of VARCHAR) | SELECT density__inhabitants_km_2__ FROM table_1449176_1 WHERE common_of = "Chieri" |
What is the largest Area (msr) that has an Area less than 291.045, is part of the Per family, and has a rank higher than 78? | CREATE TABLE table_12824 ("Rank" real,"Family" text,"Abbre\u00adviation" text,"Constellation" text,"Area (sq.deg.)" real,"Area (msr)" real,"Per\u00adcent\u00adage" text,"Right ascension (hm)" real,"Decli\u00adnation (dm)" text,"Quad" text) | SELECT MAX("Area (msr)") FROM table_12824 WHERE "Area (sq.deg.)" < '291.045' AND "Family" = 'per' AND "Rank" > '78' |
What team has 137 points? | CREATE TABLE table_25318033_1 (team VARCHAR,points VARCHAR) | SELECT team FROM table_25318033_1 WHERE points = "137" |
What is the Attendance on august 15? | CREATE TABLE table_name_99 (attendance VARCHAR,date VARCHAR) | SELECT attendance FROM table_name_99 WHERE date = "august 15" |
What is the total of the game that the team was @ new york? | CREATE TABLE table_44155 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT COUNT("Game") FROM table_44155 WHERE "Team" = '@ new york' |
how many patients aged below 56 years had bowel obstruction as the primary disease? | 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 text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BOWEL OBSTRUCTION" AND demographic.age < "56" |
What is the time with FB notes for Canada? | CREATE TABLE table_name_43 (time VARCHAR,notes VARCHAR,country VARCHAR) | SELECT time FROM table_name_43 WHERE notes = "fb" AND country = "canada" |
how many black/haitian patients had the drug route ed? | 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 procedures (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND prescriptions.route = "ED" |
find the names of people who are taller than 200 or lower than 190. | CREATE TABLE candidate (candidate_id number,people_id number,poll_source text,date text,support_rate number,consider_rate number,oppose_rate number,unsure_rate number)CREATE TABLE people (people_id number,sex text,name text,date_of_birth text,height number,weight number) | SELECT name FROM people WHERE height > 200 OR height < 190 |
what is the number of patients whose gender is m and insurance is government? | 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,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.insurance = "Government" |
WHAT NAME HAS A FREE TRANSFER FREE AND RETIRED? | CREATE TABLE table_59699 ("Nat." text,"Name" text,"Moving to" text,"Type" text,"Transfer window" text,"Transfer fee" text,"Source" text) | SELECT "Name" FROM table_59699 WHERE "Transfer fee" = 'free' AND "Moving to" = 'retired' |
What was the score on 1/10/1974? | CREATE TABLE table_79682 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Record" text) | SELECT "Score" FROM table_79682 WHERE "Date" = '1/10/1974' |
Tell me the total quantity of products bought by the customer called 'Rodrick Heaney'. | CREATE TABLE products (product_id number,product_details text)CREATE TABLE customer_addresses (customer_id number,address_id number,date_address_from time,address_type text,date_address_to time)CREATE TABLE customers (customer_id number,payment_method text,customer_name text,date_became_customer time,other_customer_det... | SELECT SUM(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney" |
What was the record when Vancouver was the visitor? | CREATE TABLE table_name_9 (record VARCHAR,visitor VARCHAR) | SELECT record FROM table_name_9 WHERE visitor = "vancouver" |
Name the june when it has july of 84 f / 28.9 c | CREATE TABLE table_name_28 (jun VARCHAR,jul VARCHAR) | SELECT jun FROM table_name_28 WHERE jul = "84 °f / 28.9 °c" |
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, find hire_date and the average of salary bin hire_date by weekday, and visualize them by a bar chart, I want to order in asc by the Y-axis. | 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 locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12... | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(SALARY) |
Count the number of divorced patients who had tacrofk lab tests done. | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "tacroFK" |
what is average age of patients whose primary disease is aortic insufficiency\re-do sternotomy; aortic valve replacement and days of hospital stay is 10? | 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 AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND demographic.days_stay = "10" |
Which winning driver of the Roussillon Grand Prix had an Alfa Romeo? | CREATE TABLE table_32875 ("Name" text,"Circuit" text,"Date" text,"Winning driver" text,"Winning constructor" text,"Report" text) | SELECT "Winning driver" FROM table_32875 WHERE "Winning constructor" = 'alfa romeo' AND "Name" = 'roussillon grand prix' |
What is the Purpose of the Callsign with a Freq currently of 4gld? | CREATE TABLE table_50345 ("Callsign" text,"Area served" text,"Band" text,"Freq currently" text,"Purpose" text) | SELECT "Purpose" FROM table_50345 WHERE "Freq currently" = '4gld' |
Number of users created per month. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body te... | SELECT * FROM Users LIMIT 10 |
What is the 1st leg of the team with a 2-1 agg.? | CREATE TABLE table_6141 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text) | SELECT "1st leg" FROM table_6141 WHERE "Agg." = '2-1' |
top 10 users by post score. | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate ti... | SELECT Users.Id AS "user_link", MAX(Age) AS Age, MAX(Location) AS Location, MAX(WebsiteUrl) AS Website, MAX(Reputation) AS Rep, COUNT(Answers.Id) AS Answers, SUM(Answers.Score) AS Score, CAST(AVG(CAST(Answers.Score AS FLOAT)) AS FLOAT(6, 1)) AS "avg" FROM Tags JOIN PostTags ON PostTags.TagId = Tags.Id JOIN Posts ON Pos... |
What are all the the participant ids, type code and details? | CREATE TABLE participants (participant_id number,participant_type_code text,participant_details text)CREATE TABLE services (service_id number,service_type_code text)CREATE TABLE events (event_id number,service_id number,event_details text)CREATE TABLE participants_in_events (event_id number,participant_id number) | SELECT participant_id, participant_type_code, participant_details FROM participants |
when was patient 015-52724 last prescribed both lorazepam and methylprednisolone at the same time since 54 months ago? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE cost (costid number,uniquepid text,patientheal... | SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'lorazepam' AND patient.uniquepid = '015-52724' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-54 mo... |
In what district was the representative first elected in 1916? | CREATE TABLE table_1342370_10 (district VARCHAR,first_elected VARCHAR) | SELECT district FROM table_1342370_10 WHERE first_elected = 1916 |
What is the party for the representative who was first elected before 2002 and the results were re-elected? | CREATE TABLE table_61823 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text) | SELECT "Party" FROM table_61823 WHERE "Results" = 're-elected' AND "First elected" < '2002' |
What time in eastern standard time was game held at denver broncos? | CREATE TABLE table_14433719_1 (time___et__ VARCHAR,opponent VARCHAR) | SELECT time___et__ FROM table_14433719_1 WHERE opponent = "at Denver Broncos" |
Which margin of defeats had points of 30? | CREATE TABLE table_10753917_1 (margin_of_defeat VARCHAR,points VARCHAR) | SELECT margin_of_defeat FROM table_10753917_1 WHERE points = "30" |
Questions with No accepted answer where I have the highest score. | 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 Votes (Id number,PostId number,VoteTypeId number,UserId number,... | SELECT q.Id AS "post_link" FROM Posts AS a INNER JOIN Posts AS q ON q.Id = a.ParentId WHERE a.OwnerUserId = '##UserID##' AND (SELECT MAX(p.Score) FROM Posts AS p WHERE p.ParentId = q.Id AND p.Id != a.Id) < a.Score ORDER BY q.ViewCount DESC |
Which DOB has a Surname of cresswell? | CREATE TABLE table_name_40 (dob VARCHAR,surname VARCHAR) | SELECT dob FROM table_name_40 WHERE surname = "cresswell" |
How many season premieres had 15.27 million viewers? | CREATE TABLE table_29636 ("Season" text,"Episodes" real,"Timeslot (EST)" text,"Season premiere" text,"Season finale" text,"TV season" text,"Rank" text,"Viewers (in millions)" text) | SELECT COUNT("Season premiere") FROM table_29636 WHERE "Viewers (in millions)" = '15.27' |
how many patients since 2105 have received a sputum, tracheal specimen microbiological test? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE allergy (... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y', microlab.culturetakentime) >= '2105') |
Which County has a Mascot of pacers? | CREATE TABLE table_name_36 (county VARCHAR,mascot VARCHAR) | SELECT county FROM table_name_36 WHERE mascot = "pacers" |
when was patient 20693's first operation since 3 years ago? | 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 d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id numbe... | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20693) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY procedures_icd.charttime LIMIT 1 |
During st kilda's home game, what was the number of people in the crowd? | CREATE TABLE table_78481 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Crowd" FROM table_78481 WHERE "Home team" = 'st kilda' |
Automation Test Engineer - Lisbon. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE PostHis... | SELECT u.Id AS "user_link", CONCAT('https://stackoverflow.com/users/', u.Id) AS "profile_link", u.DisplayName, u.Location, u.WebsiteUrl, u.AboutMe, u.Views, u.UpVotes, u.DownVotes FROM Users AS u JOIN (SELECT DISTINCT UserId FROM Badges WHERE LOWER(Name) IN ('android-espresso') AND Class IN (1, 2, 3) AND TagBased = 1) ... |
What is the lowest Gold, when Silver is 0, and when Bronze is 2? | CREATE TABLE table_50302 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT MIN("Gold") FROM table_50302 WHERE "Silver" = '0' AND "Bronze" = '2' |
What percentage of people polled aligned with the Liberal party according to the August 2008 poll that reported 36% aligning with New Democratic party? | CREATE TABLE table_14045 ("Polling firm" text,"Dates" text,"Prog. Cons." text,"New Democratic" text,"Liberal" text) | SELECT "Liberal" FROM table_14045 WHERE "New Democratic" = '36%' AND "Dates" = 'august 2008' |
Name the number of clock rate mhz when bandwidth mb/s is 2400 | CREATE TABLE table_142573_1 (clock_rate__mhz_ VARCHAR,bandwidth__mb_s_ VARCHAR) | SELECT COUNT(clock_rate__mhz_) FROM table_142573_1 WHERE bandwidth__mb_s_ = 2400 |
Currently Protected Questions, simple search. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTy... | SELECT ph.PostId AS "post_link", ph.CreationDate AS "protected_date", CASE ph.UserId WHEN NULL THEN ph.UserDisplayName ELSE ph.UserId END AS "user_link" FROM PostHistory AS ph WHERE ph.PostHistoryTypeId = 19 ORDER BY ph.PostId, ph.CreationDate |
What district was the city with an area smaller than 12 square kilometers and a serial number of 35? | CREATE TABLE table_64012 ("Serial No." real,"District" text,"Headquartered City" text,"City Population (2009)" real,"City Area(km 2)" real) | SELECT "District" FROM table_64012 WHERE "City Area(km 2 )" < '12' AND "Serial No." = '35' |
How many races were in the Mallala Motor Sport Park circuit? | CREATE TABLE table_70335 ("Race" real,"Circuit" text,"Location / State" text,"Date" text,"Winner" text,"Team" text) | SELECT COUNT("Race") FROM table_70335 WHERE "Circuit" = 'mallala motor sport park' |
Return a bar chart about the number of companies for each industry. | CREATE TABLE company (Company_ID real,Name text,Headquarters text,Industry text,Sales_in_Billion real,Profits_in_Billion real,Assets_in_Billion real,Market_Value_in_Billion real)CREATE TABLE people (People_ID int,Age int,Name text,Nationality text,Graduation_College text)CREATE TABLE employment (Company_ID int,People_I... | SELECT Industry, COUNT(Industry) FROM company GROUP BY Industry |
The distribution of answerer's reputation over the most recent N answers. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPo... | SELECT q.Id, q.CreationDate, u.Reputation FROM Posts AS q INNER JOIN Users AS u ON u.Id = q.OwnerUserId WHERE q.PostTypeId = 2 ORDER BY q.CreationDate DESC LIMIT 100 |
A bar chart about how many captains are in each rank?, and could you order by the X-axis from high to low? | CREATE TABLE captain (Captain_ID int,Name text,Ship_ID int,age text,Class text,Rank text)CREATE TABLE Ship (Ship_ID int,Name text,Type text,Built_Year real,Class text,Flag text) | SELECT Rank, COUNT(*) FROM captain GROUP BY Rank ORDER BY Rank DESC |
What is Date, when Label is Jugoton? | CREATE TABLE table_47955 ("Date" text,"Region" text,"Label" text,"Catalogue" text,"Format" text) | SELECT "Date" FROM table_47955 WHERE "Label" = 'jugoton' |
What is the Tie no when Swansea City is the Away team with a Score of 2 2? | CREATE TABLE table_61081 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Tie no" FROM table_61081 WHERE "Score" = '2–2' AND "Away team" = 'swansea city' |
how many more passengers flew to los angeles than to saskatoon from manzanillo airport in 2013 ? | CREATE TABLE table_203_515 (id number,"rank" number,"city" text,"passengers" number,"ranking" number,"airline" text) | SELECT (SELECT "passengers" FROM table_203_515 WHERE "city" = 'los angeles') - (SELECT "passengers" FROM table_203_515 WHERE "city" = 'saskatoon') |
What is the largest capacity for a stadium? | CREATE TABLE table_25129482_1 (capacity INTEGER) | SELECT MAX(capacity) FROM table_25129482_1 |
Where did Geelong play as the away team? | CREATE TABLE table_4545 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Venue" FROM table_4545 WHERE "Away team" = 'geelong' |
list all the takeoffs and landings at MKE | CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE month (month_number ... | SELECT DISTINCT flight.flight_id FROM airport AS AIRPORT_0, airport AS AIRPORT_1, flight WHERE (flight.to_airport = AIRPORT_0.airport_code AND AIRPORT_0.airport_code = 'MKE') OR (flight.from_airport = AIRPORT_1.airport_code AND AIRPORT_1.airport_code = 'MKE') |
until 2104 what are the five most common diagnoses that patients are given within the same month after being diagnosed with convulsions nec? | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE outputevents (row_id number,subject_id nu... | 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... |
Where was the game and what was the attendance on April 3? | CREATE TABLE table_74160 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Location Attendance" FROM table_74160 WHERE "Date" = 'April 3' |
tell me the number of patients with lab test item id 50802 who had delta abnormal lab test status. | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50802" AND lab.flag = "delta" |
For the race Champion Spark Plug 300, what is the report? | CREATE TABLE table_4653 ("Race Name" text,"Circuit" text,"City/Location" text,"Date" text,"Pole position" text,"Winning driver" text,"Winning team" text,"Report" text) | SELECT "Report" FROM table_4653 WHERE "Race Name" = 'champion spark plug 300' |
what was the name of the medicine patient 013-28507 was prescribed during the same day after having received a cpap/peep therapy - 5-10 cm h2o procedure in their current hospital encounter? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patient... | SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-28507' AND patient.hospitaldi... |
If the score is 62-70, what are the high points? | CREATE TABLE table_21330 ("Game" real,"Date" text,"Opponent" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location/Attendance" text,"Record" text) | SELECT "High points" FROM table_21330 WHERE "Score" = '62-70' |
Are there Friday classes for SM 470 ? | CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE semester (semester... | SELECT DISTINCT course_offering.friday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'SM' AND course.number = 470 AND semester.semester = 'WN' AND semester.year = 2016 |
How many Top 10s have Wins larger than 0, and Poles larger than 0? | CREATE TABLE table_38441 ("Year" real,"Starts" real,"Wins" real,"Top 5" real,"Top 10" real,"Poles" real,"Avg. Start" real,"Avg. Finish" real,"Winnings" text,"Position" text) | SELECT COUNT("Top 10") FROM table_38441 WHERE "Wins" > '0' AND "Poles" > '0' |
What was the result of the game after week 6 against the cleveland browns? | CREATE TABLE table_8614 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Attendance" text) | SELECT "Result" FROM table_8614 WHERE "Week" < '6' AND "Opponent" = 'cleveland browns' |
since 1 year ago, patient 029-30149 has undergone a procedure? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number... | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-30149')) AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(... |
Which smallest swimsuit number's interview was less than 8.574 when the average number was bigger than 8.532? | CREATE TABLE table_name_87 (swimsuit INTEGER,interview VARCHAR,average VARCHAR) | SELECT MIN(swimsuit) FROM table_name_87 WHERE interview < 8.574 AND average > 8.532 |
Name the tournament for top-5 more thn 1 and top-25 of 13 with wins of 3 | CREATE TABLE table_name_4 (tournament VARCHAR,wins VARCHAR,top_5 VARCHAR,top_25 VARCHAR) | SELECT tournament FROM table_name_4 WHERE top_5 > 1 AND top_25 = 13 AND wins = 3 |
What was the nationality of a point guard position in 1999-2001? | CREATE TABLE table_name_89 (nationality VARCHAR,position VARCHAR,years_for_grizzlies VARCHAR) | SELECT nationality FROM table_name_89 WHERE position = "point guard" AND years_for_grizzlies = "1999-2001" |
What is the highest number won with a difference of 1? | CREATE TABLE table_20037 ("Position" real,"Team" text,"Points" real,"Played" real,"Won" real,"Drawn" real,"Lost" real,"For" real,"Against" real,"Difference" text) | SELECT MAX("Won") FROM table_20037 WHERE "Difference" = '1' |
what is the laps when the driver is tony rolt and the grid is less than 10? | CREATE TABLE table_55433 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT SUM("Laps") FROM table_55433 WHERE "Driver" = 'tony rolt' AND "Grid" < '10' |
Who drove the car with the n175 chassis in round 13? | CREATE TABLE table_53386 ("Constructor" text,"Chassis" text,"Engine" text,"Tyre" text,"Driver" text,"Rounds" text) | SELECT "Driver" FROM table_53386 WHERE "Chassis" = 'n175' AND "Rounds" = '13' |
How many total pounds were purchased in the year 2018 at all London branches? | CREATE TABLE purchase (member_id number,branch_id text,year text,total_pounds number)CREATE TABLE membership_register_branch (member_id number,branch_id text,register_year text)CREATE TABLE branch (branch_id number,name text,open_year text,address_road text,city text,membership_amount text)CREATE TABLE member (member_i... | SELECT SUM(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018 |
What model number has part number cl8064701510101? | CREATE TABLE table_name_69 (model_number VARCHAR,part_number_s_ VARCHAR) | SELECT model_number FROM table_name_69 WHERE part_number_s_ = "cl8064701510101" |
Give me a histogram for what are the names of the technicians and how many machines are they assigned to repair?, display the total number in ascending order. | CREATE TABLE repair (repair_ID int,name text,Launch_Date text,Notes text)CREATE TABLE technician (technician_id real,Name text,Team text,Starting_Year real,Age int)CREATE TABLE machine (Machine_ID int,Making_Year int,Class text,Team text,Machine_series text,value_points real,quality_rank int)CREATE TABLE repair_assignm... | SELECT Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.Name ORDER BY COUNT(*) |
count the number of patients who received their sputum, tracheal specimen microbiology test since 2103. | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname tex... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y', microlab.culturetakentime) >= '2103') |
What is Team, when Position is 'LHP', and when Pick is '23'? | CREATE TABLE table_name_16 (team VARCHAR,position VARCHAR,pick VARCHAR) | SELECT team FROM table_name_16 WHERE position = "lhp" AND pick = 23 |
How many Total matches happened in 2003? | CREATE TABLE table_name_20 (total_matches VARCHAR,year VARCHAR) | SELECT total_matches FROM table_name_20 WHERE year = "2003" |
Name the total number of rank for percentage change yoy 13.1% | CREATE TABLE table_30153 ("State Rank" real,"National Rank" real,"Institution" text,"Location" text,"Public or Private" text,"Endowment Funds" text,"Percentage Change YOY" text) | SELECT COUNT("National Rank") FROM table_30153 WHERE "Percentage Change YOY" = '13.1%' |
For all employees who have the letters D or S in their first name, a line chart shows the change of salary over hire_date, and could you sort HIRE_DATE from high to low 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 job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN... | SELECT HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC |
What procedures cost less than 5000 and have John Wen as a trained physician? | CREATE TABLE medication (code number,name text,brand text,description text)CREATE TABLE nurse (employeeid number,name text,position text,registered boolean,ssn number)CREATE TABLE procedures (code number,name text,cost number)CREATE TABLE trained_in (physician number,treatment number,certificationdate time,certificatio... | SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" |
What is the founding of parsu cimmarons? | CREATE TABLE table_11604804_5 (founded INTEGER,nickname VARCHAR) | SELECT MIN(founded) FROM table_11604804_5 WHERE nickname = "ParSU Cimmarons" |
who served a term before mannerheim ? | CREATE TABLE table_204_488 (id number,"order in\nposition" number,"president of\nthe republic" text,"length of\nthe presidential\naction" text,"rank by\nlength\nof term(s)" number,"notes" text) | SELECT "president of\nthe republic" FROM table_204_488 WHERE "order in\nposition" < (SELECT "order in\nposition" FROM table_204_488 WHERE "president of\nthe republic" = 'gustaf mannerheim') ORDER BY "order in\nposition" DESC LIMIT 1 |
what is average age of patients whose discharge location is home health care and primary disease is angioedema? | 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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.diagnosis = "ANGIOEDEMA" |
For franklin of class aa, which school years does this occur? | CREATE TABLE table_19435 ("School Year" text,"Class A" text,"Class AA" text,"Class AAA" text,"Class AAAA" text,"Class AAAAA" text) | SELECT "School Year" FROM table_19435 WHERE "Class AA" = 'Franklin' |
when did patient 031-3355 get the last other microbiology test on the current hospital encounter. | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,pat... | SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND patient.hospitaldischargetime IS NULL)) AND microla... |
what is the procedure short title and long title of procedure icd9 code 45? | 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 procedures.short_title, procedures.long_title FROM procedures WHERE procedures.icd9_code = "45" |
Who is the opponent in 1992? | CREATE TABLE table_68868 ("Rank" text,"Score" text,"Player" text,"Club" text,"Opponent" text,"Year" text,"Round" text,"Venue" text) | SELECT "Opponent" FROM table_68868 WHERE "Year" = '1992' |
What was the highest place result in 2010 with a Clean and Jerk weight of 224kg? | CREATE TABLE table_14265 ("Year" real,"Competition" text,"Location" text,"Weight Category" text,"Snatch" text,"Clean and Jerk" text,"Total" text,"Place" real) | SELECT MAX("Place") FROM table_14265 WHERE "Year" = '2010' AND "Clean and Jerk" = '224kg' |
What is Original Album, when English Translation is 'With You'? | CREATE TABLE table_60614 ("English translation" text,"Original album" text,"Lyricist(s)" text,"Composer(s)" text,"Time" text) | SELECT "Original album" FROM table_60614 WHERE "English translation" = 'with you' |
Find the accreditation level that more than 3 phones use. | CREATE TABLE phone (Accreditation_level VARCHAR) | SELECT Accreditation_level FROM phone GROUP BY Accreditation_level HAVING COUNT(*) > 3 |
A bar chart for what are the number of the countries of mountains with height bigger than 5000?, could you show in descending by the 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(Country) FROM mountain WHERE Height > 5000 GROUP BY Country ORDER BY Country DESC |
What was the tail number with 3/3 fatalities? | CREATE TABLE table_name_32 (tail_number VARCHAR,fatalities VARCHAR) | SELECT tail_number FROM table_name_32 WHERE fatalities = "3/3" |
How many locomotives have a livery that is highland railway green | CREATE TABLE table_20331 ("No." real,"Name" text,"Livery" text,"Locomotive type" text,"Wheel Arrangement" text,"Builder" text,"Year built" real,"Status" text) | SELECT COUNT("Name") FROM table_20331 WHERE "Livery" = 'Highland Railway green' |
List all episode air dates where Luiza Possi was the guest fourth judge? | CREATE TABLE table_27615445_1 (episode_air_date VARCHAR,guest_fourth_judge VARCHAR) | SELECT episode_air_date FROM table_27615445_1 WHERE guest_fourth_judge = "Luiza Possi" |
Game smaller than 70, and a Record of 43 16 8 is what opponent? | CREATE TABLE table_35023 ("Game" real,"March" real,"Opponent" text,"Score" text,"Record" text,"Points" real) | SELECT "Opponent" FROM table_35023 WHERE "Game" < '70' AND "Record" = '43–16–8' |
What was the score of the game with the Broadview Hawks as the home team? | CREATE TABLE table_name_97 (score VARCHAR,home VARCHAR) | SELECT score FROM table_name_97 WHERE home = "broadview hawks" |
Show the number of debates for each person on the affirmative side in a bar chart, and order by the total number in desc please. | CREATE TABLE people (People_ID int,District text,Name text,Party text,Age int)CREATE TABLE debate_people (Debate_ID int,Affirmative int,Negative int,If_Affirmative_Win bool)CREATE TABLE debate (Debate_ID int,Date text,Venue text,Num_of_Audience int) | SELECT Name, COUNT(Name) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID GROUP BY Name ORDER BY COUNT(Name) DESC |
What is the first season written by joseph hampton & dani renee? | CREATE TABLE table_11630008_4 (season_no INTEGER,written_by VARCHAR) | SELECT MIN(season_no) FROM table_11630008_4 WHERE written_by = "Joseph Hampton & Dani Renee" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.