table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
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,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | count the number of patients whose discharge location is snf and primary disease is posterior communicating aneurysm/sda? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" |
CREATE TABLE table_21287 (
"June 10-11" text,
"March 27-29" text,
"January 15-16" text,
"November 3" text,
"August 21-22" text
) | Name march 27-29 where january 15-16 is january 15, 1991 | SELECT "March 27-29" FROM table_21287 WHERE "January 15-16" = 'January 15, 1991' |
CREATE TABLE table_51501 (
"Pick" real,
"Round" text,
"Player" text,
"Position" text,
"School" text
) | Who is the guard for Wisconsin? | SELECT "Player" FROM table_51501 WHERE "Position" = 'guard' AND "School" = 'wisconsin' |
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 the number of patients whose marital status is single and diagnoses long title is bacterial pneumonia, unspecified? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Bacterial pneumonia, unspecified" |
CREATE TABLE table_60297 (
"Year" real,
"Team" text,
"Co-Drivers" text,
"Class" text,
"Laps" real,
"Pos." text
) | What position did the driver from Audi Sport North America finish in the race after 2008? | SELECT "Pos." FROM table_60297 WHERE "Team" = 'audi sport north america' AND "Year" > '2008' |
CREATE TABLE table_229917_2 (
tail_number VARCHAR,
brief_description VARCHAR
) | What's the tail number of the airplane involved in the accident described as crashed? | SELECT tail_number FROM table_229917_2 WHERE brief_description = "Crashed" |
CREATE TABLE table_13516 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | What was the time for the match that resulted in a loss in less than 3 rounds? | SELECT "Time" FROM table_13516 WHERE "Res." = 'loss' AND "Round" < '3' |
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... | Total Posts by Database Server Per Month - Oracle. | SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'Oracle' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'oracle%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY ... |
CREATE TABLE table_21183 (
"Show" text,
"Last Aired" real,
"Previous Network" text,
"Retitled as/Same" text,
"New/Returning/Same Network" text,
"Returning" text
) | Which show as previously on The Family Channel? | SELECT "Show" FROM table_21183 WHERE "Previous Network" = 'The Family Channel' |
CREATE TABLE Guests (
guest_id INTEGER,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
guest_last_name VARCHAR(80),
date_of_birth DATETIME
)
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME,
available_yn BIT
)
CREATE TABLE Apartment_B... | What are the facility codes of the apartments with more than four bedrooms, and count them by a bar chart, I want to list by the y-axis from high to low. | SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code) DESC |
CREATE TABLE table_11351 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What is the average number of laps for grid 8? | SELECT AVG("Laps") FROM table_11351 WHERE "Grid" = '8' |
CREATE TABLE table_name_19 (
wins VARCHAR,
pct VARCHAR
) | How many wins when the pct, is .848? | SELECT wins FROM table_name_19 WHERE pct = ".848" |
CREATE TABLE table_13051 (
"Team 1" text,
"Agg." text,
"Team 2" text,
"1st leg" text,
"2nd leg" text
) | What 2nd leg has pelister as team 1? | SELECT "2nd leg" FROM table_13051 WHERE "Team 1" = 'pelister' |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE diagnosis (
diagnosisid number,
... | what was the top four of the most frequent procedures until 2 years ago? | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4 |
CREATE TABLE table_17427 (
"Year" real,
"Mens singles" text,
"Womens singles" text,
"Mens doubles" text,
"Womens doubles" text,
"Mixed doubles" text
) | Who won the womens singles when Marc Zwiebler won the men's singles? | SELECT "Womens singles" FROM table_17427 WHERE "Mens singles" = 'Marc Zwiebler' |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE d_... | when did patient 9294 first have a arterial bp [systolic] measured on the first intensive care unit visit? | SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9294) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (S... |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
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,
... | what exactly does carbuncle, site nec mean? | SELECT d_icd_diagnoses.long_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'carbuncle, site nec' UNION SELECT d_icd_procedures.long_title FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'carbuncle, site nec' |
CREATE TABLE table_name_27 (
bulls VARCHAR,
venue VARCHAR
) | What was the total number for the Bulls when they were at Old Trafford? | SELECT COUNT(bulls) FROM table_name_27 WHERE venue = "old trafford" |
CREATE TABLE table_5938 (
"Medium" text,
"Title" text,
"Date" text,
"Theatre, Studio, or Network" text,
"Role" text
) | What production was created by Monogram? | SELECT "Title" FROM table_5938 WHERE "Theatre, Studio, or Network" = 'monogram' |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
Crea... | Posts with images hosted on ImageShack. | SELECT Posts.Id, Posts.Id AS "post_link", PostTypes.Name AS "type", Posts.Score, Posts.CreationDate, Posts.Tags FROM Posts JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Body LIKE '%<img%.imageshack.us/img%' LIMIT 1000 |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY ... | For all employees who have the letters D or S in their first name, a line chart shows the change of employee_id over hire_date | SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' |
CREATE TABLE table_69 (
"Rank" real,
"Member Association" text,
"Points" text,
"Group stage" real,
"Play-off" real,
"AFC Cup" real
) | How many countries earned 177.2 points? | SELECT COUNT("Member Association") FROM table_69 WHERE "Points" = '177.2' |
CREATE TABLE table_name_27 (
opponents_in_the_final VARCHAR,
outcome VARCHAR,
surface VARCHAR
) | Tell me the opponents for runner-up and surface of grass | SELECT opponents_in_the_final FROM table_name_27 WHERE outcome = "runner-up" AND surface = "grass" |
CREATE TABLE table_5552 (
"Affiliation" text,
"Life peers" text,
"Hereditary peers" text,
"Lords spiritual" text,
"Total" real
) | Which Total has a Hereditary peer of , and a Lords spiritual of , and a Life peers of 2, and an Affiliation of plaid cymru? | SELECT COUNT("Total") FROM table_5552 WHERE "Hereditary peers" = '–' AND "Lords spiritual" = '–' AND "Life peers" = '2' AND "Affiliation" = 'plaid cymru' |
CREATE TABLE table_72665 (
"Year" real,
"Dates" text,
"Champion" text,
"Country" text,
"Score" text,
"To par" text,
"Margin of victory" text,
"Purse ( US$ )" real,
"Winners share" real
) | What is the lowest year listed? | SELECT MIN("Year") FROM table_72665 |
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 diagnosis (
diagn... | how many hours have passed since the last time patient 006-2586 has received a albumin-lab test during this hospital visit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586' AND patient.hospi... |
CREATE TABLE table_40664 (
"Player" text,
"Club" text,
"League" real,
"FA Cup" real,
"FA Trophy" real,
"League Cup" real,
"Total" real
) | Which League has a League Cup smaller than 0? | SELECT MIN("League") FROM table_40664 WHERE "League Cup" < '0' |
CREATE TABLE table_57399 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | Tell me the score for december 3 | SELECT "Score" FROM table_57399 WHERE "Date" = 'december 3' |
CREATE TABLE table_13388681_1 (
purse___$__ VARCHAR,
margin_of_victory VARCHAR
) | How much is the purse ( $ ) when the margin of victory is 1 stroke? | SELECT purse___$__ FROM table_13388681_1 WHERE margin_of_victory = "1 stroke" |
CREATE TABLE table_57602 (
"Index" text,
"Organization" text,
"Year" text,
"Rank" real,
"Out of" real
) | Tell me the year for rank more than 35 and out of 167 | SELECT "Year" FROM table_57602 WHERE "Rank" > '35' AND "Out of" = '167' |
CREATE TABLE table_20803065_1 (
senator VARCHAR,
religion VARCHAR
) | List the presbyterian members of the senate. | SELECT senator FROM table_20803065_1 WHERE religion = "Presbyterian" |
CREATE TABLE Regular_Order_Products (
regular_order_id INTEGER,
product_id INTEGER
)
CREATE TABLE Employees (
employee_id INTEGER,
employee_address_id INTEGER,
employee_name VARCHAR(80),
employee_phone VARCHAR(80)
)
CREATE TABLE Delivery_Route_Locations (
location_code VARCHAR(10),
rou... | List the state names and the number of customers living in each state, I want to list Y-axis in descending order. | SELECT state_province_county, COUNT(*) FROM Customer_Addresses AS t1 JOIN Addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county ORDER BY COUNT(*) DESC |
CREATE TABLE Student_Tests_Taken (
registration_id INTEGER,
date_test_taken DATETIME,
test_result VARCHAR(255)
)
CREATE TABLE Course_Authors_and_Tutors (
author_id INTEGER,
author_tutor_ATB VARCHAR(3),
login_name VARCHAR(40),
password VARCHAR(40),
personal_name VARCHAR(80),
middle_n... | Which tests have 'Pass' results? Return the dates when the tests were taken, and count them by a line chart, and order x-axis from high to low order. | SELECT date_test_taken, COUNT(date_test_taken) FROM Student_Tests_Taken WHERE test_result = "Pass" ORDER BY date_test_taken DESC |
CREATE TABLE table_16395 (
"Pick #" real,
"CFL Team" text,
"Player" text,
"Position" text,
"College" text
) | How many CFL teams are from York college? | SELECT COUNT("CFL Team") FROM table_16395 WHERE "College" = 'York' |
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
... | What 's the easiest class I can take to make the MDE requirement ? | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_cou... |
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 CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
... | Users who have answered the most distinct questions. | SELECT A.OwnerUserId AS "user_link", COUNT(DISTINCT A.ParentId) AS "distinct_questions_answered" FROM Posts AS A WHERE A.PostTypeId = 2 AND A.OwnerUserId > 0 GROUP BY A.OwnerUserId ORDER BY 'distinct_questions_answered' DESC |
CREATE TABLE table_75920 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | What is the Team with a game of more than 56, and the score is l 85 90 (ot)? | SELECT "Team" FROM table_75920 WHERE "Game" > '56' AND "Score" = 'l 85–90 (ot)' |
CREATE TABLE Discount_Coupons (
coupon_id INTEGER,
date_issued DATETIME,
coupon_amount DECIMAL(19,4)
)
CREATE TABLE Payments (
payment_id INTEGER,
booking_id INTEGER,
customer_id INTEGER,
payment_type_code VARCHAR(15),
amount_paid_in_full_yn VARCHAR(1),
payment_date DATETIME,
am... | How many bookings did each customer make? Show the customer id as the Y-axis and the first name as the X-axis in a bar chart, and could you sort by the X-axis from low to high? | SELECT T1.first_name, T1.customer_id FROM Customers AS T1 JOIN Bookings AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.first_name |
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_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Stacked bar chart of team_id for with each All_Home in each acc road, and could you list by the Y in ascending? | SELECT ACC_Road, Team_ID FROM basketball_match GROUP BY All_Home, ACC_Road ORDER BY Team_ID |
CREATE TABLE table_47268 (
"Name" text,
"Years" text,
"League" real,
"Scottish Cup" real,
"League Cup" real,
"Europe" real,
"Total" real
) | Which Total has a Name of eoin jess category:articles with hcards, and a Scottish Cup larger than 23? | SELECT MIN("Total") FROM table_47268 WHERE "Name" = 'eoin jess category:articles with hcards' AND "Scottish Cup" > '23' |
CREATE TABLE table_name_45 (
loss VARCHAR,
record VARCHAR
) | During which loss was the record 48-50? | SELECT loss FROM table_name_45 WHERE record = "48-50" |
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,
... | how many patients whose diagnoses short title is status amput below knee and lab test abnormal status is delta? | 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.short_title = "Status amput below knee" AND lab.flag = "delta" |
CREATE TABLE Channels (
Channel_ID INTEGER,
Other_Details VARCHAR(255)
)
CREATE TABLE Locations (
Location_ID INTEGER,
Other_Details VARCHAR(255)
)
CREATE TABLE Products (
Product_ID INTEGER,
Product_Type_Code CHAR(15),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4)
)
CREATE T... | Show the names of products and the number of events they are in Visualize by bar chart, and could you display from low to high by the X-axis? | SELECT Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name ORDER BY Product_Name |
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREA... | list 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_59133 (
"Station Name" text,
"Opening Year" text,
"Municipality" text,
"Park and Ride Lot" text,
"Free Fare Zone" text
) | For the Temple Square station, what is the park & ride lot name? | SELECT "Park and Ride Lot" FROM table_59133 WHERE "Station Name" = 'temple square' |
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compa... | what flights can i find from PITTSBURGH to SAN FRANCISCO after 900 | 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 = 'SAN FRANCISCO' AND flight.departure_time > 900 AND flight.to_airport = AIRPORT_SERVICE_1.... |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversa... | Number of questions with a positive score and at least one downvote. | SELECT COUNT(DISTINCT (p.Id)) FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId AND v.VoteTypeId = 2 WHERE p.PostTypeId = 1 AND p.Score > 0 |
CREATE TABLE table_14223 (
"T-35" text,
"T-100" text,
"KV-1 M1940" text,
"KV-1 M1941" text,
"KV-1 M1942" text,
"KV-1S M1942" text,
"KV-85 M1943" text,
"IS-2 M1945" text,
"IS-3 M1945" text
) | What's the T-100 when the IS-3 is 150 (225)? | SELECT "T-100" FROM table_14223 WHERE "IS-3 M1945" = '150 (225)' |
CREATE TABLE student_course_registrations (
course_id VARCHAR,
student_id VARCHAR
)
CREATE TABLE student_course_attendance (
course_id VARCHAR,
student_id VARCHAR
) | Find the id of courses which are registered or attended by student whose id is 121? | SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121 |
CREATE TABLE table_35431 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | What is the name of the player with a pick # less than 5 and an overall of 284? | SELECT "Name" FROM table_35431 WHERE "Pick #" < '5' AND "Overall" = '284' |
CREATE TABLE table_11873 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
) | In what venue did the 1982 FIFA World Cup Qualification take place? | SELECT "Venue" FROM table_11873 WHERE "Competition" = '1982 fifa world cup qualification' |
CREATE TABLE player (
pid number,
pname text,
ycard text,
hs number
)
CREATE TABLE tryout (
pid number,
cname text,
ppos text,
decision text
)
CREATE TABLE college (
cname text,
state text,
enr number
) | Find the average hours for the students whose tryout decision is no. | SELECT AVG(T1.hs) FROM player AS T1 JOIN tryout AS T2 ON T1.pid = T2.pid WHERE T2.decision = 'no' |
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResults (
... | Votes on which day after posting. | SELECT DATEDIFF(day, p.CreationDate, CreationDate) AS Days, COUNT(v.Id) AS Count FROM Votes AS v INNER JOIN Posts AS p ON v.PostId = p.Id GROUP BY DATEDIFF(day, p.CreationDate, CreationDate) ORDER BY DATEDIFF(day, p.CreationDate, CreationDate) |
CREATE TABLE table_name_23 (
airport VARCHAR,
icao VARCHAR
) | What Airport's ICAO is ENTO? | SELECT airport FROM table_name_23 WHERE icao = "ento" |
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... | What is the minimum price of the rooms for each different decor? Show me a bar chart!, I want to list in ascending by the Y please. | SELECT decor, MIN(basePrice) FROM Rooms GROUP BY decor ORDER BY MIN(basePrice) |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
Ta... | How to find all answers that a certain person has answered me?. http://meta.stackoverflow.com/questions/340245/how-to-find-all-answers-that-a-certain-person-has-answered-me | WITH questions AS (SELECT q.Id, q.OwnerUserId FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = '##userid:int?3577745##') SELECT q.Id AS "post_link", q.OwnerUserId AS "user_link", (SELECT COUNT(*) FROM questions AS qs WHERE q.OwnerUserId = qs.OwnerUserId) AS "#_tot_questions" FROM questio... |
CREATE TABLE Person (
age INTEGER,
job VARCHAR
)
CREATE TABLE person (
age INTEGER,
job VARCHAR
) | Find the number of people whose age is greater than all engineers. | SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM Person WHERE job = 'engineer') |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescript... | Number of badges of a certain kind. | SELECT COUNT(*) AS "count" FROM Badges AS b WHERE (b.Name = '##name?Caucus##') GROUP BY b.Name LIMIT 100 |
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 admission year is less than 2150 and drug route is iv bolus? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2150" AND prescriptions.route = "IV BOLUS" |
CREATE TABLE pilot_record (
Record_ID int,
Pilot_ID int,
Aircraft_ID int,
Date text
)
CREATE TABLE pilot (
Pilot_ID int,
Pilot_name text,
Rank int,
Age int,
Nationality text,
Position text,
Join_Year int,
Team text
)
CREATE TABLE aircraft (
Aircraft_ID int,
Orde... | what are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality. | SELECT Nationality, COUNT(*) FROM pilot GROUP BY Nationality |
CREATE TABLE table_203_158 (
id number,
"date" text,
"time" text,
"opponent#" text,
"rank#" text,
"site" text,
"tv" text,
"result" text,
"attendance" number
) | which game did the opponent score only 7 points ? | SELECT "date" FROM table_203_158 WHERE "result" = 7 |
CREATE TABLE Acceptance (
Submission_ID int,
Workshop_ID int,
Result text
)
CREATE TABLE workshop (
Workshop_ID int,
Date text,
Venue text,
Name text
)
CREATE TABLE submission (
Submission_ID int,
Scores real,
Author text,
College text
) | Show the authors of their total submissions with a bar chart. | SELECT Author, COUNT(Author) FROM submission GROUP BY Author |
CREATE TABLE table_44711 (
"Name" text,
"Team" text,
"Qual 1" text,
"Qual 2" text,
"Best" text
) | What is the best time for a team with a first-qualifying time of 59.448? | SELECT "Best" FROM table_44711 WHERE "Qual 1" = '59.448' |
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... | Questions with a single tag. | SELECT Id AS "post_link", CreationDate, Score FROM Posts WHERE Tags = '<' + LOWER('##TagName:string##') + '>' ORDER BY CreationDate DESC LIMIT 100 |
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
start_time time,
end_time time,
monday varchar,
tuesday varchar,
wednesday varchar,
thursday varchar,
friday varchar,
saturday varchar,
sunday varchar,
has_final_proje... | Which are the 11 -credit upper-level classes ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 11 AND program_course.category LIKE 'ULCS' |
CREATE TABLE table_20396_1 (
team VARCHAR,
points VARCHAR
) | What team scored 4 points? | SELECT team FROM table_20396_1 WHERE points = "4" |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE vitalperiodic (
vitalperiodici... | in the first hospital encounter what is patient 011-31229's age? | SELECT patient.age FROM patient WHERE patient.uniquepid = '011-31229' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1 |
CREATE TABLE table_name_69 (
driver VARCHAR,
zan_2 VARCHAR
) | What driver has 5 as the zan 2? | SELECT driver FROM table_name_69 WHERE zan_2 = "5" |
CREATE TABLE table_54722 (
"Superlative" text,
"Actress" text,
"Record Set" text,
"Year" real,
"Notes" text
) | When was the last year when Katharine Hepburn won? | SELECT MAX("Year") FROM table_54722 WHERE "Actress" = 'katharine hepburn' |
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE semester (
... | RUSSIAN 550 has which courses as prerequisites ? | SELECT DISTINCT COURSE_1.department, COURSE_1.name, COURSE_1.number FROM course AS COURSE_0 INNER JOIN course_prerequisite ON COURSE_0.course_id = course_prerequisite.course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.pre_course_id WHERE COURSE_0.department = 'RUSSIAN' AND COURSE_0.numb... |
CREATE TABLE table_name_71 (
home_team VARCHAR,
venue VARCHAR
) | Which home team's venue is junction oval? | SELECT home_team FROM table_name_71 WHERE venue = "junction oval" |
CREATE TABLE table_name_82 (
attendance__away_ INTEGER,
result VARCHAR,
date VARCHAR
) | Name the average attendance with result of won 2-0 on 2 november 2007 | SELECT AVG(attendance__away_) FROM table_name_82 WHERE result = "won 2-0" AND date = "2 november 2007" |
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 diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime ti... | since 1 year ago, patient 19144 has been admitted into the hospital? | SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 19144 AND DATETIME(admissions.admittime) >= DATETIME(CURRENT_TIME(), '-1 year') |
CREATE TABLE table_name_26 (
wins INTEGER,
loses VARCHAR,
against VARCHAR
) | How many Wins have Losses larger than 2, and an Against of 73.3? | SELECT SUM(wins) FROM table_name_26 WHERE loses > 2 AND against = "73.3" |
CREATE TABLE table_2597 (
"Market Rank & City of license /Market" text,
"Station" text,
"Channel TV / DT" text,
"Owned since" real,
"Affiliation" text
) | When was the station WLS-TV owned since? | SELECT "Owned since" FROM table_2597 WHERE "Station" = 'WLS-TV' |
CREATE TABLE table_name_89 (
date VARCHAR,
home_team VARCHAR
) | When did Geelong play as the home team? | SELECT date FROM table_name_89 WHERE home_team = "geelong" |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
one_direction_cost int,
round_trip_cost int,
... | i'd like to have some information on a ticket from DENVER to ATLANTA with a stop in PITTSBURGH | 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... |
CREATE TABLE table_47901 (
"Team" text,
"Outgoing manager" text,
"Manner of departure" text,
"Date of vacancy" text,
"Replaced by" text,
"Date of appointment" text,
"Position in table" text
) | Who was the outgoing manager who departed due to fc energie cottbus purchased rights? | SELECT "Outgoing manager" FROM table_47901 WHERE "Manner of departure" = 'fc energie cottbus purchased rights' |
CREATE TABLE companies (
id number,
name text,
headquarters text,
industry text,
sales_billion number,
profits_billion number,
assets_billion number,
market_value_billion text
)
CREATE TABLE office_locations (
building_id number,
company_id number,
move_in_year number
)
CRE... | For each company, return the company name and the name of the building its office is located in. | SELECT T3.name, T2.name FROM office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN companies AS T3 ON T1.company_id = T3.id |
CREATE TABLE table_33801 (
"Medal" text,
"Name" text,
"Games" text,
"Sport" text,
"Event" text
) | What is the medal named fatuma roba category:articles with hcards for? | SELECT "Medal" FROM table_33801 WHERE "Name" = 'fatuma roba category:articles with hcards' |
CREATE TABLE table_74677 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | On what date does Essendon play as the away team? | SELECT "Date" FROM table_74677 WHERE "Away team" = 'essendon' |
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... | provide the number of patients whose death status is 0 and procedure long title is insertion of one vascular stent? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Insertion of one vascular stent" |
CREATE TABLE table_name_90 (
pick VARCHAR,
college VARCHAR
) | Who is the pick from the Purdue College? | SELECT pick FROM table_name_90 WHERE college = "purdue" |
CREATE TABLE table_23332 (
"District" real,
"Representative" text,
"Party" text,
"Residence" text,
"Counties represented" text,
"Term ends" real,
"First Elected" real
) | Name the party for bensalem | SELECT "Party" FROM table_23332 WHERE "Residence" = 'Bensalem' |
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
... | Draw a bar chart about the distribution of meter_600 and meter_100 , and could you display x axis in descending order? | SELECT meter_600, meter_100 FROM swimmer ORDER BY meter_600 DESC |
CREATE TABLE table_name_24 (
away_team VARCHAR
) | What is the Away Team score of North Melbourne? | SELECT away_team AS score FROM table_name_24 WHERE away_team = "north melbourne" |
CREATE TABLE table_42169 (
"Date" text,
"Opponent" text,
"Score" text,
"Site/Stadium" text,
"Record" text
) | What was the score of the game played at Harmon Stadium on February 24? | SELECT "Score" FROM table_42169 WHERE "Site/Stadium" = 'harmon stadium' AND "Date" = 'february 24' |
CREATE TABLE table_45320 (
"Year" real,
"Program Title" text,
"Placement" text,
"Score" real,
"Class" text
) | What is the lowest score for a year before 2008 and had 3rd place? | SELECT MIN("Score") FROM table_45320 WHERE "Year" < '2008' AND "Placement" = '3rd' |
CREATE TABLE table_56059 (
"\\theta_i" real,
"Simulated datasets (step 2)" text,
"Summary statistic \\omega_{S,i} (step 3)" real,
"Distance \\rho(\\omega_{S,i}, \\omega_E) (step 4)" real,
"Outcome (step 4)" text
) | What is the summary of the algorithm with a theta i of 0.43? | SELECT "Summary statistic \\omega_{S,i} (step 3)" FROM table_56059 WHERE "\\theta_i" = '0.43' |
CREATE TABLE table_204_13 (
id number,
"finished" text,
"post" number,
"horse" text,
"jockey" text,
"trainer" text,
"owner" text,
"time / behind" text
) | name a horse that placed after hello and was owned by more than one person . | SELECT "horse" FROM table_204_13 WHERE "finished" > (SELECT "finished" FROM table_204_13 WHERE "horse" = 'hello') AND "owner" > 1 ORDER BY "finished" LIMIT 1 |
CREATE TABLE table_name_46 (
terms VARCHAR,
left_office VARCHAR
) | How many terms did the governor that left office on August 4, 1825 serve? | SELECT terms FROM table_name_46 WHERE left_office = "august 4, 1825" |
CREATE TABLE table_6607 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | Which visitor has detroit as the home, and february 24 as the date? | SELECT "Visitor" FROM table_6607 WHERE "Home" = 'detroit' AND "Date" = 'february 24' |
CREATE TABLE Customers (
Customer_ID INTEGER,
Customer_Details VARCHAR(255)
)
CREATE TABLE Payments (
Payment_ID INTEGER,
Settlement_ID INTEGER,
Payment_Method_Code VARCHAR(255),
Date_Payment_Made DATE,
Amount_Payment INTEGER
)
CREATE TABLE Settlements (
Settlement_ID INTEGER,
Clai... | Give me a histogram to show the date and the amount for all the payments processed with Visa, and show Date_Payment_Made in ascending order please. | SELECT Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY Date_Payment_Made |
CREATE TABLE table_25103 (
"District" text,
"Vacator" text,
"Reason for change" text,
"Successor" text,
"Date successor seated" text
) | Name the vacator for resigned february 26, 1836 because of ill health | SELECT "Vacator" FROM table_25103 WHERE "Reason for change" = 'Resigned February 26, 1836 because of ill health' |
CREATE TABLE table_train_57 (
"id" int,
"bleeding" int,
"in_another_study" bool,
"hiv_infection" bool,
"hepatitis_c_infection" bool,
"receiving_vasopressor" bool,
"hypotension" bool,
"NOUSE" float
) | hcv infection, active | SELECT * FROM table_train_57 WHERE hepatitis_c_infection = 1 |
CREATE TABLE table_name_4 (
tournament VARCHAR
) | What tournament has a 2010 of 1r, and a 2008 of 1r? | SELECT tournament FROM table_name_4 WHERE 2010 = "1r" AND 2008 = "1r" |
CREATE TABLE table_2215159_2 (
outcome VARCHAR,
partner VARCHAR
) | What was the outcome of the game when the partner is Rafael Osuna? | SELECT outcome FROM table_2215159_2 WHERE partner = "Rafael Osuna" |
CREATE TABLE table_11111116_8 (
written_by VARCHAR,
us_viewers__million_ VARCHAR
) | Who wrote the episodes that were viewed by 2.12 million viewers? | SELECT written_by FROM table_11111116_8 WHERE us_viewers__million_ = "2.12" |
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... | what is maximum age of patients whose gender is m and ethnicity is hispanic/latino - puerto rican? | SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" |
CREATE TABLE table_28585 (
"District" text,
"Incumbent" text,
"Party" text,
"Elected" real,
"Status" text,
"Result" text
) | How many elected catagories are there for the district with Saxby Chambliss as the incumbent? | SELECT COUNT("Elected") FROM table_28585 WHERE "Incumbent" = 'Saxby Chambliss' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.