table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
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 )
For those records from the products and each product's manufacturer, find name and manufacturer , and group by attribute name, and visualize them by a bar chart, and display y-axis in asc order.
SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Manufacturer
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
what is the total dose of ns that patient 63781 was prescribed until 03/2103?
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 63781) AND prescriptions.drug = 'ns' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2103-03'
CREATE TABLE table_19753079_13 ( incumbent VARCHAR, party VARCHAR, district VARCHAR )
How many incumbents are there in the georgia 8 district when the party is democratic?
SELECT COUNT(incumbent) FROM table_19753079_13 WHERE party = "Democratic" AND district = "Georgia 8"
CREATE TABLE table_64713 ( "Rank" real, "Rowers" text, "Country" text, "Time" text, "Notes" text )
What is the sum of the rank of the rower with an r note from Australia?
SELECT SUM("Rank") FROM table_64713 WHERE "Notes" = 'r' AND "Country" = 'australia'
CREATE TABLE DEPARTMENT ( DName VARCHAR, DNO VARCHAR ) CREATE TABLE MINOR_IN ( DNO VARCHAR )
Find the name of the department that has the biggest number of students minored in?
SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTask...
(fout) Average amount of answers per question.
SELECT Year = DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0), Average_answers_per_question = SUM(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) / CAST(SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) AS FLOAT) FROM Posts GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) ORDER BY DATEADD(MONTH, DATEDIFF(MONT...
CREATE TABLE table_name_40 ( score VARCHAR, record VARCHAR )
What was the score of the game when the record was 32 19 7?
SELECT score FROM table_name_40 WHERE record = "32–19–7"
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
provide the number of patients whose discharge location is dead/expired and days of hospital stay is greater than 1?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "DEAD/EXPIRED" AND demographic.days_stay > "1"
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_s...
i would like to see flights from DENVER to PHILADELPHIA
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_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADE...
CREATE TABLE table_51973 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
What is the record of the game on February 21, 2008?
SELECT "Record" FROM table_51973 WHERE "Date" = 'february 21, 2008'
CREATE TABLE table_53867 ( "Player" text, "Position" text, "Tries" real, "Goals" real, "Points" real )
Tell me the player with points larger than 36 and goals more than 0 with tries of 12
SELECT "Player" FROM table_53867 WHERE "Points" > '36' AND "Goals" > '0' AND "Tries" = '12'
CREATE TABLE table_56761 ( "Date" text, "Home Team" text, "Score" text, "Visiting Team" text, "Stadium" text )
Which Visiting Team has a Stadium of servus centre?
SELECT "Visiting Team" FROM table_56761 WHERE "Stadium" = 'servus centre'
CREATE TABLE table_name_51 ( Id VARCHAR )
What is the value for 2012 when the value for 2009 is 1R and the vale for 2007 is 2R?
SELECT 2012 FROM table_name_51 WHERE 2009 = "1r" AND 2007 = "2r"
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
Show the number of patients with procedure icd9 code 3612 who died in or before 2126.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2126.0" AND procedures.icd9_code = "3612"
CREATE TABLE table_56262 ( "Player" text, "No.(s)" real, "Height in Ft." text, "Position" text, "Years for Rockets" text, "School/Club Team/Country" text )
What was the position of the player who played for the Rockets during 1981?
SELECT "Position" FROM table_56262 WHERE "Years for Rockets" = '1981'
CREATE TABLE table_38445 ( "Club" text, "League" text, "Venue" text, "Established" real, "Championships" real )
What is the Established date of the Brian Timmis Stadium?
SELECT COUNT("Established") FROM table_38445 WHERE "Venue" = 'brian timmis stadium'
CREATE TABLE table_20007413_6 ( compression_ratio VARCHAR, rpo VARCHAR, applications VARCHAR )
What's the compression ratio of the model with L35 RPO and 5 applications?
SELECT compression_ratio FROM table_20007413_6 WHERE rpo = "L35" AND applications = 5
CREATE TABLE table_203_371 ( id number, "round" number, "opponent" text, "result" text, "bro." number, "opp." number, "date" text, "venue" text, "crowd" number, "position" text )
how many different teams did the broncos play against ?
SELECT COUNT(DISTINCT "opponent") FROM table_203_371
CREATE TABLE table_25468520_1 ( theme VARCHAR, printing_process VARCHAR )
What is the theme when the printing process is litho in 3 cols and intaglio?
SELECT theme FROM table_25468520_1 WHERE printing_process = "Litho in 3 cols and intaglio"
CREATE TABLE table_79707 ( "2008/ 09" text, "2009/ 10" text, "2010/ 11" text, "2011/ 12" text, "2012/ 13" text )
When 2011/ 12 is non-ranking, what is the 2009/ 10?
SELECT "2009/ 10" FROM table_79707 WHERE "2011/ 12" = 'non-ranking'
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, ...
what is the admission time and lab test name of patient with patient id 22377?
SELECT demographic.admittime, lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "22377"
CREATE TABLE table_27588 ( "June 10-11" text, "March 27-29" text, "January 15-16" text, "November 3" text, "August 21-22" text )
what is march 27-29 when november 3 is 133?
SELECT "March 27-29" FROM table_27588 WHERE "November 3" = '133'
CREATE TABLE table_29732 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who got high assists for team @ Indiana?
SELECT "High assists" FROM table_29732 WHERE "Team" = '@ Indiana'
CREATE TABLE table_203_14 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
how many international goals did teeratep winothai make in 2009 ?
SELECT COUNT(*) FROM table_203_14 WHERE "date" = 2009
CREATE TABLE table_5191 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team" text )
What is the nationality of the player in round 4?
SELECT "Nationality" FROM table_5191 WHERE "Round" = '4'
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 text, route text, drug_dose text ) ...
provide the number of patients whose drug code is mago140 and lab test category is hematology.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "MAGO140" AND lab."CATEGORY" = "Hematology"
CREATE TABLE table_11677100_12 ( position VARCHAR, hometown VARCHAR )
Which position did the player from the hometown of Dallas, TX play?
SELECT position FROM table_11677100_12 WHERE hometown = "Dallas, TX"
CREATE TABLE table_name_79 ( date VARCHAR, home_team VARCHAR )
What day is collingwood the home side?
SELECT date FROM table_name_79 WHERE home_team = "collingwood"
CREATE TABLE table_55727 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
How many people were in the Crowd when the Home team scored 10.7 (67)?
SELECT COUNT("Crowd") FROM table_55727 WHERE "Home team score" = '10.7 (67)'
CREATE TABLE table_204_57 ( id number, "year" number, "film" text, "role" text, "language" text, "notes" text )
what is the number of films in tamil ?
SELECT COUNT("film") FROM table_204_57 WHERE "language" = 'tamil'
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 ) CRE...
Number of up votes in past 30 days.
SELECT COUNT(*) FROM Votes WHERE Votes.VoteTypeId IN (2) AND Votes.CreationDate >= DATEADD(DAY, -30, GETDATE())
CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Ranking int ) CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price...
Show different carriers of phones together with the number of phones with each carrier by a pie chart.
SELECT Carrier, COUNT(*) FROM phone GROUP BY Carrier
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
what is the number of patients whose days of hospital stay is greater than 4 and lab test category is hematology?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "4" AND lab."CATEGORY" = "Hematology"
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 ) ...
Give me the number of patients born before 2043 who had a urine lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2043" AND lab.fluid = "Urine"
CREATE TABLE table_18415 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
What district is incumbent elmer j. holland from?
SELECT "District" FROM table_18415 WHERE "Incumbent" = 'Elmer J. Holland'
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
what is age of subject id 14755?
SELECT demographic.age FROM demographic WHERE demographic.subject_id = "14755"
CREATE TABLE table_18373863_2 ( mlb_team VARCHAR, fcsl_team VARCHAR )
When winter pines is the fcsl team how many mlb teams are there?
SELECT COUNT(mlb_team) FROM table_18373863_2 WHERE fcsl_team = "Winter Pines"
CREATE TABLE rating ( rid number, mid number, stars number, ratingdate time ) CREATE TABLE movie ( mid number, title text, year number, director text ) CREATE TABLE reviewer ( rid number, name text )
What is the id of the reviewer named Daniel Lewis?
SELECT rid FROM reviewer WHERE name = "Daniel Lewis"
CREATE TABLE table_54938 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
Who recorded the loss on august 7?
SELECT "Loss" FROM table_54938 WHERE "Date" = 'august 7'
CREATE TABLE financial_transactions ( transaction_id number, account_id number, invoice_number number, transaction_type text, transaction_date time, transaction_amount number, transaction_comment text, other_transaction_details text ) CREATE TABLE products ( product_id number, p...
Show the product ids and the number of unique orders containing each product.
SELECT product_id, COUNT(DISTINCT order_id) FROM order_items GROUP BY product_id
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JO...
For those employees who was hired before 2002-06-21, draw a scatter chart about the correlation between salary and commission_pct .
SELECT SALARY, COMMISSION_PCT FROM employees WHERE HIRE_DATE < '2002-06-21'
CREATE TABLE table_34616 ( "Region served" text, "City" text, "Channels ( Analog / Digital )" text, "First air date" text, "ERP (Analog/ Digital)" text, "HAAT (Analog/ Digital) 1" text, "Transmitter Location" text )
Which City has 600kw 500kw ERP (Analog/ Digital)?
SELECT "City" FROM table_34616 WHERE "ERP (Analog/ Digital)" = '600kw 500kw'
CREATE TABLE table_71484 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
Which 2nd leg came after a 1st leg of 0-3?
SELECT "2nd leg" FROM table_71484 WHERE "1st leg" = '0-3'
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 t...
how many patients whose lab test name is nonsquamous epithelial cell?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "NonSquamous Epithelial Cell"
CREATE TABLE country ( Country_id int, Country_name text, Capital text, Official_native_language text ) CREATE TABLE player ( Player_ID int, Player text, Years_Played text, Total_WL text, Singles_WL text, Doubles_WL text, Team int ) CREATE TABLE match_season ( Season re...
Draw a bar chart for how many players played each position?, rank from high to low by the total number.
SELECT Position, COUNT(*) FROM match_season GROUP BY Position ORDER BY COUNT(*) DESC
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
how many patients whose discharge location is home health care and days of hospital stay is greater than 10?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.days_stay > "10"
CREATE TABLE table_name_79 ( draw VARCHAR, dance_styles VARCHAR )
How many draws have rumba/tango dance styles?
SELECT COUNT(draw) FROM table_name_79 WHERE dance_styles = "rumba/tango"
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(...
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of hire_date and the sum of employee_id bin hire_date by time, and I want to order y-axis in asc order.
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(EMPLOYEE_ID)
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE requirement ( ...
Which classes are offered in the next 6 semesters ?
SELECT DISTINCT course.name, course.number, semester.semester, semester.year FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'FA' AND semester.year = 2017) OR (semester.semester = 'FA' AND semester.year = 2018) OR (semester.semester = 'WN' AND se...
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...
Tags that are more popular than the Solaris tag.
WITH cnt AS (SELECT Count FROM Tags WHERE TagName = 'solaris') SELECT COUNT(*) FROM Tags WHERE Count > (SELECT Count FROM cnt)
CREATE TABLE table_71833 ( "Park" text, "Tower height" text, "Drop height*" text, "Speed" text, "Model" text, "Opened" text, "Height requirement" text )
What opened with a drop height of 272feet?
SELECT "Opened" FROM table_71833 WHERE "Drop height*" = '272feet'
CREATE TABLE table_name_77 ( player VARCHAR, points VARCHAR, touchdowns VARCHAR, extra_points VARCHAR )
What Player has less than 10 Touchdowns and 0 Extra points and more than 5 Points?
SELECT player FROM table_name_77 WHERE touchdowns < 10 AND extra_points = 0 AND points > 5
CREATE TABLE table_26328 ( "Sector" text, "Establishments" real, "Sales, receipts, or shipments ($1,000)" real, "Annual payroll ($1,000)" real, "Paid employees" real )
If the establishment is 49319, what is the sales, receipts or shipments maximum amount?
SELECT MAX("Sales, receipts, or shipments ($1,000)") FROM table_26328 WHERE "Establishments" = '49319'
CREATE TABLE table_20580 ( "Platform" real, "Frequency (per hour)" real, "Destination" text, "Service Pattern" text, "Operator" text, "Line" text )
Who is the operator to Highbury & Islington?
SELECT "Operator" FROM table_20580 WHERE "Destination" = 'Highbury & Islington'
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 text, route text, drug_dose text ) ...
what number of patients were primarily admitted for sepsis before the year 2162?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "SEPSIS" AND demographic.admityear < "2162"
CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) 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_Allergy ( StuID INTEGE...
What is the number of each allergie type? Return a bar chart, and list in descending by the how many allergytype.
SELECT AllergyType, COUNT(AllergyType) FROM Allergy_Type GROUP BY AllergyType ORDER BY COUNT(AllergyType) DESC
CREATE TABLE table_204_87 ( id number, "courthouse" text, "city" text, "street address" text, "jurisdiction" text, "dates of use" text, "named for" text )
how many total courthouses have there been in mississippi ?
SELECT COUNT("courthouse") FROM table_204_87
CREATE TABLE table_26758262_1 ( district INTEGER, location_of_court VARCHAR )
What district is the court located in Tolland?
SELECT MAX(district) FROM table_26758262_1 WHERE location_of_court = "Tolland"
CREATE TABLE table_18655 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
Who ran for office at the Georgia 4 district in this election?
SELECT "Candidates" FROM table_18655 WHERE "District" = 'Georgia 4'
CREATE TABLE table_64410 ( "Opposing Team" text, "Against" real, "Date" text, "Venue" text, "Round" text )
What is the highest Against for a game against Bristol City?
SELECT MAX("Against") FROM table_64410 WHERE "Opposing Team" = 'bristol city'
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE Posts ...
Questions that formerly had the [rules-as-written] tag.
SELECT Posts.Id AS "post_link", Posts.Tags, PostHistory.CreationDate FROM Posts, PostHistory WHERE Posts.Id = PostHistory.PostId AND NOT Posts.Tags LIKE '%<rules-as-written>%' AND PostHistory.Text LIKE '%<rules-as-written>%' ORDER BY Posts.Id DESC, PostHistory.CreationDate
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, ...
i'd like a flight from KANSAS CITY to LOS ANGELES that arrives in LOS ANGELES in the late afternoon
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 ((flight.arrival_time <= 1800 AND flight.arrival_time >= 1600) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LOS ANGELES' AND flight...
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, ...
count the number of patients whose admission type is elective and days of hospital stay is greater than 11?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.days_stay > "11"
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER...
Show the number of courses each instructor taught in a bar chart, and rank y-axis from high to low order.
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM GROUP BY EMP_FNAME ORDER BY COUNT(EMP_FNAME) DESC
CREATE TABLE table_8896 ( "Heat" real, "Lane" real, "Name" text, "Country" text, "Mark" text )
What is the average lane racheal nachula has when the heat is less than 2?
SELECT AVG("Lane") FROM table_8896 WHERE "Heat" < '2' AND "Name" = 'racheal nachula'
CREATE TABLE table_817 ( "Stain" text, "Common use" text, "Nucleus" text, "Cytoplasm" text, "Red blood cell (RBC)" text, "Collagen fibers" text, "Specifically stains" text )
The pink cytoplasm will have a nucleus of what color?
SELECT "Nucleus" FROM table_817 WHERE "Cytoplasm" = 'Pink'
CREATE TABLE Medication ( Code INTEGER, Name VARCHAR(30), Brand VARCHAR(30), Description VARCHAR(30) ) CREATE TABLE Physician ( EmployeeID INTEGER, Name VARCHAR(30), Position VARCHAR(30), SSN INTEGER ) CREATE TABLE Affiliated_With ( Physician INTEGER, Department INTEGER, Pr...
A pie chart for finding the number of the physicians who are trained in a procedure that costs more than 5000.
SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE ta ( campus_job_id int, ...
What is the easiest class that I can take in order to fulfill the PreMajor requirement ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM progra...
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_Per...
Show me about the distribution of All_Games and Team_ID in a bar chart, and order by the bars from low to high please.
SELECT All_Games, Team_ID FROM basketball_match ORDER BY All_Games
CREATE TABLE table_name_6 ( record VARCHAR, score VARCHAR, visitor VARCHAR )
When the Vancouver Canucks were visiting, what was the record when the score was 4-2?
SELECT record FROM table_name_6 WHERE score = "4-2" AND visitor = "vancouver canucks"
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 t...
Count the number of unmarried patients who have an american indian/alaska native ethnic background.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE"
CREATE TABLE table_26448179_3 ( title VARCHAR, us_viewers__millions_ VARCHAR )
What title was watched by 3.8 million US viewers?
SELECT title FROM table_26448179_3 WHERE us_viewers__millions_ = "3.8"
CREATE TABLE table_32709 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text )
Which opponent had the result of W 24-14?
SELECT "Opponent" FROM table_32709 WHERE "Result" = 'w 24-14'
CREATE TABLE table_name_74 ( year INTEGER, location VARCHAR, anthem VARCHAR )
What is the earliest year it was located in gelredome, arnhem, and a Anthem of technoboy - next dimensional world?
SELECT MIN(year) FROM table_name_74 WHERE location = "gelredome, arnhem" AND anthem = "technoboy - next dimensional world"
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, give me the comparison about price over the name , and group by attribute name by a bar chart, and list by the bars in desc.
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Name DESC
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) 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 d...
what were the three most commonly prescribed medication for patients that had been previously prescribed with multivitamin iv during the same month since 2104?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'multivitamin iv' AND STRFTIME('%y', prescriptions.startdate) >= '...
CREATE TABLE table_17023 ( "Number" text, "TMS Number" text, "Builder" text, "Year built" real, "Carriage type" text )
What tms were built nzr addington in the year 1913
SELECT "TMS Number" FROM table_17023 WHERE "Builder" = 'NZR Addington' AND "Year built" = '1913'
CREATE TABLE table_203_383 ( id number, "week" number, "date" text, "opponent" text, "time" text, "game site" text, "tv" text, "result/score" text, "record" text, "bye" text )
who was the next opponent after san francisco 49ers ?
SELECT "opponent" FROM table_203_383 WHERE "date" > (SELECT "date" FROM table_203_383 WHERE "opponent" = 'san francisco 49ers') ORDER BY "date" LIMIT 1
CREATE TABLE table_34265 ( "Team" text, "Winners" text, "Runners-Up" text, "Third Place" text, "Fourth Place" text )
How many winners did Halcones uv xalapa have?
SELECT "Winners" FROM table_34265 WHERE "Team" = 'halcones uv xalapa'
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTas...
Top 1000 users in thailand.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Rank, Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Thailand%' LIMIT 1000
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
provide the number of patients whose age is less than 56 and drug name is insulin human regular?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "56" AND prescriptions.drug = "Insulin Human Regular"
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
count the number of patients who have already received the ferrous iron compound two or more times since 2102.
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'ferrous iron compound' AND STRFTIME('%y', treatment.treatmenttime) >= '2102') GROUP BY patient.uniquepid) ...
CREATE TABLE table_name_15 ( constructor VARCHAR, driver VARCHAR )
What is the name of the company that constructed the vehicle for Timo Glock?
SELECT constructor FROM table_name_15 WHERE driver = "timo glock"
CREATE TABLE table_1342292_4 ( district VARCHAR, first_elected VARCHAR )
What district had someone first elected in 1932?
SELECT district FROM table_1342292_4 WHERE first_elected = 1932
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 demographic ( subject_id text, hadm_id t...
what is maximum age of patients whose marital status is married and discharge location is rehab/distinct part hosp?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.discharge_location = "REHAB/DISTINCT PART HOSP"
CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperfield ( fieldid int, pape...
What is the paper of both Convolution and Combinatoric ?
SELECT DISTINCT paperkeyphrase.paperid FROM keyphrase, paperkeyphrase WHERE keyphrase.keyphrasename IN ('Convolution', 'Combinatoric') GROUP BY paperkeyphrase.paperid HAVING COUNT(DISTINCT keyphrase.keyphraseid) = 1
CREATE TABLE Elimination ( Elimination_ID text, Wrestler_ID text, Team text, Eliminated_By text, Elimination_Move text, Time text ) CREATE TABLE wrestler ( Wrestler_ID int, Name text, Reign text, Days_held text, Location text, Event text )
A bar chart for what is the number of locations of the wrestlers, and sort by the x-axis in descending.
SELECT Location, COUNT(Location) FROM wrestler GROUP BY Location ORDER BY Location DESC
CREATE TABLE table_203_803 ( id number, "draw" number, "country" text, "language" text, "artist" text, "song" text, "english translation" text, "place" number, "points" number )
which artist 's song scored the least amount of points , diana or kali ?
SELECT "artist" FROM table_203_803 WHERE "artist" IN ('dina', 'kali') ORDER BY "points" LIMIT 1
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id nu...
let's count the number of patients who received a entral infus nutrit sub procedure within 2 months after receiving a contrast aortogram procedure until 2104.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'contrast ao...
CREATE TABLE table_27698941_2 ( high_points VARCHAR, date VARCHAR )
How many people led in points during the game on October 5?
SELECT COUNT(high_points) FROM table_27698941_2 WHERE date = "October 5"
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
How many rooms have king beds? Report the number for each decor type Plot them as bar chart, show X from low to high order.
SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor ORDER BY decor
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId...
Open and Closed questions per tag.
SELECT COALESCE(c.TargetTagName, b.TargetTagName, a.TargetTagName, Tags.TagName) AS "tagname", COUNT(Posts.ClosedDate) AS closed, COUNT(*) - COUNT(Posts.ClosedDate) AS "open" FROM Posts JOIN PostTags ON (Posts.Id = PostTags.PostId) JOIN Tags ON (PostTags.TagId = Tags.Id) LEFT JOIN TagSynonyms AS a ON (Tags.TagName = a....
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE chartevents ( row_id number, subject_id number, had...
count the number of patients that were diagnosed since 3 years ago with oth/uns inf-cen ven cath.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_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 = 'oth/uns inf-cen ven cath') AND DATETIME(diagnoses_icd.char...
CREATE TABLE table_name_64 ( year INTEGER, engine VARCHAR )
What was the lowest year that the engine Ilmor 2175a 3.5 v10 was used?
SELECT MIN(year) FROM table_name_64 WHERE engine = "ilmor 2175a 3.5 v10"
CREATE TABLE table_58658 ( "Matches" real, "Wins" real, "Draw" real, "Losses" real, "Against" real )
How many wins has more than 165 against?
SELECT MAX("Wins") FROM table_58658 WHERE "Against" > '165'
CREATE TABLE table_43749 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Who is the player from the United States with a score of 71-72=143?
SELECT "Player" FROM table_43749 WHERE "Country" = 'united states' AND "Score" = '71-72=143'
CREATE TABLE table_name_96 ( polling_firm VARCHAR, date_of_polling VARCHAR, green VARCHAR, link VARCHAR, liberal VARCHAR )
Which september 26 28, 2011 polling firm had a Link of html, less than 36 liberals, and less than 8 green?
SELECT polling_firm FROM table_name_96 WHERE link = "html" AND liberal < 36 AND green < 8 AND date_of_polling = "september 26–28, 2011"
CREATE TABLE table_name_72 ( pick VARCHAR, year VARCHAR )
What was 1948's pick?
SELECT pick FROM table_name_72 WHERE year = 1948
CREATE TABLE table_name_95 ( driver VARCHAR, grid VARCHAR )
What driver shows grid as 18?
SELECT driver FROM table_name_95 WHERE grid = 18
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...
Top 1000 Users in India.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%india%' OR UPPER(Location) LIKE '%IND' ORDER BY Reputation DESC LIMIT 1000