instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Which tourist attractions does the visitor with detail 'Vincent' visit?
CREATE TABLE VISITORS (Tourist_ID VARCHAR,Tourist_Details VARCHAR)CREATE TABLE Tourist_Attractions (Name VARCHAR,Tourist_Attraction_ID VARCHAR)CREATE TABLE VISITS (Tourist_Attraction_ID VARCHAR,Tourist_ID VARCHAR)
SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN VISITORS AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = "Vincent"
Episode smaller than 210 had what segment c?
CREATE TABLE table_name_67 (segment_c VARCHAR,episode INTEGER)
SELECT segment_c FROM table_name_67 WHERE episode < 210
what is the average days of hospital stay for patients who are diagnosed with primary disease posterior communicating aneurysm/sda?
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 text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te...
SELECT AVG(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA"
How many districts have the incumbent, Charles Rangel?
CREATE TABLE table_1805191_33 (district VARCHAR,incumbent VARCHAR)
SELECT COUNT(district) FROM table_1805191_33 WHERE incumbent = "Charles Rangel"
is arthur kaye older or younger than brian hill ?
CREATE TABLE table_204_883 (id number,"pos." text,"name" text,"place of birth" text,"date of birth" text,"previous club" text,"date joined" text,"fee" text)
SELECT (SELECT "date of birth" FROM table_204_883 WHERE "name" = 'arthur kaye') < (SELECT "date of birth" FROM table_204_883 WHERE "name" = 'brian hall')
How many laps were there with #9 grid?
CREATE TABLE table_name_44 (laps VARCHAR,grid VARCHAR)
SELECT COUNT(laps) FROM table_name_44 WHERE grid = 9
Who directed all the episodes that were written by aaron ehasz & john o'bryan?
CREATE TABLE table_14562722_1 (directed_by VARCHAR,written_by VARCHAR)
SELECT directed_by FROM table_14562722_1 WHERE written_by = "Aaron Ehasz & John O'Bryan"
Get me the number of patients who had urgent hospital admission along with a creatinine lab test.
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Creatinine"
Questions with one tag and all-lowercase title.
CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class numbe...
SELECT Id AS "post_link", Score, AnswerCount AS "answers", Tags AS "tag" FROM Posts WHERE NOT Tags LIKE '%><%' AND Title = LOWER(Title) AND ClosedDate IS NULL ORDER BY Score
how many times is the constituency edinburgh northern and leith?
CREATE TABLE table_name_20 (swing_to_gain VARCHAR,constituency VARCHAR)
SELECT COUNT(swing_to_gain) FROM table_name_20 WHERE constituency = "edinburgh northern and leith"
How many people watched the game at Lake Oval?
CREATE TABLE table_52866 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT SUM("Crowd") FROM table_52866 WHERE "Venue" = 'lake oval'
Which Relation has a Year larger than 2000, and a Length of 8 x 20 mins?
CREATE TABLE table_13427 ("Name" text,"Type" text,"Relation" text,"Length" text,"Year" real)
SELECT "Relation" FROM table_13427 WHERE "Year" > '2000' AND "Length" = '8 x 20 mins'
What is total orders for goals of 239?
CREATE TABLE table_name_77 (order VARCHAR,goals VARCHAR)
SELECT COUNT(order) FROM table_name_77 WHERE goals = 239
What was the smallest crowd that watched an away team score 3.10 (28)?
CREATE TABLE table_74727 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MIN("Crowd") FROM table_74727 WHERE "Away team score" = '3.10 (28)'
What city houses the Ciro Vigorito stadium?
CREATE TABLE table_51645 ("Club" text,"City" text,"Stadium" text,"Capacity" real,"2011\u201312 season" text)
SELECT "City" FROM table_51645 WHERE "Stadium" = 'ciro vigorito'
i need an early flight from DENVER to SAN FRANCISCO please and i would like BREAKFAST served on that
CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE class_of_servi...
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 (((flight.departure_time <= 1000 AND flight.departure_time >= 0) AND food_service.meal_code = flight.meal_code AND food_service.meal_description = ...
find the number of patients with admission location as clinic referral/premature who have drug code niac100.
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND prescriptions.formulary_drug_cd = "NIAC100"
Who were the partners in games where the score was 1-6, 2-6?
CREATE TABLE table_2259502_2 (partner VARCHAR,score VARCHAR)
SELECT partner FROM table_2259502_2 WHERE score = "1-6, 2-6"
What is the highest goals against when points are larger than 31, the goal difference is smaller than 9, wins are 13, and draws are larger than 6?
CREATE TABLE table_60871 ("Position" real,"Club" text,"Played" real,"Points" real,"Wins" real,"Draws" real,"Losses" real,"Goals for" real,"Goals against" real,"Goal Difference" real)
SELECT MAX("Goals against") FROM table_60871 WHERE "Points" > '31' AND "Goal Difference" < '9' AND "Wins" = '13' AND "Draws" > '6'
what country is dubai in
CREATE TABLE table_name_50 (country VARCHAR,town VARCHAR)
SELECT country FROM table_name_50 WHERE town = "dubai"
Tags with highest average answer scores (among tags with at least 1000 questions).
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 PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE CloseAsOff...
SELECT t.TagName, COUNT(a.Id) AS NumAnswers, SUM(a.Score) AS TotalScore, AVG(a.Score + 0.0) AS AvgScore FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id JOIN PostTags AS pt ON pt.PostId = q.Id JOIN Tags AS t ON t.Id = pt.TagId WHERE a.PostTypeId = 2 GROUP BY t.TagName, t.Id HAVING COUNT(a.Id) >= 1000 ORDER BY AvgSc...
what is the last platform listed on this chart ?
CREATE TABLE table_204_121 (id number,"year" text,"game" text,"developer" text,"setting" text,"platform" text,"notes" text)
SELECT "platform" FROM table_204_121 ORDER BY id DESC LIMIT 1
Who was the home team for the game played at Victoria Park?
CREATE TABLE table_name_87 (home_team VARCHAR,venue VARCHAR)
SELECT home_team FROM table_name_87 WHERE venue = "victoria park"
album released after emotion
CREATE TABLE table_204_394 (id number,"year" number,"album" text,"label" text,"peak chart\npositions\nus" number,"peak chart\npositions\nus r&b" number)
SELECT "album" FROM table_204_394 WHERE "year" > (SELECT "year" FROM table_204_394 WHERE "album" = 'emotion') ORDER BY "year" LIMIT 1
What location did game 64 take place
CREATE TABLE table_name_34 (location VARCHAR,game VARCHAR)
SELECT location FROM table_name_34 WHERE game = 64
i'd like to fly from DENVER to ATLANTA with a stop in PITTSBURGH
CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE restri...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND CITY_2.ci...
What was the Loss when the opponent was the Rangers and the attendance was greater than 43,211?
CREATE TABLE table_67934 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Loss" FROM table_67934 WHERE "Opponent" = 'rangers' AND "Attendance" > '43,211'
Find the name of the students who have more than one advisor?
CREATE TABLE advisor (s_id text,i_id text)CREATE TABLE classroom (building text,room_number text,capacity number)CREATE TABLE prereq (course_id text,prereq_id text)CREATE TABLE student (id text,name text,dept_name text,tot_cred number)CREATE TABLE section (course_id text,sec_id text,semester text,year number,building t...
SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING COUNT(*) > 1
A pie chart shows the proportion of All_Games and All_Games_Percent.
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 All_Games, All_Games_Percent FROM basketball_match
Who did he play on a hard surface?
CREATE TABLE table_name_99 (opponents VARCHAR,surface VARCHAR)
SELECT opponents FROM table_name_99 WHERE surface = "hard"
what is the procedure icd9 code and procedure long title of subject id 31066?
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT procedures.icd9_code, procedures.long_title FROM procedures WHERE procedures.subject_id = "31066"
How many were won when there were 49 points?
CREATE TABLE table_17369472_2 (won VARCHAR,points VARCHAR)
SELECT won FROM table_17369472_2 WHERE points = "49"
What model has both a standard byte string and floating-point?
CREATE TABLE table_name_90 (model VARCHAR,byte_string VARCHAR,floating_point VARCHAR)
SELECT model FROM table_name_90 WHERE byte_string = "standard" AND floating_point = "standard"
Which was the team 1 that had a team 2 which was avigliano (basilicata)?
CREATE TABLE table_53758 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "Team 1" FROM table_53758 WHERE "Team 2" = 'avigliano (basilicata)'
On what date were the opponents the Bayhawks at a home game?
CREATE TABLE table_name_17 (date VARCHAR,home_away VARCHAR,opponent VARCHAR)
SELECT date FROM table_name_17 WHERE home_away = "home" AND opponent = "bayhawks"
how many patients whose admission year is less than 2195 and item id is 50836?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2195" AND lab.itemid = "50836"
Who claims to be from Greenland?.
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,...
SELECT Id AS "user_link" FROM Users WHERE Location = 'Greenland'
Which Set 1 has a Time of 14:00, and a Set 3 of 19 25?
CREATE TABLE table_name_22 (set_1 VARCHAR,time VARCHAR,set_3 VARCHAR)
SELECT set_1 FROM table_name_22 WHERE time = "14:00" AND set_3 = "19–25"
Which away team has Tie no 3?
CREATE TABLE table_name_80 (away_team VARCHAR,tie_no VARCHAR)
SELECT away_team FROM table_name_80 WHERE tie_no = "3"
today, when was the first time that the sao2 of patient 022-78423 was less than 97.0?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,obs...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-78423')) AND vitalperiodic.sao2 < 97.0 AND NOT ...
Who won the April 11 race?
CREATE TABLE table_25773116_2 (winning_driver VARCHAR,date VARCHAR)
SELECT winning_driver FROM table_25773116_2 WHERE date = "April 11"
Name the result/games for 52521
CREATE TABLE table_24340 ("Type of Record" text,"Attendance" real,"Date/Year" text,"Stadium" text,"Result/Games" text)
SELECT "Result/Games" FROM table_24340 WHERE "Attendance" = '52521'
What games have the event of Men's Slalom?
CREATE TABLE table_name_91 (games VARCHAR,event VARCHAR)
SELECT games FROM table_name_91 WHERE event = "men's slalom"
What is the total number of silvers associated with 3 bronzes, a total over 6, and a rank of 3?
CREATE TABLE table_name_11 (silver VARCHAR,total VARCHAR,bronze VARCHAR,rank VARCHAR)
SELECT COUNT(silver) FROM table_name_11 WHERE bronze = "3" AND rank = "3" AND total > 6
what is the monthly minimum amount of stool out stool that patient 61339 had until 71 months ago?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate ...
SELECT MIN(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 = 61339)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sto...
For those records from the products and each product's manufacturer, return a bar chart about the distribution of headquarter and the sum of code , and group by attribute headquarter, and rank bar from high to low order.
CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter DESC
Name the M939 series for short wheelbase and M809 series of m817
CREATE TABLE table_6016 ("Type" text,"wheelbase" text,"M39 series" text,"M809 series" text,"M939 series" text)
SELECT "M939 series" FROM table_6016 WHERE "M809 series" = 'm817' AND "wheelbase" = 'short'
how many total medals did belarus win ?
CREATE TABLE table_203_724 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT "total" FROM table_203_724 WHERE "nation" = 'belarus'
Show me the correlation about what are the ids of the trips that lasted the longest and how long did they last?
CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_type TEXT,zip_code INTEGER)CREATE TABLE status (station_id INTEGER,bikes_available INTEGER,docks_available INTEGER,time ...
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3
give the number of patients primarily diagnosed for guillan barre syndrome who underwent the procedure titled int insert 1-cham, rate.
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "GUILLAIN BARRE SYNDROME" AND procedures.short_title = "Int insert 1-cham, rate"
Give me a pie chart showing the number of engineers for different skill description.
CREATE TABLE Fault_Log (fault_log_entry_id INTEGER,asset_id INTEGER,recorded_by_staff_id INTEGER,fault_log_entry_datetime DATETIME,fault_description VARCHAR(255),other_fault_details VARCHAR(255))CREATE TABLE Parts (part_id INTEGER,part_name VARCHAR(255),chargeable_yn VARCHAR(1),chargeable_amount VARCHAR(20),other_part_...
SELECT skill_description, COUNT(skill_description) FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY skill_description
For the Fall or Winter term , are there any 100 -level classes ?
CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction 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_p...
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 100 AND 100 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_of...
How many regions had a life expectancy at birth in 2001-2002 of 75.9?
CREATE TABLE table_3215 ("Region" text,"HDI" text,"Life expectancy at birth (2001-2002)" text,"Adult literacy rate (2009)" text,"Combined gross enrollment ratio (2009)" text,"GDP (PPP) per capita (2008)" real)
SELECT COUNT("HDI") FROM table_3215 WHERE "Life expectancy at birth (2001-2002)" = '75.9'
Count the number of credit cards that the customer with first name Blanche and last name Huels has.
CREATE TABLE financial_transactions (transaction_id number,previous_transaction_id number,account_id number,card_id number,transaction_type text,transaction_date time,transaction_amount number,transaction_comment text,other_transaction_details text)CREATE TABLE accounts (account_id number,customer_id number,account_nam...
SELECT COUNT(*) FROM customers_cards AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit"
What races have gp2 series, 0 F.L. and a 17th position?
CREATE TABLE table_name_43 (races VARCHAR,position VARCHAR,series VARCHAR,fl VARCHAR)
SELECT races FROM table_name_43 WHERE series = "gp2 series" AND fl = "0" AND position = "17th"
What is the Name of the private Castle of the 16th century which is occupied?
CREATE TABLE table_name_26 (name VARCHAR,date VARCHAR,ownership VARCHAR,condition VARCHAR)
SELECT name FROM table_name_26 WHERE ownership = "private" AND condition = "occupied" AND date = "16th century"
when was the last time patient 65401 was prescribed medication through the ed route in 10/2105?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,chartt...
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65401) AND prescriptions.route = 'ed' AND STRFTIME('%y-%m', prescriptions.startdate) = '2105-10' ORDER BY prescriptions.startdate DESC LIMIT 1
how many female patients had morbid obesity/sda as their primary disease?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "MORBID OBESITY/SDA"
What is the highest Roll of Orere School with a Decile less than 8 with a State Authority?
CREATE TABLE table_55791 ("Name" text,"Years" text,"Gender" text,"Area" text,"Authority" text,"Decile" real,"Roll" real)
SELECT MAX("Roll") FROM table_55791 WHERE "Decile" < '8' AND "Authority" = 'state' AND "Name" = 'orere school'
has patient 007-2498 received a procedure of nephrostomy - right in other hospitals in this year?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemic...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '007-2498' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '007-2498' AND patient.hospitaldischargetime IS NULL)) AND trea...
What is the low FA cup goals for viduka with under 2 europe goals?
CREATE TABLE table_57889 ("Name" text,"League" real,"FA Cup" real,"League Cup" real,"Europe" real,"Total" real)
SELECT MIN("FA Cup") FROM table_57889 WHERE "Name" = 'viduka' AND "Europe" < '2'
What is the total number of losses of the player that has drawn 1 and played smaller than 12?
CREATE TABLE table_name_73 (lost VARCHAR,drawn VARCHAR,played VARCHAR)
SELECT COUNT(lost) FROM table_name_73 WHERE drawn = 1 AND played < 12
How many points did shahar pe'er score?
CREATE TABLE table_20855452_4 (points VARCHAR,player VARCHAR)
SELECT points AS won FROM table_20855452_4 WHERE player = "Shahar Pe'er"
How many dorms are there for each gender? Show me a bar chart, I want to list from high to low by the y-axis.
CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm (dormid INTEGER,dorm_name VARCHAR(20),student_capacity INTEGER,gender VARCHAR(1))CREATE TABLE Do...
SELECT gender, COUNT(*) FROM Dorm GROUP BY gender ORDER BY COUNT(*) DESC
When is 847 being offered ?
CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE area (course_id int,area varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,tota...
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 semester INNER JOIN course_offering ON semester.semester_id = course_o...
Which Score has an Opponent of washington capitals, and a Record of 24-34-17?
CREATE TABLE table_48713 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Attendance" real,"Record" text,"Points" real)
SELECT "Score" FROM table_48713 WHERE "Opponent" = 'washington capitals' AND "Record" = '24-34-17'
when was patient 73206 prescribed with a drug via im route for the first time since 05/2101?
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 chartevents (row_id number,subject_id number,...
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73206) AND prescriptions.route = 'im' AND STRFTIME('%y-%m', prescriptions.startdate) >= '2101-05' ORDER BY prescriptions.startdate LIMIT 1
how many patients whose primary disease is acidosis and admission year is less than 2139?
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 text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ACIDOSIS" AND demographic.admityear < "2139"
Name the least episode for fibre cement siding
CREATE TABLE table_15187735_18 (episode INTEGER,segment_d VARCHAR)
SELECT MIN(episode) FROM table_15187735_18 WHERE segment_d = "Fibre Cement Siding"
what 's the lowest one way fare from PITTSBURGH to DENVER
CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)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 city (city_code varchar,city_name varchar,state_code varc...
SELECT DISTINCT fare.fare_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_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
What shows for 202 when the 1994 is A, the 1989 is NME, and the 199 is 2R?
CREATE TABLE table_name_3 (Id VARCHAR)
SELECT 2002 FROM table_name_3 WHERE 1994 = "a" AND 1989 = "nme" AND 1999 = "2r"
What dates was the storm called 07 active?
CREATE TABLE table_4647 ("Name" text,"Dates active" text,"Windspeeds" text,"Pressure" text,"Deaths" text)
SELECT "Dates active" FROM table_4647 WHERE "Name" = '07'
How many documents in different ending date? Return a bar chart binning ending date by weekday, and rank by the total number in descending.
CREATE TABLE Ref_Calendar (Calendar_Date DATETIME,Day_Number INTEGER)CREATE TABLE Roles (Role_Code CHAR(15),Role_Name VARCHAR(255),Role_Description VARCHAR(255))CREATE TABLE Ref_Locations (Location_Code CHAR(15),Location_Name VARCHAR(255),Location_Description VARCHAR(255))CREATE TABLE Document_Locations (Document_ID IN...
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations ORDER BY COUNT(Date_in_Locaton_To) DESC
Top 10 question askers in Meta Stack Exchange.
CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,E...
SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS "row_number", OwnerUserId AS "user_link", COUNT(PostTypeId) AS "questions_count" FROM Posts WHERE NOT OwnerUserId IS NULL AND OwnerUserId != -1 AND PostTypeId = 1 GROUP BY OwnerUserId ORDER BY COUNT(PostTypeId) DESC LIMIT 10
calculate the difference between patient 20898's total output and the total input amount on 12/24/this year.
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,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_items (row_id number,itemid number,label t...
SELECT (SELECT SUM(inputevents_cv.amount) 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 = 20898)) AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT...
How many males speak Russian?
CREATE TABLE table_name_3 (males VARCHAR,language VARCHAR)
SELECT males FROM table_name_3 WHERE language = "russian"
What episode had a run time of 24:53?
CREATE TABLE table_24064 ("Episode" text,"Broadcast date" text,"Run time" text,"Viewers (in millions)" text,"Archive" text)
SELECT "Episode" FROM table_24064 WHERE "Run time" = '24:53'
what the last height of patient 011-31779 on their first hospital encounter.
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-31779' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionheight IS NULL ORDER BY p...
What is the largest number played with 16 points in a position over 4?
CREATE TABLE table_name_40 (played INTEGER,points VARCHAR,position VARCHAR)
SELECT MAX(played) FROM table_name_40 WHERE points = 16 AND position > 4
has patient 002-4486 been prescribed with morphine 4 mg/ml syringe : 1 ml syringe, chlorhexidine gluconate 0.12% or amlodipine 5 mg tab this month?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE treatment (treatmentid number,patientun...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-4486')) AND medication.drugname IN ('morphine 4 mg/ml syringe : 1 ml s...
Which Opponent has a Record of 45 21 4?
CREATE TABLE table_75394 ("Game" real,"March" real,"Opponent" text,"Score" text,"Record" text,"Points" real)
SELECT "Opponent" FROM table_75394 WHERE "Record" = '45–21–4'
Number of answers outscoring a given user's answers. Rank users by the number of answers that outscore the target user's answer on the same question. Only answers posted at most 24 hours earlier are considered.
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE T...
SELECT b.OwnerUserId AS "user_link", COUNT(*) AS "count", MIN(b.Id) AS "post_link" FROM Posts AS a, Posts AS b WHERE a.OwnerUserId = '##User##' AND b.OwnerUserId != a.OwnerUserId AND b.ParentId = a.ParentId AND b.Score > a.Score AND a.CreationDate <= DATE(b.CreationDate, '24 hour') GROUP BY b.OwnerUserId ORDER BY 'coun...
For those records from the products and each product's manufacturer, find founder and the sum of price , and group by attribute founder, and visualize them by a bar chart, rank by the y-axis from low to high please.
CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)
SELECT Founder, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Price)
Who was the winning driver when the pole position was held by Ayrton Senna and the Fastest lap was Michael Schumacher?
CREATE TABLE table_201 ("Round" real,"Grand Prix" text,"Pole Position" text,"Fastest Lap" text,"Winning Driver" text,"Winning Constructor" text,"Report" text)
SELECT "Winning Driver" FROM table_201 WHERE "Pole Position" = 'Ayrton Senna' AND "Fastest Lap" = 'Michael Schumacher'
Which game has houston as the road team, and june 15 as the date?
CREATE TABLE table_34425 ("Game" text,"Date" text,"Home Team" text,"Result" text,"Road Team" text)
SELECT "Game" FROM table_34425 WHERE "Road Team" = 'houston' AND "Date" = 'june 15'
What trips are operated by Atlantic coast charters?
CREATE TABLE table_38719 ("Route" text,"Terminus" text,"Operated by" text,"Corridors served" text,"Total trips (AM/PM)" text,"Operating since" text)
SELECT "Total trips (AM/PM)" FROM table_38719 WHERE "Operated by" = 'atlantic coast charters'
What are the names of all wines produced in 2008?
CREATE TABLE wine (no number,grape text,winery text,appelation text,state text,name text,year number,price number,score number,cases number,drink text)CREATE TABLE appellations (no number,appelation text,county text,state text,area text,isava text)CREATE TABLE grapes (id number,grape text,color text)
SELECT name FROM wine WHERE year = "2008"
How many high rebounds are listed for game 35?
CREATE TABLE table_27704187_8 (high_rebounds VARCHAR,game VARCHAR)
SELECT COUNT(high_rebounds) FROM table_27704187_8 WHERE game = 35
In what year did the #14 FitzBradshaw Racing compete?
CREATE TABLE table_1909647_2 (year VARCHAR,team_s_ VARCHAR)
SELECT year FROM table_1909647_2 WHERE team_s_ = "#14 FitzBradshaw Racing"
What is AAM Member, when AAM Accredited is No, when State is California, when ASTC Member is Yes, and when City is Sacramento?
CREATE TABLE table_name_21 (aam_member VARCHAR,city VARCHAR,astc_member VARCHAR,aam_accredited VARCHAR,state VARCHAR)
SELECT aam_member FROM table_name_21 WHERE aam_accredited = "no" AND state = "california" AND astc_member = "yes" AND city = "sacramento"
For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and employee_id , and visualize them by a bar chart, sort total number from low to high order.
CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE departments (D...
SELECT FIRST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID
When was the tournament of bologna?
CREATE TABLE table_71573 ("Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Date" FROM table_71573 WHERE "Tournament" = 'bologna'
What film was Dianne Wiest in?
CREATE TABLE table_name_56 (film VARCHAR,actor VARCHAR)
SELECT film FROM table_name_56 WHERE actor = "dianne wiest"
how many games did the winning team score above 3 points ?
CREATE TABLE table_203_164 (id number,"#" number,"date" text,"venue" text,"opponent" text,"score" text,"result" text,"competition" text)
SELECT COUNT(*) FROM table_203_164 WHERE "result" = 'won' AND "score" > 3
which season was more successful , 1995/96 or 1996/97 ?
CREATE TABLE table_204_35 (id number,"season" text,"tier" number,"division" text,"place" text)
SELECT "season" FROM table_204_35 WHERE "season" IN ('1995/96', '1996/97') ORDER BY "place" LIMIT 1
What is the sum of the Bronze medals when the Gold medals are larger than 0, Silver medals are smaller than 1, and the total is smaller than 1?
CREATE TABLE table_53767 ("Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT SUM("Bronze") FROM table_53767 WHERE "Gold" > '0' AND "Silver" < '1' AND "Total" < '1'
What team had high assists Rafer Alston (5)?
CREATE TABLE table_15872814_7 (team VARCHAR,high_assists VARCHAR)
SELECT team FROM table_15872814_7 WHERE high_assists = "Rafer Alston (5)"
What was the guage of the concessionaire ferrosur roca?
CREATE TABLE table_name_8 (gauge VARCHAR,concessionaire VARCHAR)
SELECT gauge FROM table_name_8 WHERE concessionaire = "ferrosur roca"
Show the number of documents in each day for all documents on project with details 'Graph Database project' and bin document date by year interval with a line chart.
CREATE TABLE Documents (Document_ID INTEGER,Document_Type_Code CHAR(15),Project_ID INTEGER,Document_Date DATETIME,Document_Name VARCHAR(255),Document_Description VARCHAR(255),Other_Details VARCHAR(255))CREATE TABLE Statements (Statement_ID INTEGER,Statement_Details VARCHAR(255))CREATE TABLE Ref_Budget_Codes (Budget_Typ...
SELECT Document_Date, COUNT(Document_Date) FROM Documents AS T1 JOIN Projects AS T2 ON T1.Project_ID = T2.Project_ID WHERE T2.Project_Details = 'Graph Database project'
count the number of patients whose primary disease is hemopytsis and drug type is base?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "HEMOPYTSIS" AND prescriptions.drug_type = "BASE"