instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
when the max speed for modified speed (6th gear) where standard speed (6th gear) is 98
CREATE TABLE table_19704392_1 (modified_speed__6th_gear_ INTEGER,standard_speed__6th_gear_ VARCHAR)
SELECT MAX(modified_speed__6th_gear_) FROM table_19704392_1 WHERE standard_speed__6th_gear_ = "98"
When 1 is the number what episodes were used?
CREATE TABLE table_2144389_9 (episodes_used VARCHAR,_number VARCHAR)
SELECT episodes_used FROM table_2144389_9 WHERE _number = 1
what are the four most commonly given lab tests last year for patients who were previously diagnosed with hx of kidney malignancy in the same hospital visit?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE microbiologyevents (row_id number,subject_i...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id W...
Who was the rider riding the Kawasaki ZX-6r, that rode less than 22 laps, and the grid was greater than 19, and retirement was the time?
CREATE TABLE table_name_64 (rider VARCHAR,bike VARCHAR,time VARCHAR,laps VARCHAR,grid VARCHAR)
SELECT rider FROM table_name_64 WHERE laps < 22 AND grid > 19 AND time = "retirement" AND bike = "kawasaki zx-6r"
piperacillin-tazobactam 3.375 g ivpb what is the price?
CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'piperacillin-tazobactam 3.375 g ivpb')
what is admission time and diagnoses long title of subject id 813?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id t...
SELECT demographic.admittime, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "813"
Where was game number 5 played?
CREATE TABLE table_25882 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text)
SELECT "Location Attendance" FROM table_25882 WHERE "Game" = '5'
Starting point for 'real world questions are on-topic' comments.
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostI...
SELECT DISTINCT CONCAT('https://worldbuilding.stackexchange.com/questions/', Posts.ParentId, '/', CommentsAboutOntopic.PostId, '#comment', CommentsAboutOntopic.Id, '_', CommentsAboutOntopic.PostId) AS Link, CommentsAboutOntopic.Text, CommentsAboutOntopic.CreationDate FROM (SELECT * FROM Comments WHERE LOWER(Text) LIKE ...
Name the number of date for 1-0 record
CREATE TABLE table_24111 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Black Knights points" real,"Opponents" real,"Record" text)
SELECT COUNT("Date") FROM table_24111 WHERE "Record" = '1-0'
do you have a flight leaving BOSTON at 645 going to WASHINGTON
CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE month (month_number int,month_name text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE code_description (code varchar,description t...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.departure_time = 645 AND flight.to_airport = AIRPORT_SERVICE_1.air...
What is the percentage of females where the state code is a 4?
CREATE TABLE table_19425 ("State/UT Code" real,"India/State/UT" text,"Literate Persons (%)" text,"Males (%)" text,"Females (%)" text)
SELECT "Females (%)" FROM table_19425 WHERE "State/UT Code" = '4'
Answers by Time of Day. Designed to consider whether 'night' questions have more visibility than 'day' questions
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostNotices (Id n...
SELECT TIME_TO_STR(Posts.CreationDate, '%h') AS Hour, COUNT(Posts.Id) AS Questions FROM Posts WHERE PostTypeId = 2 GROUP BY TIME_TO_STR(Posts.CreationDate, '%h') ORDER BY TIME_TO_STR(Posts.CreationDate, '%h')
Answers to old unanswered questions.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,D...
SELECT A.Id AS "post_link", A.Score, (CASE WHEN Q.AcceptedAnswerId = A.Id THEN 1 ELSE 0 END) AS Accepted, A.OwnerUserId AS "user_link" FROM Posts AS A INNER JOIN Posts AS Q ON A.ParentId = Q.Id WHERE A.CreationDate BETWEEN @StartTime AND @EndTime AND Q.PostTypeId = 1 AND Q.ClosedDate IS NULL AND Q.CreationDate < @AskTi...
What is the lowest population (2000 Census) that has a population (2010 Census) larger than 1,071,913 and municipality of Suwon?
CREATE TABLE table_41124 ("Rank" real,"Municipality" text,"Population (2010 Census)" real,"Population (2005 Census)" real,"Population (2000 Census)" real)
SELECT MIN("Population (2000 Census)") FROM table_41124 WHERE "Municipality" = 'suwon' AND "Population (2010 Census)" > '1,071,913'
Which Census Ranking has a Population smaller than 879, and an Area km 2 larger than 537.62?
CREATE TABLE table_name_36 (census_ranking VARCHAR,population VARCHAR,area_km_2 VARCHAR)
SELECT census_ranking FROM table_name_36 WHERE population < 879 AND area_km_2 > 537.62
Who played on waca ground and scored 79 points?
CREATE TABLE table_69657 ("Player" text,"Score" text,"Balls" real,"Opponent" text,"Ground" text)
SELECT "Opponent" FROM table_69657 WHERE "Ground" = 'waca ground' AND "Score" = '79'
what is the number of patients having delayed clos abd wound in 2103?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE microbiologyevents (row_id number,subject_i...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'delayed clos abd wound') AND STRFTIME('%y', procedur...
Find the state, account type, and credit score of the customer whose number of loan is 0.
CREATE TABLE customer (state VARCHAR,acc_type VARCHAR,credit_score VARCHAR,no_of_loans VARCHAR)
SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0
what is the finish when the country is united states and the player is tiger woods?
CREATE TABLE table_name_51 (finish VARCHAR,country VARCHAR,player VARCHAR)
SELECT finish FROM table_name_51 WHERE country = "united states" AND player = "tiger woods"
patient 26469 underwent any lt heart angiocardiogram procedure?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status t...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'lt heart angiocardiogram') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26469)
What is the hometown of the pitcher who's school was Saint Joseph Regional High School?
CREATE TABLE table_17053 ("Player" text,"Position" text,"School" text,"Hometown" text,"MLB Draft" text)
SELECT "Hometown" FROM table_17053 WHERE "Position" = 'Pitcher' AND "School" = 'Saint Joseph Regional High School'
how many patients are with medicaid insurance and diagnosed with retained plastic fragments?
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.long_title = "Retained plastic fragments"
Who led with the highest points during the game against Indiana?
CREATE TABLE table_2856 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "High points" FROM table_2856 WHERE "Team" = 'Indiana'
Which Pick # is the lowest one that has a College of troy state, and a Name of reggie dwight, and an Overall smaller than 217?
CREATE TABLE table_39493 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT MIN("Pick #") FROM table_39493 WHERE "College" = 'troy state' AND "Name" = 'reggie dwight' AND "Overall" < '217'
give me the number of patients whose diagnoses long title is diabetes with ketoacidosis, type i [juvenile type], not stated as uncontrolled and lab test abnormal status is abnormal?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Diabetes with ketoacidosis, type I [juvenile type], not stated as uncontrolled" AND lab.flag = "abnormal"
How many players led Game #66 in scoring?
CREATE TABLE table_13619053_8 (high_points VARCHAR,game VARCHAR)
SELECT COUNT(high_points) FROM table_13619053_8 WHERE game = 66
what is gender of subject id 17787?
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 demographic (subject_id text,hadm_id t...
SELECT demographic.gender FROM demographic WHERE demographic.subject_id = "17787"
451 is taught by professors other than Prof. Mark Oyen ?
CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,...
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 451 AND NOT instructor.name LIKE '%Mark Oyen%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering...
Report the number of students in each classroom.
CREATE TABLE teachers (lastname text,firstname text,classroom number)CREATE TABLE list (lastname text,firstname text,grade number,classroom number)
SELECT classroom, COUNT(*) FROM list GROUP BY classroom
how many times after the year 1989 did she come in 1st position ?
CREATE TABLE table_203_651 (id number,"year" number,"competition" text,"venue" text,"position" text,"notes" text)
SELECT COUNT(*) FROM table_203_651 WHERE "position" = 1 AND "year" > 1989
who was the Stage winner when the stage was smaller than 16, earlier than 1986, and a distance (km) was 19.6?
CREATE TABLE table_13568 ("Year" real,"Stage" real,"Start of stage" text,"Distance (km)" text,"Category of climb" text,"Stage winner" text,"Yellow jersey" text)
SELECT "Stage winner" FROM table_13568 WHERE "Stage" < '16' AND "Year" < '1986' AND "Distance (km)" = '19.6'
Name the 2012 with 2013 of 2r and 2009 of 3r
CREATE TABLE table_37810 ("Tournament" text,"2006" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text,"2013" text)
SELECT "2012" FROM table_37810 WHERE "2013" = '2r' AND "2009" = '3r'
The successor for the Massachusetts 20th district was seated on what date?
CREATE TABLE table_25068 ("District" text,"Vacator" text,"Reason for change" text,"Successor" text,"Date successor seated" text)
SELECT "Date successor seated" FROM table_25068 WHERE "District" = 'Massachusetts 20th'
What is the highest To Par, when Score is '72-73=145'?
CREATE TABLE table_47826 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" real)
SELECT MAX("To par") FROM table_47826 WHERE "Score" = '72-73=145'
how many time is the final record is 9 16 5?
CREATE TABLE table_26967 ("Season" real,"Regular Season" text,"Playoffs" text,"U.S. Open Cup" text,"CONCACAF" text,"Final Record" text)
SELECT COUNT("Season") FROM table_26967 WHERE "Final Record" = '9–16–5'
show me the flights to DAL from all other airports
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 code_description (code varchar,description text)CREATE TABLE month (month_number int,month_name text)CREATE TABLE airline (air...
SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE airport.airport_code = 'DAL' AND city.city_code = airport_service.city_code AND flight.from_airport = airport_service.airport_code AND flight.to_airport = airport.airport_code
Find the name of the project for which a scientist whose name contains Smith is assigned to, and count them by a bar chart, could you order by the x-axis in descending?
CREATE TABLE Projects (Code Char(4),Name Char(50),Hours int)CREATE TABLE Scientists (SSN int,Name Char(30))CREATE TABLE AssignedTo (Scientist int,Project char(4))
SELECT T2.Name, COUNT(T2.Name) FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name LIKE '%Smith%' GROUP BY T2.Name ORDER BY T2.Name DESC
please list the ground transportation from LGA into NEW YORK
CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_...
SELECT DISTINCT transport_type FROM ground_service WHERE (airport_code IN (SELECT AIRPORTalias0.airport_code FROM airport AS AIRPORTalias0 WHERE AIRPORTalias0.airport_code = 'LGA') AND city_code IN (SELECT CITYalias0.city_code FROM city AS CITYalias0 WHERE CITYalias0.city_name = 'NEW YORK'))
what is the number of patients whose hospital stay is above 0 days and underwent procedure intravenous infusion of clofarabine?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "0" AND procedures.long_title = "Intravenous infusion of clofarabine"
What's the lowest total when the floor exercise is less than 36.724 and the rank is lower than 8?
CREATE TABLE table_name_13 (total INTEGER,floor_exercise VARCHAR,rank VARCHAR)
SELECT MIN(total) FROM table_name_13 WHERE floor_exercise < 36.724 AND rank < 8
what is the total amount of times they played against opponent @min ?
CREATE TABLE table_203_536 (id number,"#" number,"date" text,"opponent" text,"score" text,"win" text,"loss" text,"save" text,"crowd" number,"record" text)
SELECT COUNT(*) FROM table_203_536 WHERE "opponent" = '@min'
Attendance of 23,150 had what opponent?
CREATE TABLE table_36902 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" text,"Record" text)
SELECT "Opponent" FROM table_36902 WHERE "Attendance" = '23,150'
What is the number of production codes for episode #73?
CREATE TABLE table_3517 ("Episode #" text,"Season Episode #" text,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Prod. code" text)
SELECT COUNT("Prod. code") FROM table_3517 WHERE "Episode #" = '73'
Which Director has a Role of melissa?
CREATE TABLE table_34866 ("Year" text,"Title" text,"Role" text,"Producer" text,"Director" text)
SELECT "Director" FROM table_34866 WHERE "Role" = 'melissa'
how many airport with rank being 4
CREATE TABLE table_13836704_9 (airport VARCHAR,rank VARCHAR)
SELECT COUNT(airport) FROM table_13836704_9 WHERE rank = 4
When was terry cook picked?
CREATE TABLE table_51891 ("Pick" real,"Round" text,"Player" text,"Position" text,"School" text)
SELECT AVG("Pick") FROM table_51891 WHERE "Player" = 'terry cook'
If the floor number is 14.200, what is the number for the parallel bars?
CREATE TABLE table_18662026_10 (parallel_bars VARCHAR,floor VARCHAR)
SELECT parallel_bars FROM table_18662026_10 WHERE floor = "14.200"
What home team played against Richmond?
CREATE TABLE table_52073 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team" FROM table_52073 WHERE "Away team" = 'richmond'
how many of the divorcee patients had icd9 code 8968?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.icd9_code = "8968"
What is the score for Ky Laffoon?
CREATE TABLE table_name_22 (score VARCHAR,player VARCHAR)
SELECT score FROM table_name_22 WHERE player = "ky laffoon"
Return a bar chart on what are the different ship flags, and how many ships have each?, order in asc by the bar.
CREATE TABLE captain (Captain_ID int,Name text,Ship_ID int,age text,Class text,Rank text)CREATE TABLE Ship (Ship_ID int,Name text,Type text,Built_Year real,Class text,Flag text)
SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag ORDER BY Flag
What are Perkins Engineering's fewest laps?
CREATE TABLE table_name_17 (laps INTEGER,team VARCHAR)
SELECT MIN(laps) FROM table_name_17 WHERE team = "perkins engineering"
What is the label for December 2004?
CREATE TABLE table_39024 ("Country" text,"Date" text,"Label" text,"Format" text,"Catalogue #" text)
SELECT "Label" FROM table_39024 WHERE "Date" = 'december 2004'
In which period did Stanislav Chistov get a penalty?
CREATE TABLE table_name_9 (period VARCHAR,player VARCHAR)
SELECT period FROM table_name_9 WHERE player = "stanislav chistov"
What is the home country of the player who placed t5 and had a score of 69-71=140?
CREATE TABLE table_name_23 (country VARCHAR,place VARCHAR,score VARCHAR)
SELECT country FROM table_name_23 WHERE place = "t5" AND score = 69 - 71 = 140
specify the name of drug code lope2
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla...
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.formulary_drug_cd = "LOPE2"
What is the Position of the person with a First Election of 1988 as Vice Mayor 2009?
CREATE TABLE table_13378 ("Position" text,"Name" text,"Party" text,"First Election" text,"District" text)
SELECT "Position" FROM table_13378 WHERE "First Election" = '1988 as vice mayor 2009'
show me the difference between patient 006-1629's total input and output volume on 09/10/2105.
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid numbe...
SELECT (SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-1629')) AND intakeoutput.cellpath LI...
How many Drawn did Coach Francis Cummins have with less than 4 Lost?
CREATE TABLE table_52538 ("Competition" text,"Played" real,"Drawn" real,"Lost" real,"Position" text,"Coach" text,"Captain" text,"Main Article" text)
SELECT SUM("Drawn") FROM table_52538 WHERE "Lost" < '4' AND "Coach" = 'francis cummins'
how old is the youngest person for each job?
CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)
SELECT job, MIN(age) FROM Person GROUP BY job
For High Assists of Raymond Felton (12), who were the High rebounds?
CREATE TABLE table_21194 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "High rebounds" FROM table_21194 WHERE "High assists" = 'Raymond Felton (12)'
how many rankings are there ?
CREATE TABLE table_204_713 (id number,"rank" number,"bib" number,"athlete" text,"country" text,"time" text,"deficit" text)
SELECT MAX("rank") FROM table_204_713
WHAT ARE THE RACES WITH A POLE SMALLER THAN 2 IN 2007?
CREATE TABLE table_51172 ("Season" text,"Races" real,"Podiums" real,"Pole" real,"FLaps" real)
SELECT MIN("Races") FROM table_51172 WHERE "Pole" < '2' AND "Season" = '2007'
calculate how many medicines were prescribed to patient 003-33922 until 2104.
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(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '003-33922')) AND STRFTIME('%y', medication.drugstarttime) <= '2104'
Show me about the distribution of ACC_Road and the average of School_ID , and group by attribute ACC_Road in a bar chart, I want to display Y in desc order.
CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce...
SELECT ACC_Road, AVG(School_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(School_ID) DESC
Show each county along with the number of schools and total enrollment in each county.
CREATE TABLE school (county VARCHAR,enrollment INTEGER)
SELECT county, COUNT(*), SUM(enrollment) FROM school GROUP BY county
What is the transfer fee for Jimmy Gibson?
CREATE TABLE table_8154 ("Nat." text,"Name" text,"Moving to" text,"Type" text,"Transfer window" text,"Transfer fee" text)
SELECT "Transfer fee" FROM table_8154 WHERE "Name" = 'jimmy gibson'
When did Philoxenus Anicetus begin to hold power?
CREATE TABLE table_75884 ("Type" text,"Name" text,"Title" text,"Royal house" text,"From" text)
SELECT "From" FROM table_75884 WHERE "Name" = 'philoxenus anicetus'
What is the area (in km2) for the town of lam que, with a population of less than 4,351?
CREATE TABLE table_9247 ("Official Name" text,"Status" text,"Area km 2" real,"Population" real,"Census Ranking" text)
SELECT AVG("Area km 2") FROM table_9247 WHERE "Status" = 'town' AND "Population" < '4,351' AND "Official Name" = 'lamèque'
How much is the highest number in 2006 with fewer than 0 in 2002?
CREATE TABLE table_41806 ("Country" text,"1997" real,"1998" real,"1999" real,"2000" real,"2001" real,"2002" real,"2003" real,"2004" real,"2005" real,"2006" real,"2007" real,"2008" real,"2009" real,"2010" real,"2011" real,"2012" real,"Total" real)
SELECT MAX("2006") FROM table_41806 WHERE "2002" < '0'
Which Team has Podiums of 0, and a Position of nc ?
CREATE TABLE table_name_94 (team VARCHAR,podiums VARCHAR,position VARCHAR)
SELECT team FROM table_name_94 WHERE podiums = "0" AND position = "nc†"
WHAT IS THE SCORE WITH A RECORD OF 1-0?
CREATE TABLE table_76967 ("Date" text,"Opponent" text,"Score" text,"Result" text,"Record" text)
SELECT "Score" FROM table_76967 WHERE "Record" = '1-0'
What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns?
CREATE TABLE country (country_id number,country text,last_update time)CREATE TABLE category (category_id number,name text,last_update time)CREATE TABLE language (language_id number,name text,last_update time)CREATE TABLE address (address_id number,address text,address2 text,district text,city_id number,postal_code text...
SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'
What is Outcome, when Tournament is 'Chiang Mai , Thailand'?
CREATE TABLE table_name_90 (outcome VARCHAR,tournament VARCHAR)
SELECT outcome FROM table_name_90 WHERE tournament = "chiang mai , thailand"
What was the nationality for the player with 33 goals?
CREATE TABLE table_13176 ("Ranking" text,"Nationality" text,"Name" text,"Years" text,"Goals" real)
SELECT "Nationality" FROM table_13176 WHERE "Goals" = '33'
What is the number that is the lowest overall for the College of Baylor?
CREATE TABLE table_43646 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT MIN("Overall") FROM table_43646 WHERE "College" = 'baylor'
Which manucfaturer's type was 2-6-0?
CREATE TABLE table_name_68 (manufacturer VARCHAR,type VARCHAR)
SELECT manufacturer FROM table_name_68 WHERE type = "2-6-0"
What is the highest number of apps of the player with more than 63 goals and an avge of 0.45?
CREATE TABLE table_35769 ("Name" text,"Goals" real,"Apps" real,"Avge" real,"Career" text)
SELECT MAX("Apps") FROM table_35769 WHERE "Goals" > '63' AND "Avge" = '0.45'
Name the fixed telephone line for 25.6% vehicle
CREATE TABLE table_25042332_27 (fixed_telephone_line VARCHAR,vehicle VARCHAR)
SELECT fixed_telephone_line FROM table_25042332_27 WHERE vehicle = "25.6%"
Who directed episode number 18 in the series?
CREATE TABLE table_27982 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text)
SELECT "Directed by" FROM table_27982 WHERE "No. in series" = '18'
Fetching Title with relevant information.
CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId...
SELECT Id, Title, Score, AnswerCount, FavoriteCount, ViewCount, CreationDate, ClosedDate FROM Posts
Number of downvotes and upvotes per month.
CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,Revis...
SELECT LAST_DATE_OF_MONTH(CreationDate), SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS downvotes, SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS upvotes, ROUND(1.0 * SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) / SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), 3) AS ratio FROM Votes WHERE VoteTypeId IN (2,...
What is the average total with less than 8 bronze, 3 silver, and a Rank smaller than 2?
CREATE TABLE table_name_76 (total INTEGER,rank VARCHAR,bronze VARCHAR,silver VARCHAR)
SELECT AVG(total) FROM table_name_76 WHERE bronze < 8 AND silver = 3 AND rank < 2
What are some of the most useful courses to take before taking NEUROSCI 619 ?
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 advisory_requirement FROM course WHERE department = 'NEUROSCI' AND number = 619
What is the Intergiro classification of Nicolaj bo Larsen, who has a Fabrizio guidi point classification?
CREATE TABLE table_name_34 (intergiro_classification VARCHAR,points_classification VARCHAR,winner VARCHAR)
SELECT intergiro_classification FROM table_name_34 WHERE points_classification = "fabrizio guidi" AND winner = "nicolaj bo larsen"
Tell me the track that has the catalogue of apbo 0280
CREATE TABLE table_78059 ("Track" real,"Recorded" text,"Catalogue" text,"Release Date" text,"Song Title" text,"Time" text)
SELECT "Track" FROM table_78059 WHERE "Catalogue" = 'apbo 0280'
When 7th place, what is the date?
CREATE TABLE table_name_45 (date VARCHAR,place VARCHAR)
SELECT date FROM table_name_45 WHERE place = "7th"
What is the lowest number of seats from the election with 27.0% of votes?
CREATE TABLE table_name_55 (seats INTEGER,share_of_votes VARCHAR)
SELECT MIN(seats) FROM table_name_55 WHERE share_of_votes = "27.0%"
Top 1000 users with keywords sorted by reputation. Top 100 by votes users in tag c#
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 Users.Id, Users.DisplayName, Users.Reputation FROM Users WHERE EXISTS(SELECT u.Id FROM Tags AS t WITH (nolock) INNER JOIN PostTags AS pt WITH (nolock) ON pt.TagId = t.Id INNER JOIN Posts AS p WITH (nolock) ON p.ParentId = pt.PostId INNER JOIN Users AS u WITH (nolock) ON u.Id = p.OwnerUserId WHERE p.CommunityOwne...
What is the number of matches with an average larger than 6.33, with a rank of 1?
CREATE TABLE table_65442 ("Rank" real,"Player" text,"County" text,"Tally" text,"Total" real,"Matches" real,"Average" real)
SELECT SUM("Matches") FROM table_65442 WHERE "Average" > '6.33' AND "Rank" = '1'
How many Ties have Years of 1919 1925, and a Pct larger than 0.734?
CREATE TABLE table_name_75 (ties INTEGER,years VARCHAR,pct VARCHAR)
SELECT SUM(ties) FROM table_name_75 WHERE years = "1919–1925" AND pct > 0.734
Which DRG number has xxx railway number?
CREATE TABLE table_64811 ("Class" text,"Railway number(s)" text,"DRG number(s)" text,"Quantity" real,"Year(s) of manufacture" text,"Axle arrangement (UIC) Bauart" text)
SELECT "DRG number(s)" FROM table_64811 WHERE "Railway number(s)" = 'xxx'
what is the monthly minimum ca-125 value for patient 10425 during a year before?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE...
SELECT MIN(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10425) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ca-125') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURR...
What is the percentage of the popular vote when there were 90 seats available?
CREATE TABLE table_name_53 (_percentage_of_popular_vote VARCHAR,_number_of_seats_available VARCHAR)
SELECT _percentage_of_popular_vote FROM table_name_53 WHERE _number_of_seats_available = 90
Find any name change in the history..
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,R...
SELECT Id, LEFT(SUBSTRING(Text, STR_POSITION(Text, '@') + 1, LENGTH(Text)), PATINDEX('%^a-z%', SUBSTRING(Text, STR_POSITION(Text, '@') + 1, LENGTH(Text))) - 1) AS oldName, Text FROM Comments AS msq WHERE Id = 246568
what did patient 23929 first have as his intake?
CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23929)) ORDER BY inputevents_cv.char...
What is the position of the player with a jersey # greater than 30 and a December 23, 1986 birthdate?
CREATE TABLE table_name_83 (position VARCHAR,jersey__number VARCHAR,birthdate VARCHAR)
SELECT position FROM table_name_83 WHERE jersey__number > 30 AND birthdate = "december 23, 1986"
what was the top three most frequent procedures given to patients in the same hospital visit after they were diagnosed with s/p aortobifemoral bypass until 4 years ago?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,discha...
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 's/p a...
What was the department that got $626,798 in local investments?
CREATE TABLE table_17118006_2 (department VARCHAR,local_investment__us$_ VARCHAR)
SELECT department FROM table_17118006_2 WHERE local_investment__us$_ = "626,798"
Show the number of documents created in each day and bin document date by year interval and group by document type with a group line chart, and I want to order by the x-axis in asc.
CREATE TABLE Accounts (Account_ID INTEGER,Statement_ID INTEGER,Account_Details VARCHAR(255))CREATE TABLE Projects (Project_ID INTEGER,Project_Details VARCHAR(255))CREATE TABLE Statements (Statement_ID INTEGER,Statement_Details VARCHAR(255))CREATE TABLE Documents (Document_ID INTEGER,Document_Type_Code CHAR(15),Project_...
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Name ORDER BY Document_Date