instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Post Links by PostId descending.
CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)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 Badges (Id...
SELECT PostId, RelatedPostId FROM PostLinks WHERE LinkTypeId = 1 ORDER BY PostId DESC
What amenities does Smith Hall have in alphabetical order?
CREATE TABLE lives_in (stuid number,dormid number,room_number number)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE dorm_amenity (amenid number,amenity_name text)CREATE TABLE has_amenity (dormid number,amenid number)CREATE TABLE dorm ...
SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name
which pga tour event gave out the least prize money to its 1st place finisher ?
CREATE TABLE table_203_531 (id number,"date" text,"tournament" text,"location" text,"winner" text,"score" text,"1st prize ($)" number)
SELECT "tournament" FROM table_203_531 ORDER BY "1st prize ($)" LIMIT 1
what was the first country to get the radio ad ?
CREATE TABLE table_204_17 (id number,"region" text,"date" text,"format" text,"version(s)" text,"label" text)
SELECT "region" FROM table_204_17 ORDER BY "date" LIMIT 1
Which room has cheapest base price? List the room's name and the base price.
CREATE TABLE Rooms (roomName VARCHAR,basePrice VARCHAR)
SELECT roomName, basePrice FROM Rooms ORDER BY basePrice LIMIT 1
Find the name of the room with the maximum occupancy.
CREATE TABLE Rooms (roomName VARCHAR,maxOccupancy VARCHAR)
SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1
What is the highest number of amendments cosponsored associated with 53 amendments originally cosponsored and over 54 bills sponsored?
CREATE TABLE table_name_25 (all_amendments_cosponsored INTEGER,amendments_originally_cosponsored VARCHAR,all_bills_sponsored VARCHAR)
SELECT MAX(all_amendments_cosponsored) FROM table_name_25 WHERE amendments_originally_cosponsored = 53 AND all_bills_sponsored > 54
largest number of housemates was during season ...
CREATE TABLE table_203_397 (id number,"series" text,"launch date" text,"finale date" text,"days" number,"housemates" number,"winner" text,"main presenter" text,"grand prize" text,"liveshow\naudience\nmillions" number)
SELECT MAX("housemates") FROM table_203_397
Name the area for german
CREATE TABLE table_73963 ("Member countries" text,"Population" text,"Area (km\u00b2)" text,"GDP (billion US$)" text,"GDP per capita (US$)" text,"Languages" text)
SELECT "Area (km\u00b2)" FROM table_73963 WHERE "Languages" = 'German'
Name who wrote the production code 322
CREATE TABLE table_27462209_1 (written_by VARCHAR,prod_code VARCHAR)
SELECT written_by FROM table_27462209_1 WHERE prod_code = 322
how many patients stayed in hospital for more than 23 days and were prescribed the drug ondasetron odt?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "23" AND prescriptions.drug = "Ondansetron ODT"
Opponent of at boston patriots, and a Week larger than 3 had what average attendance?
CREATE TABLE table_36374 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Game Site" text,"Attendance" real)
SELECT AVG("Attendance") FROM table_36374 WHERE "Opponent" = 'at boston patriots' AND "Week" > '3'
what is average age of patients whose admission type is emergency and year of death is less than 2155?
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 AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dod_year < "2155.0"
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 sum of employee_id bin hire_date by time, and visualize them by a bar chart, display by the y axis in descending please.
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))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_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE cou...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(EMPLOYEE_ID) DESC
What was the total score where Toronto was played?
CREATE TABLE table_46307 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT SUM("Game") FROM table_46307 WHERE "Team" = 'toronto'
What shareholder has 3.63 percent of capital?
CREATE TABLE table_73212 ("Shareholder" text,"s A share" real,"s B share" real,"Percent of capital" text,"Percent of votes" text)
SELECT "Shareholder" FROM table_73212 WHERE "Percent of capital" = '3.63'
How many films for each type? Return a bar chart.
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)CREATE TABLE film_market_estimation (Estimation_ID int,Low_Estimate real,High_Estimate real,Film_ID int,Type text,Market_ID int,Year int)
SELECT Type, COUNT(Type) FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY Type
What is the batting team where the runs are 276?
CREATE TABLE table_16609 ("Wicket" text,"Runs" text,"Batting partners" text,"Batting team" text,"Fielding team" text,"Venue" text,"Season" text)
SELECT "Batting team" FROM table_16609 WHERE "Runs" = '276'
How many bank branches are there?
CREATE TABLE bank (Id VARCHAR)
SELECT COUNT(*) FROM bank
what number of patients have received a packed cell transfusion within 2 months after having been diagnosed with chr ischemic hrt dis nec?
CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'chr ischemic hrt d...
Find the number of the parties associated with the delegates from district 1 or 2 Who served as comptrollers of the parties?, and sort in asc by the X.
CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroller text,Attorney_General text,US_Senate text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text,Party int,First_Elected real,Committee text)CREATE TABLE county (County_Id int,Co...
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY Comptroller
For the race held at the Cleveland Burke Lakefront Airport circuit, with winning driver Emerson Fittipaldi and pole position Michael Andretti, what was the winning team?
CREATE TABLE table_4654 ("Race Name" text,"Circuit" text,"City/Location" text,"Date" text,"Pole position" text,"Winning driver" text,"Winning team" text,"Report" text)
SELECT "Winning team" FROM table_4654 WHERE "Winning driver" = 'emerson fittipaldi' AND "Pole position" = 'michael andretti' AND "Circuit" = 'cleveland burke lakefront airport'
Search post based on tag and keyword with answers. Limited the results to the posts with check answer
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId...
SELECT p.Id AS "post_link", p.Id, p.Title, p.CommentCount, p.Body, c.Text, p.ViewCount, a.Score FROM Posts AS p LEFT JOIN Comments AS c ON p.Id = c.PostId INNER JOIN Posts AS a ON a.ParentId = p.Id WHERE p.PostTypeId = 1 OR p.PostTypeId = 2 AND p.Tags = '%##tagname##%' AND p.Title LIKE '%##keyword##%' ORDER BY ViewCoun...
Who were the candidates in the election that featured incumbent don edwards?
CREATE TABLE table_1341738_6 (candidates VARCHAR,incumbent VARCHAR)
SELECT candidates FROM table_1341738_6 WHERE incumbent = "Don Edwards"
What is the highest race number in the Phillip Island circuit with James Winslow as the winning driver and pole position?
CREATE TABLE table_72676 ("Round" text,"Race" real,"Circuit" text,"Date" text,"Pole Position" text,"Fastest Lap" text,"Winning driver" text,"Winning team" text)
SELECT MAX("Race") FROM table_72676 WHERE "Circuit" = 'Phillip Island' AND "Winning driver" = 'James Winslow' AND "Pole Position" = 'James Winslow'
Search my comments by text.
CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)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 PendingFla...
SELECT PostId AS "post_link", Text, Score FROM Comments WHERE UserId = '##UserId##' AND Text LIKE '%##Search##%' ORDER BY CreationDate DESC
When was there 204 deaths?
CREATE TABLE table_58418 ("Name" text,"Dates active" text,"Windspeeds" text,"Pressure" text,"Deaths" text)
SELECT "Dates active" FROM table_58418 WHERE "Deaths" = '204'
which of each game in 2007 was in the 2nd position ?
CREATE TABLE table_204_760 (id number,"year" number,"competition" text,"venue" text,"position" text,"event" text,"notes" text)
SELECT "competition" FROM table_204_760 WHERE "year" = 2007 AND "position" = 2
give me the top four most frequent treatments that patients took within the same month after receiving packed cell transfusion until 1 year ago.
CREATE TABLE d_items (row_id number,itemid number,label text,linksto 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 labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum ...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.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, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admi...
What were the results on September 7?
CREATE TABLE table_name_31 (results¹ VARCHAR,date VARCHAR)
SELECT results¹ FROM table_name_31 WHERE date = "september 7"
How many points did the Falcons score when the record was 4-4?
CREATE TABLE table_16710971_2 (falcons_points VARCHAR,record VARCHAR)
SELECT falcons_points FROM table_16710971_2 WHERE record = "4-4"
Name the tournament for 2012 grand slam tournaments
CREATE TABLE table_15201 ("Tournament" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text)
SELECT "Tournament" FROM table_15201 WHERE "2012" = 'grand slam tournaments'
what is gender and procedure icd9 code of subject id 2560?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id te...
SELECT demographic.gender, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2560"
What is the smallest number of total medals for Georgia with 0 silver and 1 bronze?
CREATE TABLE table_39104 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Total") FROM table_39104 WHERE "Silver" > '0' AND "Nation" = 'georgia' AND "Bronze" < '1'
What was the surface in 1996?
CREATE TABLE table_name_68 (surface VARCHAR,year VARCHAR)
SELECT surface FROM table_name_68 WHERE year = 1996
tell me the diagnoses icd9 code days for which patient troy friedman was hospitalized.
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 demographic.days_stay, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Troy Friedman"
What is the density in Garran?
CREATE TABLE table_17160 ("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 MIN("Density (/km\u00b2)") FROM table_17160 WHERE "Suburb" = 'Garran'
specify the lab test abnormal status of patient jerry deberry
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT lab.flag FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Jerry Deberry"
What is the total number of losses where the byes were greater than 0?
CREATE TABLE table_78808 ("Geelong DFL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT COUNT("Losses") FROM table_78808 WHERE "Byes" > '0'
for patients who were prescribed azithromycin 500 mg iv solr, what were the five most commonly prescribed drugs at the same time?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,pat...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'azithromycin 500 mg iv solr') AS t1 JOIN (SELECT pa...
Upvoted posts for UserId with certain tag. Load all posts a certain user upvoted and filter by tag (tag1)
CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Cl...
SELECT COUNT(*) FROM Users AS u FULL OUTER JOIN Posts AS p ON p.OwnerUserId = u.Id FULL OUTER JOIN PostTags AS pt ON pt.PostId = p.Id FULL OUTER JOIN Tags AS t ON t.Id = pt.TagId WHERE u.Id = '##UserId##' AND t.TagName IN ('##Tag1:string##')
Who was the writer for season 14?
CREATE TABLE table_28043 ("Series no." real,"No. in season" real,"Title" text,"Written by" text,"Directed by" text,"Original air date" text,"U.S. viewers (millions)" text)
SELECT "Written by" FROM table_28043 WHERE "No. in season" = '14'
i need a flight from KANSAS CITY to CHICAGO that leaves wednesday and arrives in CHICAGO around 7pm
CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flight_number int,departure_time int,departure_airline text,departure_flight_number int,stop_time int)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CR...
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, date_day, days, flight WHERE (((flight.arrival_time <= 1930 AND flight.arrival_time >= 1830) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 19...
What is the smallest col where height is less than 4,274 and peak is Triglav and prominence is less than 2,052?
CREATE TABLE table_8613 ("Peak" text,"Location" text,"Height (m)" real,"Prominence (m)" real,"Col (m)" real)
SELECT MIN("Col (m)") FROM table_8613 WHERE "Height (m)" < '4,274' AND "Peak" = 'triglav' AND "Prominence (m)" < '2,052'
Which Date has a Home team of rochdale?
CREATE TABLE table_9664 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Date" FROM table_9664 WHERE "Home team" = 'rochdale'
provide the number of patients whose admission year is less than 2170 and drug name is atorvastatin?
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 procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2170" AND prescriptions.drug = "Atorvastatin"
What was the Result on July 24?
CREATE TABLE table_76421 ("Date" text,"Opponent" text,"Score" text,"Result" text,"Record" text)
SELECT "Result" FROM table_76421 WHERE "Date" = 'july 24'
get me the number of female patients who had elective hospital admission.
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 WHERE demographic.gender = "F" AND demographic.admission_type = "ELECTIVE"
What game number is the Washington team.
CREATE TABLE table_74168 ("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_74168 WHERE "Team" = 'Washington'
What is the example for the American of , , and a Semi-closed initial unstressed vowels of y / /?
CREATE TABLE table_name_73 (examples VARCHAR,american VARCHAR,semi_closed_initial_unstressed_vowels VARCHAR)
SELECT examples FROM table_name_73 WHERE american = "ɪ, ə" AND semi_closed_initial_unstressed_vowels = "y /ɨ/"
What is the type of the player who ended in 2013, had a summer transfer window, and moved from kalmar ff?
CREATE TABLE table_name_34 (type VARCHAR,moving_from VARCHAR,ends VARCHAR,transfer_window VARCHAR)
SELECT type FROM table_name_34 WHERE ends = 2013 AND transfer_window = "summer" AND moving_from = "kalmar ff"
what's the sunday s l (sun) with friday venus (venus) being vernes
CREATE TABLE table_17768 ("Day: (see Irregularities)" text,"Sunday S\u014dl (Sun)" text,"Monday Luna (Moon)" text,"Tuesday Mars (Mars)" text,"Wednesday Mercurius (Mercury)" text,"Thursday Iuppiter (Jupiter)" text,"Friday Venus (Venus)" text,"Saturday Saturnus (Saturn)" text)
SELECT "Sunday S\u014dl (Sun)" FROM table_17768 WHERE "Friday Venus (Venus)" = 'vernes'
Name the starter for position being left end
CREATE TABLE table_14342480_6 (starter VARCHAR,position VARCHAR)
SELECT starter FROM table_14342480_6 WHERE position = "Left end"
what number of patients with diagnoses titled acq coagul factor had drug route neb?
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Acq coagul factor defic" AND prescriptions.route = "NEB"
What is the 1st leg when team number 1 is CSU SIBIU?
CREATE TABLE table_name_53 (team__number1 VARCHAR)
SELECT 1 AS st_leg FROM table_name_53 WHERE team__number1 = "csu sibiu"
Who is the creator when the view happens to gddm, afp viewer?
CREATE TABLE table_1574968_1 (creator VARCHAR,viewer VARCHAR)
SELECT creator FROM table_1574968_1 WHERE viewer = "GDDM, AFP viewer"
What was the fastest lap time at the British Grand Prix with Mercedes as the constructor?
CREATE TABLE table_name_2 (fastest_lap VARCHAR,constructor VARCHAR,race VARCHAR)
SELECT fastest_lap FROM table_name_2 WHERE constructor = "mercedes" AND race = "british grand prix"
What is player Alexis Bwenge's pick number?
CREATE TABLE table_10960039_1 (pick__number VARCHAR,player VARCHAR)
SELECT pick__number FROM table_10960039_1 WHERE player = "Alexis Bwenge"
What is the average total with 1 FA cup and more than 0 FA trophies?
CREATE TABLE table_43389 ("Player" text,"Club" text,"League" real,"FA Cup" real,"FA Trophy" real,"League Cup" real,"Total" real)
SELECT AVG("Total") FROM table_43389 WHERE "FA Cup" = '1' AND "FA Trophy" > '0'
What ride opened after 2011?
CREATE TABLE table_name_91 (current_name VARCHAR,year_first_opened INTEGER)
SELECT current_name FROM table_name_91 WHERE year_first_opened > 2011
among patients tested for ascites, how many of them had icd9 code 99859?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "99859" AND lab.fluid = "Ascites"
Create a bar chart showing the total number across location, could you sort Location from low to high order?
CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_code text)CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price...
SELECT Location, COUNT(*) FROM cinema GROUP BY Location ORDER BY Location
How many assets does each maintenance contract contain? List the number and the contract id. Plot them as scatter chart.
CREATE TABLE Parts (part_id INTEGER,part_name VARCHAR(255),chargeable_yn VARCHAR(1),chargeable_amount VARCHAR(20),other_part_details VARCHAR(255))CREATE TABLE Staff (staff_id INTEGER,staff_name VARCHAR(255),gender VARCHAR(1),other_staff_details VARCHAR(255))CREATE TABLE Third_Party_Companies (company_id INTEGER,company...
SELECT COUNT(*), T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id
How many films are there in each category? List the genre name and the count with a bar chart.
CREATE TABLE inventory (inventory_id MEDIUMINT UNSIGNED,film_id SMALLINT UNSIGNED,store_id TINYINT UNSIGNED,last_update TIMESTAMP)CREATE TABLE film_actor (actor_id SMALLINT UNSIGNED,film_id SMALLINT UNSIGNED,last_update TIMESTAMP)CREATE TABLE customer (customer_id SMALLINT UNSIGNED,store_id TINYINT UNSIGNED,first_name ...
SELECT name, COUNT(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id
what are the three most frequently ordered procedures in patients with age 60 or above this year?
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 t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age >= 60) AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'st...
What is the class of car that is earlier than 2005 and has a class position of 2nd?
CREATE TABLE table_48822 ("Year" real,"Team" text,"Co-Drivers" text,"Class" text,"Laps" real,"Pos." text,"Class Pos." text)
SELECT "Class" FROM table_48822 WHERE "Year" < '2005' AND "Class Pos." = '2nd'
how many hours have elapsed since the first time that patient 032-9230 stayed in their current hospital visit in ward 1068?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientu...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '032-9230' AND patient.wardid = 1068 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1
Who was the opponent for week 6?
CREATE TABLE table_32708 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Attendance" text)
SELECT "Opponent" FROM table_32708 WHERE "Week" = '6'
what is the number of patients with chemistry lab test category who had thoracentesis procedure?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Thoracentesis" AND lab."CATEGORY" = "Chemistry"
How many points are there later than 1992?
CREATE TABLE table_35203 ("Year" real,"Class" text,"Team" text,"Points" real,"Wins" real)
SELECT COUNT("Points") FROM table_35203 WHERE "Year" > '1992'
Where did the player place who is from the United States, who made more than $216, and whose score was 74-70-71-69=284?
CREATE TABLE table_name_71 (place VARCHAR,country VARCHAR,money___$__ VARCHAR,score VARCHAR)
SELECT place FROM table_name_71 WHERE country = "united states" AND money___$__ > 216 AND score = 74 - 70 - 71 - 69 = 284
Which First elected is the highest one that has a Party of dem, and a District larger than 24, and a Home city/town of berlin?
CREATE TABLE table_5711 ("District" real,"Name" text,"Party" text,"Home city/town" text,"First elected" real)
SELECT MAX("First elected") FROM table_5711 WHERE "Party" = 'dem' AND "District" > '24' AND "Home city/town" = 'berlin'
Soft [self-learning] questions without MathJax.
CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Comments (Id number,PostId number,Score number,...
SELECT Score, Id AS "post_link", CreationDate, Tags FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '%<self-learning>%' AND (Tags LIKE '%<advice>%' OR Tags LIKE '%<soft-question>%' OR Tags LIKE '%<big-list>%' OR Tags LIKE '%<education>%' OR Tags LIKE '%<teaching>%' OR Tags = '<self-learning>' OR (NOT Body LIKE '%$%' AND ...
How many copoes per particle are created in the segment that forms inner shell of the core?
CREATE TABLE table_924 ("RNA Segment (Gene)" real,"Size (s base pair)" real,"Protein" text,"Molecular weight kDa" text,"Location" text,"Copies per particle" text,"Function" text)
SELECT "Copies per particle" FROM table_924 WHERE "Location" = 'Forms inner shell of the core'
what is language and death status of subject id 3623?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT demographic.language, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "3623"
What was the locaction of the Evans test blast?
CREATE TABLE table_56178 ("Name" text,"Location" text,"Elevation + Height" text,"Delivery" text,"Purpose" text,"Yield" text)
SELECT "Location" FROM table_56178 WHERE "Name" = 'evans'
What is the 8:00 feature with a 7:00 feature Air Farce?
CREATE TABLE table_38092 ("7:00" text,"7:30" text,"8:00" text,"8:30" text,"9:00" text,"9:30" text,"10:00" text,"10:30" text)
SELECT "8:00" FROM table_38092 WHERE "7:00" = 'air farce'
What is the number of colleges with a student population greater than 15000?
CREATE TABLE player (pid number,pname text,ycard text,hs number)CREATE TABLE college (cname text,state text,enr number)CREATE TABLE tryout (pid number,cname text,ppos text,decision text)
SELECT COUNT(*) FROM college WHERE enr > 15000
who was the only athlete to throw more than 18 meters ?
CREATE TABLE table_203_865 (id number,"place" number,"athlete" text,"nation" text,"best mark" text,"throw 1" number,"throw 2" number,"throw 3" number,"throw 4" number,"throw 5" number,"throw 6" number)
SELECT "athlete" FROM table_203_865 WHERE "best mark" > 18
modified hachinski score >= 4
CREATE TABLE table_train_76 ("id" int,"mini_mental_state_examination_mmse" int,"language" string,"csf" int,"rosen_modified_hachinski_ischemic_score" int,"ad" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_76 WHERE rosen_modified_hachinski_ischemic_score >= 4
Who recorded the decision when philadelphia was away?
CREATE TABLE table_6097 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Series" text)
SELECT "Decision" FROM table_6097 WHERE "Visitor" = 'philadelphia'
What is the local mission that has ambassador as the local position, and a mission of suriname?
CREATE TABLE table_name_13 (Local VARCHAR,local_position VARCHAR,mission VARCHAR)
SELECT Local AS mission FROM table_name_13 WHERE local_position = "ambassador" AND mission = "suriname"
has there been any organism found during the last nasopharynx microbiology test of patient 031-4987 in 11/last year?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE lab (labi...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-4987')) AND microlab.culturesite = 'nasopharynx' AND DATETIME(microlab.cul...
Who is the Japanese voice actor of Eagle Rider Ollie Keeawani?
CREATE TABLE table_name_25 (japanese_voice_actor VARCHAR,eagle_riders VARCHAR)
SELECT japanese_voice_actor FROM table_name_25 WHERE eagle_riders = "ollie keeawani"
tell me the difference of patient 594's amount of po2 measured at 2105-05-20 04:34:00 compared to the value measured at 2105-05-15 19:03:00?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE prescriptions (row_id...
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 594) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'po2') AND labevents.charttime = '2105-05-20 04:34:00') - (SELECT labevents...
Show the total number of rooms of all apartments with facility code 'Gym'.
CREATE TABLE Apartment_Facilities (apt_id VARCHAR,facility_code VARCHAR)CREATE TABLE Apartments (room_count INTEGER,apt_id VARCHAR)
SELECT SUM(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = "Gym"
How many touchdowns were there with QB rating of 66.6?
CREATE TABLE table_23999 ("Name" text,"Completions" real,"Attempts" real,"Completion %" text,"Yards" real,"Touchdowns" real,"Interceptions" real,"QB Rating" text)
SELECT "Touchdowns" FROM table_23999 WHERE "QB Rating" = '66.6'
Which player has a Position of fly-half, and a Caps of 3?
CREATE TABLE table_77716 ("Player" text,"Position" text,"Date of Birth (Age)" text,"Caps" real,"Club/province" text)
SELECT "Player" FROM table_77716 WHERE "Position" = 'fly-half' AND "Caps" = '3'
What is the livery on the locomotive with a serial number 83-1011?
CREATE TABLE table_55813 ("Locomotive" text,"Serial No" text,"Entered service" text,"Gauge" text,"Livery" text)
SELECT "Livery" FROM table_55813 WHERE "Serial No" = '83-1011'
what is subject name and discharge location of subject id 2560?
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 demographic.name, demographic.discharge_location FROM demographic WHERE demographic.subject_id = "2560"
Who was the winning team on July 13?
CREATE TABLE table_59633 ("Round" text,"Date" text,"Event" text,"Circuit" text,"Winning Driver" text,"Winning Team" text)
SELECT "Winning Team" FROM table_59633 WHERE "Date" = 'july 13'
What is the production code for the number 5 series ?
CREATE TABLE table_29031 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (millions)" text)
SELECT "Production code" FROM table_29031 WHERE "No. in series" = '5'
What is the highest number of losses with 23 points and 22 plays?
CREATE TABLE table_name_58 (lost INTEGER,points VARCHAR,played VARCHAR)
SELECT MAX(lost) FROM table_name_58 WHERE points = 23 AND played > 22
What is the lowest position with 32-6 points and less then 59 goals when there are more than 38 played?
CREATE TABLE table_name_37 (position INTEGER,played VARCHAR,points VARCHAR,goals_against VARCHAR)
SELECT MIN(position) FROM table_name_37 WHERE points = "32-6" AND goals_against < 59 AND played > 38
Percentage of questions in a given tag per week.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId numbe...
SELECT number = ROW_NUMBER() OVER (ORDER BY YEAR(CreationDate), TIME_TO_STR(CreationDate, '%W')), (CAST(SUM(CASE WHEN (Tags LIKE '%<##Tagname##>%') THEN 1 ELSE 0 END) AS FLOAT) * 100 / COUNT(Posts.Id)) AS "perc" FROM Posts WHERE (PostTypeId = 1 AND CreationDate >= '##Date1##' AND CreationDate <= '##Date2##') GROUP BY Y...
What result in 1994 has a SR as the tournament?
CREATE TABLE table_8781 ("Tournament" text,"1987" text,"1988" text,"1989" text,"1990" text,"1991" text,"1992" text,"1993" text,"1994" text,"Career SR" text)
SELECT "1994" FROM table_8781 WHERE "Tournament" = 'sr'
what was the daily maximum amount of t tube given to patient 4469 on the last icu visit?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_icd_diagnoses (row_id ...
SELECT MAX(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4469) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND outputevents.it...
What was the partner of the team that faced the guillermo garc a-l pez albert portas on clay?
CREATE TABLE table_name_45 (partner VARCHAR,surface VARCHAR,opponents VARCHAR)
SELECT partner FROM table_name_45 WHERE surface = "clay" AND opponents = "guillermo garcía-lópez albert portas"
during a year before what were the top four most frequent procedures that patients were given within 2 months after the diagnosis of nutritional deficiency?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitsta...
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'nutritional deficiency' AND DATETIME(dia...
What is the number of platforms for each location? Show the comparison with a bar chart.
CREATE TABLE station (Station_ID int,Name text,Annual_entry_exit real,Annual_interchanges real,Total_Passengers real,Location text,Main_Services text,Number_of_Platforms int)CREATE TABLE train_station (Train_ID int,Station_ID int)CREATE TABLE train (Train_ID int,Name text,Time text,Service text)
SELECT Location, SUM(Number_of_Platforms) FROM station GROUP BY Location