instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the position for the pick number 17?
CREATE TABLE table_12165135_1 (position VARCHAR,overall_pick__number VARCHAR)
SELECT position FROM table_12165135_1 WHERE overall_pick__number = 17
what's the iata for the icao of eheh?
CREATE TABLE table_69710 ("City" text,"Country" text,"IATA" text,"ICAO" text,"Airport" text)
SELECT "IATA" FROM table_69710 WHERE "ICAO" = 'eheh'
What is the start of the Team of Andretti Green Racing with a finish higher than 3 in a year before 2007?
CREATE TABLE table_62782 ("Year" real,"Chassis" text,"Engine" text,"Start" real,"Finish" real,"Team" text)
SELECT AVG("Start") FROM table_62782 WHERE "Team" = 'andretti green racing' AND "Finish" > '3' AND "Year" < '2007'
when the area (km ) is 22721, what is the pop./ km ?
CREATE TABLE table_2252745_1 (pop__km² VARCHAR,area__km²_ VARCHAR)
SELECT pop__km² FROM table_2252745_1 WHERE area__km²_ = 22721
count the number of patients whose death status is 1 and age is less than 77?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.age < "77"
Name the most draws when wins is 3
CREATE TABLE table_1126 ("Position" real,"Team" text,"Played" real,"Wins" real,"Draws" real,"Losses" real,"Scored" real,"Conceded" real,"Points" real)
SELECT MAX("Draws") FROM table_1126 WHERE "Wins" = '3'
how many hours has it been since first time patient 009-5001 had a procedure on this hospital visit?
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 microlab (microlabid number,patientunitstayid number...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-5001'...
Why is bounty start/close timing data removed from the data explorer?. http://meta.stackexchange.com/questions/281217/why-is-bounty-start-close-timing-data-removed-from-the-data-explorer
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Tags (Id ...
SELECT v.PostId, v.CreationDate, ph.CreationDate, ph.Text, ph.Comment, v.BountyAmount FROM Votes AS v INNER JOIN PostHistory AS ph ON ph.PostId = v.PostId WHERE (v.VoteTypeId = 8 AND ph.PostHistoryTypeId = 33)
Which Opponent has an Attendance greater than 14,431 during Week 3 at Bears Stadium Game site?
CREATE TABLE table_60018 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Game site" text,"Record" text,"Attendance" real)
SELECT "Opponent" FROM table_60018 WHERE "Attendance" > '14,431' AND "Game site" = 'bears stadium' AND "Week" = '3'
Who's the partner at Tamara, Hon?
CREATE TABLE table_18268930_1 (partner VARCHAR,location VARCHAR)
SELECT partner FROM table_18268930_1 WHERE location = "Tamara, HON"
When guiguinto, bulacan is the home or representative town or province how many names are there?
CREATE TABLE table_22782 ("Name" text,"Home or representative town or province" text,"Age" real,"Edition" text,"Total days in PBB House" real,"Duration" text,"Status" text)
SELECT COUNT("Name") FROM table_22782 WHERE "Home or representative town or province" = 'Guiguinto, Bulacan'
Which result has a Goal of deacon 3/5, bridge 2/2?
CREATE TABLE table_name_38 (result VARCHAR,goals VARCHAR)
SELECT result FROM table_name_38 WHERE goals = "deacon 3/5, bridge 2/2"
What is the production code for the episode written by J. H. Wyman & Jeff Pinkner?
CREATE TABLE table_24649082_1 (production_code VARCHAR,written_by VARCHAR)
SELECT production_code FROM table_24649082_1 WHERE written_by = "J. H. Wyman & Jeff Pinkner"
What year saw an award in the category of Revelation?
CREATE TABLE table_name_73 (year VARCHAR,category VARCHAR)
SELECT year FROM table_name_73 WHERE category = "revelation"
What label has a catalog of chem036cd?
CREATE TABLE table_74755 ("Region" text,"Date" text,"Label" text,"Format" text,"Catalog" text)
SELECT "Label" FROM table_74755 WHERE "Catalog" = 'chem036cd'
Find the number of students for each department Plot them as bar chart, I want to list by the names in asc.
CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE EMPLOYEE (EMP_NUM int,EMP_LNAME varchar(15),EMP_FNAME varchar(12),EMP_INITIAL varchar(1),EMP_JOBCODE varchar(5),EMP_HIREDATE datetime,EMP_DOB datetime)C...
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE
Which champion was from the location of Morrisville, NC, and whose SemiFinalist #2 of Clemson?
CREATE TABLE table_56691 ("Year" real,"Champion" text,"Score" text,"Runner-Up" text,"Location" text,"Semi-Finalist #1" text,"Semi-Finalist #2" text)
SELECT "Champion" FROM table_56691 WHERE "Location" = 'morrisville, nc' AND "Semi-Finalist #2" = 'clemson'
Which france nationality has a lane larger than 3?
CREATE TABLE table_69914 ("Rank" real,"Lane" real,"Name" text,"Nationality" text,"Time" text)
SELECT "Name" FROM table_69914 WHERE "Lane" > '3' AND "Nationality" = 'france'
Who was the driver for the Richard Childress Racing team in the race with a time of 2:58:22?
CREATE TABLE table_2266762_1 (driver VARCHAR,team VARCHAR,race_time VARCHAR)
SELECT driver FROM table_2266762_1 WHERE team = "Richard Childress Racing" AND race_time = "2:58:22"
What are the lengths of the models that are mm (in) tall?
CREATE TABLE table_72927 ("Body style" text,"Wheelbase" text,"Length" text,"Height" text,"Curb weight" text)
SELECT "Length" FROM table_72927 WHERE "Height" = 'mm (in)'
What is the sum of % for 2001 if 2001 seats equals 7?
CREATE TABLE table_name_32 (_percentage_2001 VARCHAR,seats_2001 VARCHAR)
SELECT COUNT(_percentage_2001) FROM table_name_32 WHERE seats_2001 = 7
Which civil parish is for the townland clooncugger?
CREATE TABLE table_30121096_1 (civil_parish VARCHAR,townland VARCHAR)
SELECT civil_parish FROM table_30121096_1 WHERE townland = "Clooncugger"
For each product type, show the relationship between minimum product price and maximum product price in a scatter chart.
CREATE TABLE Department_Stores (dept_store_id INTEGER,dept_store_chain_id INTEGER,store_name VARCHAR(80),store_address VARCHAR(255),store_phone VARCHAR(80),store_email VARCHAR(80))CREATE TABLE Customer_Orders (order_id INTEGER,customer_id INTEGER,order_status_code VARCHAR(10),order_date DATETIME)CREATE TABLE Customers ...
SELECT MAX(product_price), MIN(product_price), product_type_code FROM Products GROUP BY product_type_code
What is the average amount of goals that has a points smaller of 882, less than 5 field goals, and less than 85 tries all by Ty Williams.
CREATE TABLE table_53690 ("Points" real,"Player" text,"Tries" real,"Goals" real,"Field Goals" real)
SELECT AVG("Goals") FROM table_53690 WHERE "Points" < '882' AND "Field Goals" < '5' AND "Player" = 'ty williams' AND "Tries" < '85'
What is the M60A3 that has 40 rounds as Leclerc?
CREATE TABLE table_61161 ("Lince" text,"Leopard 2A4" text,"Leclerc" text,"M1A1 Abrams" text,"M60A3 Patton" text)
SELECT "M60A3 Patton" FROM table_61161 WHERE "Leclerc" = '40 rounds'
Top User Of Hong Kong.
CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans...
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.Id =...
Which district has an IUCN of iii and was established in 1998?
CREATE TABLE table_name_44 (district VARCHAR,iucn VARCHAR,est VARCHAR)
SELECT district FROM table_name_44 WHERE iucn = "iii" AND est = 1998
What NFL Teams have the player Aaron Williams?
CREATE TABLE table_2508633_11 (nfl_team VARCHAR,player VARCHAR)
SELECT nfl_team FROM table_2508633_11 WHERE player = "Aaron Williams"
Is 398 offered next semester and when ?
CREATE TABLE area (course_id int,area varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled ...
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offe...
What is surfside beach, SC frequency?
CREATE TABLE table_38631 ("Call sign" text,"Frequency MHz" text,"City of license" text,"ERP W" real,"Class" text,"FCC info" text)
SELECT "Frequency MHz" FROM table_38631 WHERE "City of license" = 'surfside beach, sc'
What is the second year course in the program where physics is taken in the fourth year?
CREATE TABLE table_12148147_2 (second_year VARCHAR,fourth_year VARCHAR)
SELECT second_year FROM table_12148147_2 WHERE fourth_year = "Physics"
what's the chroma format with name being high profile
CREATE TABLE table_1376890_2 (chroma_format VARCHAR,name VARCHAR)
SELECT chroma_format FROM table_1376890_2 WHERE name = "High profile"
Will taking the 615 and 554 allow me to leave for work at 5 each day ?
CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits var...
SELECT COUNT(*) = 0 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.number = 615 OR course.number = 554) AND course_offering.end_time > '17:00:00' AND semester.semester = 'WN' AND semester.year = ...
what does a lab hemoglobin test cost?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title 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 cost (row_id number,subject_id number,hadm_id number,event_type text,event_id...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hemoglobin'))
Where was the game on November 20?
CREATE TABLE table_10812293_3 (location_attendance VARCHAR,date VARCHAR)
SELECT location_attendance FROM table_10812293_3 WHERE date = "November 20"
For each film, return the number of cinemas showing that fim in a bar chart, and I want to order by the the number of title in asc.
CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price float)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,Locatio...
SELECT Title, COUNT(Title) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Title ORDER BY COUNT(Title)
How many games played for the army team with over 51 points and under 5 games drawn?
CREATE TABLE table_name_81 (played VARCHAR,points VARCHAR,drawn VARCHAR,team VARCHAR)
SELECT COUNT(played) FROM table_name_81 WHERE drawn < 5 AND team = "army" AND points > 51
How many users have 30k+?.
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT COUNT(*) AS users FROM Users WHERE Reputation >= 30000
count of comments for questions.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number...
SELECT UserId FROM Comments WHERE NOT UserId IS NULL GROUP BY UserId ORDER BY COUNT(*) DESC
How many FA cups were there without any league cups, but a total of 0 2?
CREATE TABLE table_67085 ("Name" text,"Championship" real,"League Cup" real,"FA Cup" real,"Total" text)
SELECT MIN("FA Cup") FROM table_67085 WHERE "Total" = '0 2' AND "League Cup" < '0'
Which smallest interview number had a swimsuit stat of less than 9.322, an evening gown score of more than 9.259, and an average number of 9.321?
CREATE TABLE table_11395 ("State" text,"Interview" real,"Swimsuit" real,"Evening Gown" real,"Average" real)
SELECT MIN("Interview") FROM table_11395 WHERE "Swimsuit" < '9.322' AND "Evening Gown" > '9.259' AND "Average" = '9.321'
How much cash was on hand after debt of $82,741?
CREATE TABLE table_53759 ("Candidate" text,"Money Raised,3Q" text,"Loans Received,3Q" text,"Money Spent,3Q" text,"Total Receipts" text,"Cash On Hand" text,"Total Debt" text,"After Debt" text)
SELECT "Cash On Hand" FROM table_53759 WHERE "After Debt" = '$82,741'
what team had the worst win/tie/loss record ?
CREATE TABLE table_200_4 (id number,"team" text,"p" number,"w" number,"t" number,"l" number,"gf" number,"ga" number,"gd" number,"pts." number)
SELECT "team" FROM table_200_4 ORDER BY "pts." LIMIT 1
what was the last weight for patient 021-250695 during the last hospital visit?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE cost (costid number,uniquepid text,pati...
SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-250695' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) AND NOT patient.admissionweight IS NULL ORDE...
Show member names without any registered branch.
CREATE TABLE branch (branch_id number,name text,open_year text,address_road text,city text,membership_amount text)CREATE TABLE membership_register_branch (member_id number,branch_id text,register_year text)CREATE TABLE member (member_id number,card_number text,name text,hometown text,level number)CREATE TABLE purchase ...
SELECT name FROM member WHERE NOT member_id IN (SELECT member_id FROM membership_register_branch)
Who is the entrant when the engine is talbot l6 and the driver is pierre levegh?
CREATE TABLE table_name_90 (entrant VARCHAR,engine VARCHAR,driver VARCHAR)
SELECT entrant FROM table_name_90 WHERE engine = "talbot l6" AND driver = "pierre levegh"
tell me the number of times that patient 95892 has received an mcv lab test during this month.
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 diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text...
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'mcv') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95892) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'star...
how many patients did a wbc pleural lab test and had the results show abnormal 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 procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "WBC, Pleural"
Which Third has a Lead of zanda bik e?
CREATE TABLE table_name_78 (third VARCHAR,lead VARCHAR)
SELECT third FROM table_name_78 WHERE lead = "zanda bikše"
When mega pass* (senior/disabled) is the type of fare what is the cash fare?
CREATE TABLE table_20803241_1 (cash_fare VARCHAR,type_of_fare VARCHAR)
SELECT cash_fare FROM table_20803241_1 WHERE type_of_fare = "Mega Pass* (Senior/Disabled)"
Who was the driver of the Ford EDB 3.0 v8 engine?
CREATE TABLE table_11747 ("Entrant" text,"Constructor" text,"Chassis" text,"Engine" text,"Tyre" text,"Driver" text,"Rounds" text)
SELECT "Driver" FROM table_11747 WHERE "Engine" = 'ford edb 3.0 v8'
What is the name of the team with the Away score of 12.13 (85)?
CREATE TABLE table_11057 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team" FROM table_11057 WHERE "Away team score" = '12.13 (85)'
What are the most laps for the Qual position of 7 in the OC class?
CREATE TABLE table_name_62 (laps INTEGER,class VARCHAR,qual_pos VARCHAR)
SELECT MAX(laps) FROM table_name_62 WHERE class = "oc" AND qual_pos = 7
Which catalog value has a region of world?
CREATE TABLE table_name_34 (catalog VARCHAR,region VARCHAR)
SELECT catalog FROM table_name_34 WHERE region = "world"
What percentage of browsers were using Chrome during the period in which 0.30% were using Opera and 6.77% were using Safari?
CREATE TABLE table_65831 ("Internet Explorer" text,"Firefox,Other Mozilla" text,"Chrome" text,"Safari" text,"Opera" text)
SELECT "Chrome" FROM table_65831 WHERE "Opera" = '0.30%' AND "Safari" = '6.77%'
When was 'Tell You When' released?
CREATE TABLE table_21138 ("Cat. #" text,"Artist" text,"Title" text,"Release date" text,"Format" text,"Other information" text)
SELECT "Release date" FROM table_21138 WHERE "Title" = 'Tell You When'
Show a bar graph, the data is those times of trains that run through stations for the local authority Chiltern, and the Y axis is the total number of different times, display X from low to high order please.
CREATE TABLE station (id int,network_name text,services text,local_authority text)CREATE TABLE route (train_id int,station_id int)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 t...
SELECT time, COUNT(time) 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 time ORDER BY time
What score has wynne prakusya as the opponent in the final?
CREATE TABLE table_68036 ("Date" text,"Tournament" text,"Surface" text,"Opponent in the Final" text,"Score" text)
SELECT "Score" FROM table_68036 WHERE "Opponent in the Final" = 'wynne prakusya'
What is the total game number with athlone town as the opponent?
CREATE TABLE table_name_95 (game VARCHAR,opponent VARCHAR)
SELECT COUNT(game) FROM table_name_95 WHERE opponent = "athlone town"
How many storms had death records?
CREATE TABLE storm (Number_Deaths INTEGER)
SELECT COUNT(*) FROM storm WHERE Number_Deaths > 0
Find posts where you offered more than one bounty.
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 Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score ...
SELECT PostId AS "post_link", COUNT(*) AS Bounties FROM Votes WHERE VoteTypeId = 8 AND UserId = '##UserId##' GROUP BY PostId ORDER BY Bounties DESC
return me the number of the keywords of ' Making database systems usable ' .
CREATE TABLE domain_journal (did int,jid int)CREATE TABLE publication (abstract varchar,cid int,citation_num int,jid int,pid int,reference_num int,title varchar,year int)CREATE TABLE domain (did int,name varchar)CREATE TABLE author (aid int,homepage varchar,name varchar,oid int)CREATE TABLE publication_keyword (kid int...
SELECT COUNT(DISTINCT (keyword.keyword)) FROM keyword, publication, publication_keyword WHERE publication_keyword.kid = keyword.kid AND publication.pid = publication_keyword.pid AND publication.title = 'Making database systems usable'
how patient 028-45936 was first admitted to hospital during this year?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text...
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '028-45936' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY patient.hospitaladmittime LIMIT 1
what is the code for BUSINESS class
CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time i...
SELECT DISTINCT fare.fare_basis_code FROM fare, fare_basis WHERE fare_basis.class_type = 'BUSINESS' AND fare.fare_basis_code = fare_basis.fare_basis_code
Name the mountains classification for rabobank and damiano cunego
CREATE TABLE table_29077342_19 (mountains_classification VARCHAR,team_classification VARCHAR,general_classification VARCHAR)
SELECT mountains_classification FROM table_29077342_19 WHERE team_classification = "Rabobank" AND general_classification = "Damiano Cunego"
What was the date for the French Grand Prix?
CREATE TABLE table_69593 ("Name" text,"Circuit" text,"Date" text,"Winning drivers" text,"Winning constructor" text,"Report" text)
SELECT "Date" FROM table_69593 WHERE "Name" = 'french grand prix'
What was the record of the series at the game attended by 17,181 and a loss of Giguere (0 1)?
CREATE TABLE table_51274 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Series" text,"Arena" text)
SELECT "Series" FROM table_51274 WHERE "Attendance" > '17,181' AND "Loss" = 'giguere (0–1)'
What is the average base price of rooms, for each bed type Plot them as bar chart, and display total number in asc order.
CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT)CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY AVG(basePrice)
What is the score for the away team when South Melbourne was the home team?
CREATE TABLE table_name_58 (away_team VARCHAR,home_team VARCHAR)
SELECT away_team AS score FROM table_name_58 WHERE home_team = "south melbourne"
how much does a medical diagnosis of poisoning-barbiturates cost?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,l...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'poisoning-barbiturates'))
100k rep users eligible for swag.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId n...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC), ROW_NUMBER() OVER (ORDER BY CreationDate), * FROM Users WHERE Reputation >= 100000 ORDER BY Reputation DESC
What is the final position for the season 2012?
CREATE TABLE table_name_70 (final_position VARCHAR,season VARCHAR)
SELECT final_position FROM table_name_70 WHERE season = "2012"
Where did they play in week 14?
CREATE TABLE table_14455 ("Week" text,"Opponent" text,"Result" text,"Game site" text,"Attendance" text)
SELECT "Game site" FROM table_14455 WHERE "Week" = '14'
what is the margin of victory when the runner-up is amy alcott and the winning score is 9 (72-68-67=207)?
CREATE TABLE table_name_78 (margin_of_victory VARCHAR,runner_s__up VARCHAR,winning_score VARCHAR)
SELECT margin_of_victory FROM table_name_78 WHERE runner_s__up = "amy alcott" AND winning_score = –9(72 - 68 - 67 = 207)
Show the average of weight from each sex, show by the Sex in desc.
CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex ORDER BY Sex DESC
Which outgoing manager was replaced by Jafar Fatahi?
CREATE TABLE table_24905 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text)
SELECT "Outgoing manager" FROM table_24905 WHERE "Replaced by" = 'Jafar Fatahi'
Who built the Jim Crawford car?
CREATE TABLE table_74645 ("Entrant" text,"Constructor" text,"Chassis" text,"Engine" text,"Driver" text)
SELECT "Constructor" FROM table_74645 WHERE "Driver" = 'jim crawford'
What's the 1996 if 1986 has a 1R?
CREATE TABLE table_name_53 (Id VARCHAR)
SELECT 1996 FROM table_name_53 WHERE 1986 = "1r"
What is the format of the album with a year less than 1992?
CREATE TABLE table_41704 ("Album title" text,"Format" text,"Year" real,"Original label" text,"Chart positions" text)
SELECT "Format" FROM table_41704 WHERE "Year" < '1992'
how many patients received analgesics - non-narcotic analgesic after the first procedure of the cultures - blood within 2 months until 4 years ago?
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 COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'cultures - blood' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-4 year')) AS t1 JOIN (...
what was the difference in the weight of patient 2518 measured at 2105-12-30 09:00:00 compared to the value measured at 2105-12-29 21:00:00.
CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE inputevents_cv (row_id ...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2518)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'ad...
What's the average Grid with Laps of 88?
CREATE TABLE table_57427 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT AVG("Grid") FROM table_57427 WHERE "Laps" = '88'
Which venue has a Result of 1 2?
CREATE TABLE table_52484 ("Date" text,"Venue" text,"Result" text,"Scored" real,"Competition" text)
SELECT "Venue" FROM table_52484 WHERE "Result" = '1–2'
show me the latest DINNER flight from BALTIMORE to OAKLAND
CREATE TABLE month (month_number int,month_name text)CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,lengt...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight, food_service WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND food_s...
What is the entered number for the person with a time of 29:28?
CREATE TABLE table_name_74 (entered VARCHAR,time VARCHAR)
SELECT entered FROM table_name_74 WHERE time = "29:28"
Which Release date has a sSpec number of sr0pk(e1)?
CREATE TABLE table_name_55 (release_date VARCHAR,sspec_number VARCHAR)
SELECT release_date FROM table_name_55 WHERE sspec_number = "sr0pk(e1)"
what was the average qualifying score for the u.s. championships ?
CREATE TABLE table_204_975 (id number,"year" number,"competition" text,"location" text,"event" text,"final-rank" text,"final-score" number,"qualifying rank" number,"qualifying score" number)
SELECT AVG("qualifying score") FROM table_204_975 WHERE "competition" = 'u.s. championships'
What is the song name with a Volume:Issue was 70:8-9?
CREATE TABLE table_47052 ("Volume:Issue" text,"Issue Date(s)" text,"Weeks on Top" text,"Song" text,"Artist" text)
SELECT "Song" FROM table_47052 WHERE "Volume:Issue" = '70:8-9'
What are the dates of birth of entrepreneurs with investor 'Simon Woodroffe' or 'Peter Jones'?
CREATE TABLE entrepreneur (People_ID VARCHAR,Investor VARCHAR)CREATE TABLE people (Date_of_Birth VARCHAR,People_ID VARCHAR)
SELECT T2.Date_of_Birth FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones"
What is the smallest number of fastest laps listed?
CREATE TABLE table_19312274_3 (fastest_laps INTEGER)
SELECT MIN(fastest_laps) FROM table_19312274_3
What is the lowest Tournaments, when Name is 'Baruto'?
CREATE TABLE table_58792 ("Name" text,"Tournaments" real,"Pro Debut" text,"Top division debut" text,"Highest rank" text)
SELECT MIN("Tournaments") FROM table_58792 WHERE "Name" = 'baruto'
find travel arrangements for a round trip flight from DALLAS to PITTSBURGH
CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE month (month_number int,month_name text)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE fa...
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, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND NOT fare.round_trip_cost IS NULL AND flight_fare.fare_...
Compute the total total number of total passengers across location as a pie 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(Total_Passengers) FROM station GROUP BY Location
count the number of patients who were diagnosed with acute necrosis of liver in the same hospital visit after they were diagnosed with nb obsrv suspct infect during this year.
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 diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_labitems (row_id number,itemid number,lab...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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 =...
How many episodes were written by Kirstie Falkous & John Regier?
CREATE TABLE table_24060 ("Episode No." real,"Title" text,"Directed by" text,"Written by" text,"Viewers (millions)" text,"Original airdate" text)
SELECT COUNT("Episode No.") FROM table_24060 WHERE "Written by" = 'Kirstie Falkous & John Regier'
How many weeks on top was the single from Savage Garden?
CREATE TABLE table_name_16 (weeks_on_top VARCHAR,artist VARCHAR)
SELECT weeks_on_top FROM table_name_16 WHERE artist = "savage garden"
Show the musical nominee with award 'Bob Fosse' or 'Cleavant Derricks'.
CREATE TABLE musical (Nominee VARCHAR,Award VARCHAR)
SELECT Nominee FROM musical WHERE Award = "Tony Award" OR Award = "Cleavant Derricks"
Which Result has a Venue of kinnarps arena, and a Date of thursday, february 19?
CREATE TABLE table_13414 ("Round" real,"Date" text,"Home" text,"Result" text,"Visitor" text,"Venue" text,"Attendance" real)
SELECT "Result" FROM table_13414 WHERE "Venue" = 'kinnarps arena' AND "Date" = 'thursday, february 19'
What city has trojans as the team, and taylor as the school?
CREATE TABLE table_36466 ("School" text,"Team" text,"City" text,"State" text,"Conference" text)
SELECT "City" FROM table_36466 WHERE "Team" = 'trojans' AND "School" = 'taylor'
What courses in Fall or Winter will satisfy my Core requirement ?
CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree varchar,minor varchar,internship varchar)CREATE TABLE ta (campus_job_id int,student_id int,location var...
SELECT DISTINCT COURSEalias0.department, COURSEalias0.name, COURSEalias0.number, SEMESTERalias0.semester FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, program_course AS PROGRAM_COURSEalias0...