instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the most recent year georgia tech chose a linebacker? | CREATE TABLE table_name_3 (a_ VARCHAR,year_ INTEGER,position VARCHAR,college VARCHAR) | SELECT MAX(year_) AS "a_" FROM table_name_3 WHERE position = "linebacker" AND college = "georgia tech" |
What is the maximum number of losses that the Minnesota Kicks had after 1979 with an average attendance of 16,605? | CREATE TABLE table_name_40 (lost INTEGER,season VARCHAR,avg_attend VARCHAR) | SELECT MAX(lost) FROM table_name_40 WHERE season > 1979 AND avg_attend = 16 OFFSET 605 |
show me the three most frequent output events since 5 years ago? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE intakeoutput (intakeoutputid number,patientunits... | SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime) >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 3 |
Which Avoirdupois value is translated to grain? | CREATE TABLE table_37333 ("Unit" text,"Russian" text,"Translation" text,"Ratio" real,"Metric value" text,"Avoirdupois value" text,"Ordinary value" text) | SELECT "Avoirdupois value" FROM table_37333 WHERE "Translation" = 'grain' |
%sql SELECT * \ FROM INFORMATION_SCHEMA.TABLES \ WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABL... | SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG = '$database' AND TABLE_SCHEMA != 'sys' ORDER BY TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION |
what are the five most frequently ordered procedures for patients in the age 30s until 2104? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit tex... | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B... |
where is the district where the incumbent is del latta? | CREATE TABLE table_18274 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT "District" FROM table_18274 WHERE "Incumbent" = 'Del Latta' |
What is the date settled for 40 years? | CREATE TABLE table_17161 ("Suburb" text,"Population (in 2008)" real,"Median age (in 2006)" text,"Mean household size (in 2006)" text,"Area (km\u00b2)" text,"Density (/km\u00b2)" real,"Date first settled as a suburb" real,"Gazetted as a Division Name" text) | SELECT "Date first settled as a suburb" FROM table_17161 WHERE "Median age (in 2006)" = '40 years' |
Get top users from Armenia. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance te... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE Location LIKE '%Turkey%' ORDER BY Reputation DESC |
What was the highest attendance? | CREATE TABLE table_14945608_1 (attendance INTEGER) | SELECT MAX(attendance) FROM table_14945608_1 |
In 1937, what was the finish? | CREATE TABLE table_80229 ("Year" text,"Start" text,"Qual" text,"Rank" text,"Finish" text,"Laps" real) | SELECT "Finish" FROM table_80229 WHERE "Year" = '1937' |
If % lunsford is 51.82% what is the % mcconnell in Letcher? | CREATE TABLE table_70 ("County" text,"Precincts" real,"Lunsford" real,"% Lunsford" text,"McConnell" real,"% McConnell" text,"Total" text) | SELECT "% McConnell" FROM table_70 WHERE "% Lunsford" = '51.82%' |
Give me the comparison about the amount of date_address_from over the date_address_from bin date_address_from by weekday by a bar chart. | CREATE TABLE Assessment_Notes (notes_id INTEGER,student_id INTEGER,teacher_id INTEGER,date_of_notes DATETIME,text_of_notes VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Students (student_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARCHAR(40),last_name VARCHAR(40),cell_mobile_number VARCHAR(... | SELECT date_address_from, COUNT(date_address_from) FROM Student_Addresses ORDER BY monthly_rental DESC |
Tell me the score for Venue of tanteen recreation ground, st. george's | CREATE TABLE table_name_43 (score VARCHAR,venue VARCHAR) | SELECT score FROM table_name_43 WHERE venue = "tanteen recreation ground, st. george's" |
Total Questions, Answers, and Comments of 1000 most recently active users. | CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,U... | WITH RecentUsers AS (SELECT Posts.OwnerUserId, MAX(Posts.LastActivityDate) AS LastActivityDate, SUM(CASE WHEN Posts.PostTypeId = 1 THEN 1 ELSE 0 END) AS Questions, SUM(CASE WHEN Posts.PostTypeId = 2 THEN 1 ELSE 0 END) AS Answers FROM Posts WHERE Posts.OwnerUserId IN (SELECT Posts.Id FROM Posts ORDER BY Posts.LastActivi... |
how many times is there more than 0 draws and more than 0 losses? | CREATE TABLE table_name_5 (played VARCHAR,drawn VARCHAR,lost VARCHAR) | SELECT COUNT(played) FROM table_name_5 WHERE drawn > 0 AND lost > 0 |
How many Januarys had records of 22-15-6? | CREATE TABLE table_35843 ("Game" real,"January" real,"Opponent" text,"Score" text,"Record" text) | SELECT COUNT("January") FROM table_35843 WHERE "Record" = '22-15-6' |
Name the sum To par for score of 71-74-71-72=288 | CREATE TABLE table_name_26 (to_par INTEGER,score VARCHAR) | SELECT SUM(to_par) FROM table_name_26 WHERE score = 71 - 74 - 71 - 72 = 288 |
what is the total number of violent deaths across all regions ? | CREATE TABLE table_203_234 (id number,"description" text,"total" number,"poland" number,"baltic states(resettled in poland during war)" number,"resettled in poland during war(from ussr and romania)" number,"sudetendeutsch" number,"se europe\n(hungary,romania,yugoslavia & slovakia)" number) | SELECT "total" FROM table_203_234 WHERE "description" = 'violent deaths' |
does the PHILADELPHIA airport have a name | CREATE TABLE code_description (code varchar,description text)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE fare (far... | SELECT DISTINCT airport.airport_code FROM airport, airport_service, city WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'PHILADELPHIA' |
For each party, return the name of the party and the number of delegates from that party Plot them as bar chart, sort in asc by the Y-axis. | CREATE TABLE county (County_Id int,County_name text,Population real,Zip_code text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text,Party int,First_Elected real,Committee text)CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroll... | SELECT T2.Party, AVG(COUNT(*)) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY AVG(COUNT(*)) |
For each location, how many gas stations are there in order? | CREATE TABLE company (company_id number,rank number,company text,headquarters text,main_industry text,sales_billion number,profits_billion number,assets_billion number,market_value number)CREATE TABLE station_company (station_id number,company_id number,rank_of_the_year number)CREATE TABLE gas_station (station_id numbe... | SELECT location, COUNT(*) FROM gas_station GROUP BY location ORDER BY COUNT(*) |
Which Season has a Level of tier 2 and a Position of 1st? | CREATE TABLE table_5753 ("Season" real,"Level" text,"Division" text,"Administration" text,"Position" text) | SELECT COUNT("Season") FROM table_5753 WHERE "Level" = 'tier 2' AND "Position" = '1st' |
Name the D 45 O with D 44 O majority | CREATE TABLE table_name_5 (d_45_o VARCHAR,d_44_o VARCHAR) | SELECT d_45_o FROM table_name_5 WHERE d_44_o = "majority →" |
Draw a bar chart about the distribution of Nationality and the average of meter_100 , and group by attribute Nationality, and order Y in desc order. | CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE stadiu... | SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY AVG(meter_100) DESC |
In which county is the swann covered bridge located? | CREATE TABLE table_49818 ("Name" text,"Built" text,"Listed" text,"Location" text,"County" text) | SELECT "County" FROM table_49818 WHERE "Name" = 'swann covered bridge' |
Which player is from Belgium? | CREATE TABLE table_name_44 (name VARCHAR,nationality VARCHAR) | SELECT name FROM table_name_44 WHERE nationality = "belgium" |
Bin the claim date into the Day of Week interval and count them for visualizing a bar chart, and rank y axis in descending order. | CREATE TABLE Payments (Payment_ID INTEGER,Settlement_ID INTEGER,Payment_Method_Code VARCHAR(255),Date_Payment_Made DATE,Amount_Payment INTEGER)CREATE TABLE Settlements (Settlement_ID INTEGER,Claim_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Settled DATE,Amount_Claimed INTEGER,Amount_Settled INTEGER,Customer_Policy_ID IN... | SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Settlements ORDER BY COUNT(Date_Claim_Made) DESC |
count the number of patients whose religion is jehovah's witness and lab test name is triglycerides? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "JEHOVAH'S WITNESS" AND lab.label = "Triglycerides" |
What is the event with a 2:08 time? | CREATE TABLE table_name_1 (event VARCHAR,time VARCHAR) | SELECT event FROM table_name_1 WHERE time = "2:08" |
Find the first name and last name for the 'CTO' of the club 'Hopkins Student Enterprises'? | CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE member_of_club (stuid number,clubid number,position text)CREATE TABLE club (clubid number,clubname text,clubdesc text,clublocation text) | SELECT t3.fname, t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" AND t2.position = "CTO" |
What is the name of the body builder with the greatest body weight? | CREATE TABLE body_builder (body_builder_id number,people_id number,snatch number,clean_jerk number,total number)CREATE TABLE people (people_id number,name text,height number,weight number,birth_date text,birth_place text) | SELECT T2.name FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id ORDER BY T2.weight DESC LIMIT 1 |
Name the IATA with a City of budapest? | CREATE TABLE table_10073 ("City" text,"Province" text,"Country" text,"IATA" text,"ICAO" text,"Airport" text) | SELECT "IATA" FROM table_10073 WHERE "City" = 'budapest' |
what are all the overall with viewers (m) being 2.61 | CREATE TABLE table_13110459_2 (overall VARCHAR,viewers__m_ VARCHAR) | SELECT overall FROM table_13110459_2 WHERE viewers__m_ = "2.61" |
How many laps have a Time/Retired of +12.5 secs? | CREATE TABLE table_name_87 (laps VARCHAR,time_retired VARCHAR) | SELECT COUNT(laps) FROM table_name_87 WHERE time_retired = "+12.5 secs" |
Who is the player with a t8 place? | CREATE TABLE table_62411 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real) | SELECT "Player" FROM table_62411 WHERE "Place" = 't8' |
how many points did the team that scored 38 points in the 1986-87 season score during the 1988-89 season? | CREATE TABLE table_19369 ("Team" text,"Average" text,"Points" real,"Played" real,"1986-87" text,"1987-88" text,"1988-89" real) | SELECT MIN("1988-89") FROM table_19369 WHERE "1986-87" = '38' |
Find names of trains that run through stations for the local authority Chiltern, compare the total number of name in a bar graph, and sort in asc by the y-axis. | CREATE TABLE weekly_weather (station_id int,day_of_week text,high_temperature int,low_temperature int,precipitation real,wind_speed_mph int)CREATE TABLE train (id int,train_number int,name text,origin text,destination text,time text,interval text)CREATE TABLE station (id int,network_name text,services text,local_author... | SELECT name, COUNT(name) FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = "Chiltern" GROUP BY name ORDER BY COUNT(name) |
Who were the opponents of the Wildcats in game 4? | CREATE TABLE table_21062353_1 (opponent VARCHAR,game VARCHAR) | SELECT opponent FROM table_21062353_1 WHERE game = 4 |
What is No. 7, when Region (Year) is Arizona (2010)? | CREATE TABLE table_49611 ("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_49611 WHERE "Region (year)" = 'arizona (2010)' |
What is the party of Richard Simpson? | CREATE TABLE table_name_59 (party VARCHAR,name VARCHAR) | SELECT party FROM table_name_59 WHERE name = "richard simpson" |
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, sort in desc by the names. | CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,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 employees (EMPLOYEE_ID decimal(6,... | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID DESC |
How much money does the player with a 68-71-68-72=279 score have? | CREATE TABLE table_name_78 (money___£__ VARCHAR,score VARCHAR) | SELECT money___£__ FROM table_name_78 WHERE score = 68 - 71 - 68 - 72 = 279 |
What is the largest base pair with a Strain of unspecified? | CREATE TABLE table_53846 ("Species" text,"Strain" text,"Type" text,"Base Pairs" real,"Genes" real) | SELECT MAX("Base Pairs") FROM table_53846 WHERE "Strain" = 'unspecified' |
what is patient 016-38131's height for the last time on the current hospital encounter? | 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 patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-38131' AND patient.hospitaldischargetime IS NULL) AND NOT patient.admissionheight IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1 |
Find the stories of the building with the largest height. | CREATE TABLE companies (id number,name text,headquarters text,industry text,sales_billion number,profits_billion number,assets_billion number,market_value_billion text)CREATE TABLE buildings (id number,name text,city text,height number,stories number,status text)CREATE TABLE office_locations (building_id number,company... | SELECT stories FROM buildings ORDER BY height DESC LIMIT 1 |
Who was the opponent when the score was 6-3, 6-3? | CREATE TABLE table_name_89 (opponent VARCHAR,score VARCHAR) | SELECT opponent FROM table_name_89 WHERE score = "6-3, 6-3" |
What was david ferrer seeded? | CREATE TABLE table_26844 ("Seed" real,"Rank" real,"Player" text,"Points" real,"Points defending" text,"Points won" real,"New points" real,"Status" text) | SELECT MAX("Seed") FROM table_26844 WHERE "Player" = 'David Ferrer' |
whats patient 006-171217 last ward id during the previous year? | 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 treatment (treatmentid number,patientunitstayi... | SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-171217') AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY patient.unitadmittime DESC LIM... |
what is the total number of teams that played 1919 brazilian football ? | CREATE TABLE table_203_254 (id number,"position" number,"team" text,"points" number,"played" number,"won" number,"drawn" number,"lost" number,"for" number,"against" number,"difference" number) | SELECT COUNT("team") FROM table_203_254 |
What was the last game where the record was 6-3? | CREATE TABLE table_13762472_3 (game INTEGER,record VARCHAR) | SELECT MAX(game) FROM table_13762472_3 WHERE record = "6-3" |
which pollutant had the same emission standard as pm10 ? | CREATE TABLE table_204_909 (id number,"pollutant" text,"units" text,"emission standard" number,"coal-fired" text,"petroleum coke-fired" text) | SELECT "pollutant" FROM table_204_909 WHERE "pollutant" <> 'pm10' AND "emission standard" = (SELECT "emission standard" FROM table_204_909 WHERE "pollutant" = 'pm10') |
What was the attendance number for the Timberwolves game? | CREATE TABLE table_name_69 (location_attendance INTEGER,team VARCHAR) | SELECT SUM(location_attendance) FROM table_name_69 WHERE team = "timberwolves" |
Did Prof. David Remy in Spring-Summer 2000 teach MATSCIE 480 ? | CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id 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,wedn... | SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'MATSCIE' AND course.number = 480 AND instructor.name LIKE '%David Remy%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_i... |
What song was made by the sex pistols? | CREATE TABLE table_name_9 (song VARCHAR,artist VARCHAR) | SELECT song FROM table_name_9 WHERE artist = "sex pistols" |
Compare the lowest rating among all movies by each title using a histogram, could you rank from high to low by the X-axis? | CREATE TABLE Movie (mID int,title text,year int,director text)CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date) | SELECT title, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY title DESC |
what is the round on 21 february 2009? | CREATE TABLE table_79246 ("Round" text,"Date" text,"Opponents" text,"Venue" text,"Result" text,"Score F\u2013A" text,"Attendance" real) | SELECT "Round" FROM table_79246 WHERE "Date" = '21 february 2009' |
who was the only official guest on july 16-18 ? | CREATE TABLE table_204_823 (id number,"dates" text,"location" text,"attendance" text,"official guests" text,"notes" text) | SELECT "official guests" FROM table_204_823 WHERE "dates" = 'july 16-18, 1982' |
What is the catalogue on october 15, 2004? | CREATE TABLE table_name_34 (catalogue VARCHAR,date VARCHAR) | SELECT catalogue FROM table_name_34 WHERE date = "october 15, 2004" |
What is the lowest amount of gold for more than 16 silver? | CREATE TABLE table_name_14 (gold INTEGER,silver INTEGER) | SELECT MIN(gold) FROM table_name_14 WHERE silver > 16 |
what is 2013 when 2001 is qf and 2011 is 4r? | CREATE TABLE table_47844 ("Tournament" text,"1998" text,"1999" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text,"2013" text) | SELECT "2013" FROM table_47844 WHERE "2001" = 'qf' AND "2011" = '4r' |
provide the number of patients whose procedure long title is excision or destruction of other lesion or tissue of heart, open approach and lab test fluid is pleural. | 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 diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Excision or destruction of other lesion or tissue of heart, open approach" AND lab.fluid = "Pleural" |
tell me the first careunit patient 11579 got since 2103? | CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE cost (row_i... | SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11579) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) >= '2103' ORDER BY transfers.intime LIMIT 1 |
Relational database trends (# of Questions per Month). | 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 PostTags (PostId number,TagId number)CREATE TABLE Comments (Id number,PostId number,Sc... | SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, Tags.TagName, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ... |
what is the first name on the table ? | CREATE TABLE table_203_447 (id number,"constituency" number,"region" text,"name" text,"party" text,"last elected" number) | SELECT "name" FROM table_203_447 WHERE id = 1 |
what are the two year survival rates for those who were prescribed albuterol sulfate 2.5 mg inhl neb soln after having been diagnosed with metastatic lung ca? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmen... | SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid... |
What is the size of 542 ? | CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id 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,wedn... | SELECT DISTINCT num_enrolled FROM course WHERE department = 'EECS' AND number = 542 |
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and price , and group by attribute headquarter, and I want to sort X-axis from high to low order please. | CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER) | SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name DESC |
Which region has the format CD and label MCA? | CREATE TABLE table_name_15 (region VARCHAR,format VARCHAR,label VARCHAR) | SELECT region FROM table_name_15 WHERE format = "cd" AND label = "mca" |
how many trains originate from mangalore central ? | CREATE TABLE table_204_824 (id number,"no." number,"train no:" text,"origin" text,"destination" text,"train name" text) | SELECT COUNT(*) FROM table_204_824 WHERE "origin" = 'mangalore central' |
Select the name and price of all products with a price larger than or equal to $180, and sort first by price (in descending order), and then by name (in ascending order). | CREATE TABLE manufacturers (code number,name text,headquarter text,founder text,revenue number)CREATE TABLE products (code number,name text,price number,manufacturer number) | SELECT name, price FROM products WHERE price >= 180 ORDER BY price DESC, name |
What are the names of actors and the musicals that they are in? | CREATE TABLE musical (musical_id number,name text,year number,award text,category text,nominee text,result text)CREATE TABLE actor (actor_id number,name text,musical_id number,character text,duration text,age number) | SELECT T1.name, T2.name FROM actor AS T1 JOIN musical AS T2 ON T1.musical_id = T2.musical_id |
What was the record in the game where McWilliams (8) did the most high rebounds? | CREATE TABLE table_23325 ("Game" real,"Date" text,"Opponent" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location" text,"Record" text) | SELECT "Record" FROM table_23325 WHERE "High rebounds" = 'McWilliams (8)' |
How many patients died who had an endovascular approach procedure of excision or destruction of other lesion or tissue of heart? | 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 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DEAD/EXPIRED" AND procedures.short_title = "Exc/des hrt les,endovasc" |
what is the monthly minimum amount of rbc patient 002-41391 has since 2 years ago? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealths... | SELECT MIN(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 = '002-41391')) AND lab.labname = 'rbc' AND DATETIME(lab.labresulttime) >= DATETIME(C... |
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, sort from high to low by the x-axis. | CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varc... | SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID DESC |
What is the title of the episode that featured Abbud Siddiqui? | CREATE TABLE table_31185 ("No." real,"Title" text,"Directed by" text,"Written by" text,"Featured character(s)" text,"U.S. viewers (millions)" text,"Original air date" text) | SELECT "Title" FROM table_31185 WHERE "Featured character(s)" = 'Abbud Siddiqui' |
What is the group C region with Illinois as group B? | CREATE TABLE table_75160 ("Region" real,"Group A" text,"Group B" text,"Group C" text,"Group D" text,"Group E" text,"Group F" text) | SELECT "Group C" FROM table_75160 WHERE "Group B" = 'illinois' |
List all the event names by year from the most recent to the oldest. | CREATE TABLE record (id number,result text,swimmer_id number,event_id number)CREATE TABLE swimmer (id number,name text,nationality text,meter_100 number,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,time text)CREATE TABLE event (id number,name text,stadium_id number,year text... | SELECT name FROM event ORDER BY year DESC |
For those employees who was hired before 2002-06-21, give me the comparison about the sum of employee_id over the hire_date bin hire_date by weekday by a bar chart, order in desc by the total number. | 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 countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decima... | SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(EMPLOYEE_ID) DESC |
What is the Club of the Player with a Date of Birth of 1979-01-29? | CREATE TABLE table_62455 ("Name" text,"Pos." text,"Height" text,"Weight" text,"Date of Birth" text,"Club" text) | SELECT "Club" FROM table_62455 WHERE "Date of Birth" = '1979-01-29' |
On what date was the Catalog FT 507? | CREATE TABLE table_name_93 (date VARCHAR,catalog VARCHAR) | SELECT date FROM table_name_93 WHERE catalog = "ft 507" |
What is the total rank of the match with tipperary as the opposition? | CREATE TABLE table_65863 ("Rank" real,"Player" text,"County" text,"Tally" text,"Total" real,"Opposition" text) | SELECT COUNT("Rank") FROM table_65863 WHERE "Opposition" = 'tipperary' |
List the types of competition and the number of competitions of each type Visualize by bar chart, and I want to order the total number from high to low 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 player (Player_ID int,name text,Position text,Club_ID in... | SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC |
What is cornell's lowest pick number? | CREATE TABLE table_39407 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT MIN("Pick #") FROM table_39407 WHERE "College" = 'cornell' |
what was the last time a medication was prescribed to patient 5395? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses_icd (r... | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5395) ORDER BY prescriptions.startdate DESC LIMIT 1 |
What is the total of silver when gold is less than 0? | CREATE TABLE table_7057 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Silver") FROM table_7057 WHERE "Gold" < '0' |
count the number of patients whose primary disease is left colon cancer and procedure short title is temporary tracheostomy? | 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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "LEFT COLON CANCER" AND procedures.short_title = "Temporary tracheostomy" |
List the all the assets make, model, details by the disposed date ascendingly. | CREATE TABLE third_party_companies (company_id number,company_type text,company_name text,company_address text,other_company_details text)CREATE TABLE part_faults (part_fault_id number,part_id number,fault_short_name text,fault_description text,other_fault_details text)CREATE TABLE skills_required_to_fix (part_fault_id... | SELECT asset_make, asset_model, asset_details FROM assets ORDER BY asset_disposed_date |
What was the away team for the game in Slough Town? | CREATE TABLE table_12703 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" text) | SELECT "Away team" FROM table_12703 WHERE "Home team" = 'slough town' |
When they played Universidad de Chile, what was the score of the first leg? | CREATE TABLE table_21445 ("Team #1" text,"Points" text,"Team #2" text,"1st leg" text,"2nd leg" text) | SELECT COUNT("1st leg") FROM table_21445 WHERE "Team #2" = 'Universidad de Chile' |
What was the result on 1990-11-04? | CREATE TABLE table_name_55 (result VARCHAR,date VARCHAR) | SELECT result FROM table_name_55 WHERE date = "1990-11-04" |
How many points did the away team score when the home team scored 16.12 (108)? | CREATE TABLE table_56031 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Away team score" FROM table_56031 WHERE "Home team score" = '16.12 (108)' |
display job title and average salary of employees. | CREATE TABLE jobs (job_id text,job_title text,min_salary number,max_salary number)CREATE TABLE regions (region_id number,region_name text)CREATE TABLE locations (location_id number,street_address text,postal_code text,city text,state_province text,country_id text)CREATE TABLE employees (employee_id number,first_name te... | SELECT job_title, AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title |
how many australian prime ministers were older than 50 at the time they began their first term ? | CREATE TABLE table_204_812 (id number,"#" number,"prime minister" text,"date of birth" text,"start date\nof (first) term" text,"age at beginning\nof (first) term" text,"end date\nof (final) term" text,"total time in\noffice" text,"date of death" text,"lifespan" text) | SELECT COUNT("prime minister") FROM table_204_812 WHERE "age at beginning\nof (first) term" >= 50 |
which company funded the ' Mickey Mouse ' series | CREATE TABLE tv_series (sid int,title text,release_year int,num_of_seasons int,num_of_episodes int,title_aka text,budget text)CREATE TABLE made_by (id int,msid int,pid int)CREATE TABLE company (id int,name text,country_code varchar)CREATE TABLE producer (pid int,gender text,name text,nationality text,birth_city text,bi... | SELECT company.name FROM company, copyright, tv_series WHERE copyright.cid = company.id AND tv_series.sid = copyright.msid AND tv_series.title = 'Mickey Mouse' |
What is the maximum number that a certain service is provided? List the service id, details and number. | CREATE TABLE residents_services (resident_id number,service_id number,date_moved_in time,property_id number,date_requested time,date_provided time,other_details text)CREATE TABLE services (service_id number,organization_id number,service_type_code text,service_details text)CREATE TABLE customers (customer_id number,cus... | SELECT T1.service_id, T1.service_details, COUNT(*) FROM services AS T1 JOIN residents_services AS T2 ON T1.service_id = T2.service_id GROUP BY T1.service_id ORDER BY COUNT(*) DESC LIMIT 1 |
What is the largest drawn number when 14 is the position, and goals for is more than 66? | CREATE TABLE table_46849 ("Position" real,"Team" text,"Played" real,"Drawn" real,"Lost" real,"Goals For" real,"Goals Against" real,"Goal Difference" text,"Points 1" text) | SELECT MAX("Drawn") FROM table_46849 WHERE "Position" = '14' AND "Goals For" > '66' |
What date was Carlos Boozer (23) the leading scorer? | CREATE TABLE table_name_50 (date VARCHAR,leading_scorer VARCHAR) | SELECT date FROM table_name_50 WHERE leading_scorer = "carlos boozer (23)" |
How many wins when the average start is 29.0? | CREATE TABLE table_2182562_1 (wins VARCHAR,avg_start VARCHAR) | SELECT COUNT(wins) FROM table_2182562_1 WHERE avg_start = "29.0" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.