table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
... | how many hours it's been since patient 31854's last neutrophils lab test in their current hospital encounter? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'neutrophils') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31854 AND admiss... |
CREATE TABLE table_1816947_2 (
highest_attendance_away VARCHAR,
average_attendance_home VARCHAR
) | When the home attendance is 3.123, what's the highest away attendance? | SELECT highest_attendance_away FROM table_1816947_2 WHERE average_attendance_home = "3.123" |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
... | what was the name of the drug patient 007-4119 was prescribed in 02/last year two or more times? | SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007... |
CREATE TABLE table_16048129_5 (
number_of_families VARCHAR,
_percentage_of_total_deportees VARCHAR
) | How many total families are there in regions with 5.8 percent of the population being made up of deportees? | SELECT COUNT(number_of_families) FROM table_16048129_5 WHERE _percentage_of_total_deportees = "5.8" |
CREATE TABLE table_19827 (
"North Carolina" text,
"273.7%" text,
"South Carolina" text,
"132.1%" text,
"Mississippi" text,
"95.8%" text,
"Wisconsin" text,
"59.4%" text,
"Vermont" text,
"32.5%" text
) | Name the vermont for where 95.8% is 60.6% | SELECT "Vermont" FROM table_19827 WHERE "95.8%" = '60.6%' |
CREATE TABLE table_52581 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent in the final" text,
"Score" text
) | Name the surface for score of 7 6(4), 6 1 | SELECT "Surface" FROM table_52581 WHERE "Score" = '7–6(4), 6–1' |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varc... | 250 is offered when in next semester ? | SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offe... |
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... | Undeleted answers that were deleted from review. | SELECT e.PostId AS "post_link", p.Score, p.CreationDate AS "creation_date", e.CreationDate AS "undeletion_date" FROM PostHistory AS e INNER JOIN Posts AS p ON p.Id = e.PostId WHERE e.PostHistoryTypeId = 13 AND p.PostTypeId = 2 AND p.Id NOT IN (SELECT f.PostId FROM PostHistory AS f WHERE f.PostHistoryTypeId = 12) AND p.... |
CREATE TABLE table_20052 (
"Position" real,
"Team" text,
"Points" real,
"Played" real,
"Won" real,
"Drawn" real,
"Lost" real,
"For" real,
"Against" real,
"Difference" text
) | When there is a lost of 2 what is the mumber drawn? | SELECT MAX("Drawn") FROM table_20052 WHERE "Lost" = '2' |
CREATE TABLE table_203_354 (
id number,
"party" text,
"candidate(s)" text,
"votes" number,
"percentage" number
) | in the 1996 forum , which candidate had the least votes ? | SELECT "candidate(s)" FROM table_203_354 ORDER BY "votes" LIMIT 1 |
CREATE TABLE table_57677 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | When fitzroy was the home team, how much did the away team score? | SELECT "Away team score" FROM table_57677 WHERE "Home team" = 'fitzroy' |
CREATE TABLE table_name_18 (
week__number VARCHAR,
original_artist VARCHAR,
theme VARCHAR
) | What is the Week # when the Beatles were the original artist and the theme was The Beatles? | SELECT week__number FROM table_name_18 WHERE original_artist = "the beatles" AND theme = "the beatles" |
CREATE TABLE table_42239 (
"Television service" text,
"Country" text,
"Language" text,
"Content" text,
"HDTV" text,
"Package/Option" text
) | What is the content when the package/option is qualsiasi and sky primafila 14 is the television service? | SELECT "Content" FROM table_42239 WHERE "Package/Option" = 'qualsiasi' AND "Television service" = 'sky primafila 14' |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREA... | how many days have passed since patient 003-10080 last took a bicarbonate lab test during the current hospital encounter? | SELECT 1 * (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 = '003-10080' AND patient.hospi... |
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime tim... | how many patients were prescribed with docusate sodium within 2 months after the procedure of non-invasive mech vent, in 2102? | 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 = 'non-invasiv... |
CREATE TABLE table_18236 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | To what party does Cardiss Collins belong? | SELECT "Party" FROM table_18236 WHERE "Incumbent" = 'Cardiss Collins' |
CREATE TABLE table_204_721 (
id number,
"rank" number,
"wrestler" text,
"no. of reigns" number,
"combined\ndefenses" number,
"combined\ndays" number
) | what is the difference in the number of combined days between kevin steen and davey richards ? | SELECT ABS((SELECT "combined\ndays" FROM table_204_721 WHERE "wrestler" = 'kevin steen') - (SELECT "combined\ndays" FROM table_204_721 WHERE "wrestler" = 'davey richards')) |
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 medication (
medi... | tell me the average hospital cost when there is coronary artery disease until 2104? | SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'coronary artery disease')) AND STRFTIME('%y'... |
CREATE TABLE table_10695 (
"Party" text,
"1999 Election" real,
"2003 Election" real,
"2007 Election" real,
"May 2010" real,
"2011 Election" real,
"May 2012" real
) | Which election, in 2003 had the lowest turnout, but also had 57 in 1999 and less then 54 in 2007? | SELECT MIN("2003 Election") FROM table_10695 WHERE "1999 Election" = '57' AND "2007 Election" < '54' |
CREATE TABLE table_29218221_2 (
rank VARCHAR,
tues_31_may VARCHAR
) | What is the rank of the rider whose Tues 31 May time was 19' 02.34 118.903mph? | SELECT rank FROM table_29218221_2 WHERE tues_31_may = "19' 02.34 118.903mph" |
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER,
Customer_Event_ID INTEGER,
service_type_code CHAR(15),
resident_id INTEGER,
property_id INTEGER,
date_moved_in DATETIME
)
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER,
Date_and_Date DATETIME,
Status_of_Thi... | Please compare the frequency of the customer details using a bar chart, and could you list from low to high by the customer_details? | SELECT customer_details, COUNT(customer_details) FROM Customers GROUP BY customer_details ORDER BY customer_details |
CREATE TABLE table_54180 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What day is st kilda the home side? | SELECT "Date" FROM table_54180 WHERE "Home team" = 'st kilda' |
CREATE TABLE table_name_78 (
works_number INTEGER,
type VARCHAR,
date VARCHAR
) | What is the total works number of the locomotive with 0-6-4t type after 1875? | SELECT SUM(works_number) FROM table_name_78 WHERE type = "0-6-4t" AND date > 1875 |
CREATE TABLE table_15318 (
"Year" text,
"Start" text,
"Qual" text,
"Rank" text,
"Finish" text,
"Laps" real
) | How many laps were in 1958? | SELECT SUM("Laps") FROM table_15318 WHERE "Year" = '1958' |
CREATE TABLE table_name_66 (
competition VARCHAR,
final_position VARCHAR,
final_round VARCHAR
) | What competition had a final round in the finals and the final position winners? | SELECT competition FROM table_name_66 WHERE final_position = "winners" AND final_round = "finals" |
CREATE TABLE table_14950 (
"Code Name" text,
"Function (figure)" text,
"Real Name" text,
"Birthplace" text,
"Serial number" text,
"Primary military speciality" text,
"Secondary military speciality" text
) | What Birthplace's Real Name is Charles 'Chuck' Connors? | SELECT "Birthplace" FROM table_14950 WHERE "Real Name" = 'charles ''chuck'' connors' |
CREATE TABLE table_name_40 (
height_feet___m VARCHAR,
street_address VARCHAR
) | What is listsed as the Height feet/m and has a Street address of 2345 Grand Avenue? | SELECT height_feet___m FROM table_name_40 WHERE street_address = "2345 grand avenue" |
CREATE TABLE table_23235767_4 (
surface VARCHAR,
championship VARCHAR
) | Name the surface for philadelphia | SELECT surface FROM table_23235767_4 WHERE championship = "Philadelphia" |
CREATE TABLE table_name_73 (
result VARCHAR,
opponent VARCHAR
) | What is the result of the game against Ayr United? | SELECT result FROM table_name_73 WHERE opponent = "ayr united" |
CREATE TABLE table_name_76 (
no_5 VARCHAR,
no_4 VARCHAR,
no_1 VARCHAR,
no_8 VARCHAR,
no_2 VARCHAR
) | When Chloe was number 8, Olivia was number 2, Emma was number 1, and Ava was number 4, who was number 5? | SELECT no_5 FROM table_name_76 WHERE no_8 = "chloe" AND no_2 = "olivia" AND no_1 = "emma" AND no_4 = "ava" |
CREATE TABLE table_71532 (
"name" text,
"type" text,
"elevation" text,
"USGS Map" text,
"GNIS ID" real
) | What type has a GNIS ID of 1139805 | SELECT "type" FROM table_71532 WHERE "GNIS ID" = '1139805' |
CREATE TABLE table_name_84 (
away_captain VARCHAR,
venue VARCHAR
) | Who was the captain of the away team at Adelaide Oval? | SELECT away_captain FROM table_name_84 WHERE venue = "adelaide oval" |
CREATE TABLE table_30496 (
"Name" text,
"Corporate name" text,
"Regional district" text,
"Incorporation date (city)" text,
"Population (2011)" real,
"Population (2006)" real,
"Change (%)" text,
"Area (km\u00b2)" text,
"Population density" text
) | What is the name of the corporation with an area of 15.63 km? | SELECT "Corporate name" FROM table_30496 WHERE "Area (km\u00b2)" = '15.63' |
CREATE TABLE table_name_50 (
col__m_ INTEGER,
peak VARCHAR,
prominence__m_ VARCHAR
) | Name the lowest Col (m) with a Peak of pico basil , and a Prominence (m) smaller than 3,011? | SELECT MIN(col__m_) FROM table_name_50 WHERE peak = "pico basilé" AND prominence__m_ < 3 OFFSET 011 |
CREATE TABLE table_204_842 (
id number,
"institution" text,
"city" text,
"state" text,
"team name" text,
"affiliation" text,
"enrollment" number,
"home conference" text
) | which state is the most represented by the 11 institutions ? | SELECT "state" FROM table_204_842 GROUP BY "state" ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE table_name_12 (
away_team VARCHAR,
home_team VARCHAR
) | Who is the home team of South Melbourne? | SELECT away_team FROM table_name_12 WHERE home_team = "south melbourne" |
CREATE TABLE table_797 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | When was incumbent John N. Tillman first elected? | SELECT MIN("First elected") FROM table_797 WHERE "Incumbent" = 'John N. Tillman' |
CREATE TABLE table_name_15 (
date VARCHAR,
opponent VARCHAR
) | Name the date when bye was opponent | SELECT date FROM table_name_15 WHERE opponent = "bye" |
CREATE TABLE table_name_57 (
gold INTEGER,
total VARCHAR,
silver VARCHAR
) | What is the low gold total for under 2 total and over 0 silvers? | SELECT MIN(gold) FROM table_name_57 WHERE total < 2 AND silver > 0 |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE labevents (
row_id number,
subje... | how many patients were diagnosed with urin tract infection nos within 2 months after the previous diagnosis of tobacco use disorder? | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'urin tract infecti... |
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,
... | provide the number of patients whose admission type is emergency and procedure short title is part sm bowel resect nec? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.short_title = "Part sm bowel resect NEC" |
CREATE TABLE Invoice_Items (
Invoice_Item_ID INTEGER,
Invoice_ID INTEGER,
Order_ID INTEGER,
Order_Item_ID INTEGER,
Product_ID INTEGER,
Order_Quantity INTEGER,
Other_Item_Details VARCHAR(255)
)
CREATE TABLE Order_Items (
Order_Item_ID INTEGER,
Order_ID INTEGER,
Product_ID INTEGER... | A bar chart about what are the different product names? What is the average product price for each of them?, sort in desc by the y-axis. | SELECT Product_Name, AVG(Product_Price) FROM Products GROUP BY Product_Name ORDER BY AVG(Product_Price) DESC |
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 prescriptions (
row_id number,
subject_id number,
h... | what is patient 17462's new prescription today compared to the prescription given yesterday? | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17462) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE... |
CREATE TABLE manager_award (
player_id text,
award_id text,
year number,
league_id text,
tie text,
notes number
)
CREATE TABLE all_star (
player_id text,
year number,
game_num number,
game_id text,
team_id text,
league_id text,
gp number,
starting_pos number
)
C... | List the 3 highest salaries of the players in 2001? | SELECT salary FROM salary WHERE year = 2001 ORDER BY salary DESC LIMIT 3 |
CREATE TABLE table_36229 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | How many rounds did the match go for the Bellator 72 event? | SELECT SUM("Round") FROM table_36229 WHERE "Event" = 'bellator 72' |
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 regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
... | For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of email and manager_id . | SELECT EMAIL, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
CREATE TABLE table_204_455 (
id number,
"rd." number,
"grand prix" text,
"date" text,
"location" text,
"pole position" text,
"fastest lap" text,
"winning driver" text,
"constructor" text,
"report" text
) | what was the only grand prix to be won by benneton ford ? | SELECT "grand prix" FROM table_204_455 WHERE "constructor" = 'benetton-ford' |
CREATE TABLE Player (
pID numeric(5,0),
pName varchar(20),
yCard varchar(3),
HS numeric(5,0)
)
CREATE TABLE Tryout (
pID numeric(5,0),
cName varchar(20),
pPos varchar(8),
decision varchar(3)
)
CREATE TABLE College (
cName varchar(20),
state varchar(2),
enr numeric(5,0)
) | A bar chart for what are the number of the names of all students who tried out in alphabetical order? | SELECT pName, COUNT(pName) FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID GROUP BY pName ORDER BY T1.pName |
CREATE TABLE table_46943 (
"Year" real,
"Men's Open" text,
"Women's Open" text,
"Mixed Open" text,
"Men's u20" text,
"Women's u20" text,
"Senior Mixed" text,
"Men's 30" text,
"Women's 30" text,
"Men's 35" text,
"Women's 35" text,
"Men's 40" text,
"Women's 40" text,
... | Which Men's u20 has a Men's 45 of n/A? | SELECT "Men's u20" FROM table_46943 WHERE "Men's 45" = 'n/a' |
CREATE TABLE table_204_891 (
id number,
"name" text,
"hanzi" text,
"population (2005)" number,
"area (km2)" number
) | which divisions had a population below 15,000 in 2005 ? | SELECT "name" FROM table_204_891 WHERE "population (2005)" < 15000 |
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code 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,
r... | show me the flights from CHICAGO to INDIANAPOLIS | 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 = 'CHICAGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'INDIAN... |
CREATE TABLE table_9370 (
"Year" text,
"Starts" real,
"Wins" real,
"Top Fives" real,
"Top Tens" real,
"Poles" real,
"Rank" text
) | What is the total number of top fives in 2010 when casey mears had more than 0 wins? | SELECT COUNT("Top Fives") FROM table_9370 WHERE "Year" = '2010' AND "Wins" > '0' |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | what is diagnoses long title and procedure short title of subject name cynthia robinson? | SELECT diagnoses.long_title, procedures.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Cynthia Robinson" |
CREATE TABLE table_name_60 (
opponent VARCHAR,
date VARCHAR
) | Who was the opponent on the game on April 14, 2007? | SELECT opponent FROM table_name_60 WHERE date = "april 14, 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 prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time... | what's the minimum cost of a hospital that includes a drug called dobutamine a year before? | SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'dobutamine') AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY cost.hadm_id) AS t1 |
CREATE TABLE paperkeyphrase (
paperid int,
keyphraseid int
)
CREATE TABLE cite (
citingpaperid int,
citedpaperid int
)
CREATE TABLE paper (
paperid int,
title varchar,
venueid int,
year int,
numciting int,
numcitedby int,
journalid int
)
CREATE TABLE writes (
paperid i... | What was the conference name that approved Trophic Cascade ? | SELECT DISTINCT paper.venueid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Trophic Cascade' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Unique occurrences of Dallas, Texas. | SELECT Location, COUNT(*) FROM Users WHERE UPPER(Location) LIKE '%DALLAS%' OR UPPER(Location) LIKE '%DFW%' GROUP BY Location ORDER BY COUNT(*) DESC |
CREATE TABLE district (
District_ID int,
District_name text,
Headquartered_City text,
City_Population real,
City_Area real
)
CREATE TABLE store (
Store_ID int,
Store_Name text,
Type text,
Area_size real,
Number_of_product_category real,
Ranking int
)
CREATE TABLE store_prod... | I want to know the proportion of the total number for each type. | SELECT Type, COUNT(*) FROM store GROUP BY Type |
CREATE TABLE table_35656 (
"Year" real,
"League" text,
"Class" text,
"Record" text,
"Finish" text,
"Manager" text,
"Playoffs" text
) | Manager of lyman lamb / marty berghammer is in what league? | SELECT "League" FROM table_35656 WHERE "Manager" = 'lyman lamb / marty berghammer' |
CREATE TABLE table_train_243 (
"id" int,
"c_peptide_level" float,
"finger_stick_measurements" bool,
"diabetic" string,
"fasting_blood_glucose_fbg" float,
"hypoglycemia" bool,
"insulin_requirement" float,
"triglyceride_tg" float,
"a1c" float,
"age" float,
"NOUSE" float
) | safety substudy in 20 iddm patients only: insulin _ treated type ii diabetics with a c _ peptide of < 0.8 ng / mld and fasting blood glucose > 150 mg / dl will be excluded even without history of hypoglycemia during finger stick measurements. | SELECT * FROM table_train_243 WHERE insulin_requirement = 1 AND diabetic = 'ii' AND c_peptide_level < 0.8 AND fasting_blood_glucose_fbg > 150 AND (hypoglycemia = 0 AND finger_stick_measurements = 0) |
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 are the three most frequent drugs prescribed to the 30s atrial fibrillation female patients within the same month after they were diagnosed with atrial fibrillation in 2105? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'atrial fibrillation' AND STRFTIME('%y', diagnosis.... |
CREATE TABLE table_6069 (
"Player" text,
"Position" text,
"Date of Birth (Age)" text,
"Caps" real,
"Club/province" text
) | What is the club/province of player Alberto Sgarbi, who played wing, with less than 2 caps? | SELECT "Club/province" FROM table_6069 WHERE "Caps" < '2' AND "Position" = 'wing' AND "Player" = 'alberto sgarbi' |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
... | what are the numbers of patients who had hcl gtts 75meq/500ml intake in 2105? | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'hcl gtts 75meq/500m... |
CREATE TABLE table_name_54 (
laps VARCHAR,
rider VARCHAR
) | What is the total number of Laps, when Ride is Aleix Espargaro? | SELECT COUNT(laps) FROM table_name_54 WHERE rider = "aleix espargaro" |
CREATE TABLE table_39354 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Partner" text,
"Opponents in the final" text,
"Score in the final" text
) | Which opponent in the final had a partner of Katarina Srebotnik and a championship of wimbledon (4)? | SELECT "Opponents in the final" FROM table_39354 WHERE "Partner" = 'katarina srebotnik' AND "Championship" = 'wimbledon (4)' |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Tags (
Id number,
TagName text,
Cou... | People by the summed score of their downvoted posts. | SELECT OwnerUserId AS "user_link", SUM(Score) AS DownSum FROM Posts WHERE Score < 0 AND OwnerUserId > 0 GROUP BY Posts.OwnerUserId ORDER BY DownSum, OwnerUserId LIMIT 100 |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Voting overview using Constituent Badge. | SELECT Hour, COUNT(*) AS Num FROM (SELECT DATE(0, 'CAST((JULIANDAY(Date) - JULIANDAY(0)) * 24.0 AS INTEGER) hour') AS Hour FROM Badges AS b WHERE Name LIKE '%Constituent%') AS VoteHours GROUP BY Hour ORDER BY Hour DESC |
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE comment_instructor (
instructor_id int,
... | In Undergraduate Psychology , who has , is or will teach this ? | SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.name L... |
CREATE TABLE table_19487 (
"Pick #" real,
"NFL Team" text,
"Player" text,
"Position" text,
"College" text
) | Which team does Robert Brooks play with? | SELECT "NFL Team" FROM table_19487 WHERE "Player" = 'Robert Brooks' |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose... | how many patients had a free skin graft nec in the same month after the first parent infus nutrit sub? | 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 = 'parent infu... |
CREATE TABLE table_name_82 (
club VARCHAR,
country VARCHAR,
goals VARCHAR
) | What club was in Netherlands and had 22 goals? | SELECT club FROM table_name_82 WHERE country = "netherlands" AND goals = "22" |
CREATE TABLE table_name_37 (
loss VARCHAR,
opponent VARCHAR,
date VARCHAR
) | Who lost when the mariners played on September 12? | SELECT loss FROM table_name_37 WHERE opponent = "mariners" AND date = "september 12" |
CREATE TABLE table_test_2 (
"id" int,
"loss_of_consciousness" bool,
"gender" string,
"bleeding" int,
"systolic_blood_pressure_sbp" int,
"stroke" bool,
"renal_disease" bool,
"hemorrhagic_diathesis" bool,
"transient_ischemic_attack" bool,
"creatinine_clearance_cl" float,
"demen... | known renal insufficiency ( prior creatinine > 2.5 mg % for male and > 2 mg % for female ) | SELECT * FROM table_test_2 WHERE renal_disease = 1 OR ((gender = 'male' AND prior_creatinine > 2.5) OR (gender = 'female' AND prior_creatinine > 2)) |
CREATE TABLE table_name_26 (
title VARCHAR,
label VARCHAR,
year VARCHAR,
Nr VARCHAR,
st VARCHAR
) | What is the song title from 1963 on the Pacific Jazz label, and a Label-Nr of st-81? | SELECT title FROM table_name_26 WHERE label = "pacific jazz" AND year = 1963 AND label - Nr = st - 81 |
CREATE TABLE table_58076 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the total Crowd with a Home team of collingwood? | SELECT SUM("Crowd") FROM table_58076 WHERE "Home team" = 'collingwood' |
CREATE TABLE table_26301697_2 (
represents VARCHAR,
height__cm_ VARCHAR
) | Name the represents for 1.76 cm | SELECT represents FROM table_26301697_2 WHERE height__cm_ = "1.76" |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE patients (
row_id number,
subject_id number,
... | when is the first procedure time of patient 51177 in this year? | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51177) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY procedures_icd.charttime LIMIT 1 |
CREATE TABLE table_name_18 (
year INTEGER,
competition VARCHAR,
position VARCHAR
) | What year was the Competition of World Junior Championships with a 20th (qf) position? | SELECT AVG(year) FROM table_name_18 WHERE competition = "world junior championships" AND position = "20th (qf)" |
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,... | give me the number of patients whose drug code is posa200l and lab test fluid is urine? | 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 = "POSA200L" AND lab.fluid = "Urine" |
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 numeric,
DEPT_CODE varchar(18),
STU_PHONE varchar(4),
PROF_NUM int
)
CREATE TABLE CO... | A bar chart about how many classes are held in each department?, could you sort in desc by the Y? | SELECT DEPT_CODE, COUNT(*) FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE ORDER BY COUNT(*) DESC |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | what does chloride change/differ in patient 52898 last measured on the current hospital visit compared to the value first measured on the current hospital visit? | SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52898 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') ORDER BY labevents.charttime... |
CREATE TABLE table_name_9 (
club VARCHAR,
drawn VARCHAR,
try_bonus VARCHAR
) | What is Club, when Drawn is '0', and when Try Bonus is '5'? | SELECT club FROM table_name_9 WHERE drawn = "0" AND try_bonus = "5" |
CREATE TABLE table_name_52 (
champion VARCHAR,
runner_up VARCHAR
) | Name the champion for christopher miles runner-up | SELECT champion FROM table_name_52 WHERE runner_up = "christopher miles" |
CREATE TABLE table_22848 (
"Rank" real,
"London Borough" text,
"Indian Population" real,
"Pakistani Population" real,
"Bangladeshi Population" real,
"Chinese Population" real,
"Other Asian Population" real,
"Total Asian Population" real
) | What's the Chinese population in the borough with 26347 Pakistanis? | SELECT "Chinese Population" FROM table_22848 WHERE "Pakistani Population" = '26347' |
CREATE TABLE table_name_74 (
team_1 VARCHAR,
name VARCHAR
) | Name the team one for preliminary final | SELECT team_1 FROM table_name_74 WHERE name = "preliminary final" |
CREATE TABLE table_14990 (
"LT Nos" text,
"Year" real,
"Bldr" text,
"Type" text,
"Notes" text
) | Bldr of mcw&f, and a Year smaller than 1927, and a LT Nos of 9820-9821 has what type? | SELECT "Type" FROM table_14990 WHERE "Bldr" = 'mcw&f' AND "Year" < '1927' AND "LT Nos" = '9820-9821' |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | how many patients whose days of hospital stay is greater than 17 and drug name is sulfameth/trimethoprim ds? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "17" AND prescriptions.drug = "Sulfameth/Trimethoprim DS" |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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... | For those employees who do not work in departments with managers that have ids between 100 and 200, find last_name and manager_id , and visualize them by a bar chart, display in desc by the LAST_NAME please. | SELECT LAST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME DESC |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId... | Users with 'stackoverflow is evil' in their profile. | SELECT DisplayName, AboutMe FROM Users WHERE AboutMe LIKE '%evil%' |
CREATE TABLE table_name_1 (
circuit VARCHAR,
fastest_lap VARCHAR
) | What is the name of the circuit when Phil Hill has the fastest lap? | SELECT circuit FROM table_name_1 WHERE fastest_lap = "phil hill" |
CREATE TABLE table_name_35 (
high_rebounds VARCHAR,
high_assists VARCHAR
) | Who had the highest rebounds of the game with A. Johnson (6) as the highest assist? | SELECT high_rebounds FROM table_name_35 WHERE high_assists = "a. johnson (6)" |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
ic... | what are the five most commonly ordered lab tests for patients who received thrombolytics before within the same hospital visit until 2102? | SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'thrombolytics' AN... |
CREATE TABLE table_train_129 (
"id" int,
"cerebral_neoplasia" bool,
"gender" string,
"mini_mental_state_examination_mmse" int,
"multiple_lacunar_infarcts" bool,
"neurodegenerative_disease" bool,
"mri_abnormality" bool,
"nervous_system_functioning" bool,
"head_injury" bool,
"serio... | the patient has evidence of any clinically significant neurodegenerative disease, or other serious neurological disorders other than ad including but not limited to lewy body dementia, fronto _ temporal dementia, parkinson's disease, huntington's disease, major cortical stroke, major head trauma, primary or secondary c... | SELECT * FROM table_train_129 WHERE neurodegenerative_disease = 1 OR serious_neurological_disorders = 1 AND ad = 0 OR lewy_body_dementia = 1 OR fronto_temporal_dementia = 1 OR parkinson_disease = 1 OR huntington_disease = 1 OR major_cortical_stroke = 1 OR head_injury = 1 OR cerebral_neoplasia = 1 OR systemic_medical_di... |
CREATE TABLE table_name_17 (
time_retired VARCHAR,
laps VARCHAR,
grid VARCHAR
) | What was the retired time on someone who had 43 laps on a grip of 18? | SELECT time_retired FROM table_name_17 WHERE laps = 43 AND grid = 18 |
CREATE TABLE table_43600 (
"Name" text,
"Hanzi" text,
"Hanyu Pinyin" text,
"Population (2004 est.)" text,
"Area (km\u00b2)" text,
"Density (/km\u00b2)" text
) | Which Hanyu Pinyin is labeled rural? | SELECT "Hanyu Pinyin" FROM table_43600 WHERE "Name" = 'rural' |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
... | For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the sum of employee_id , and group by attribute job_id in a bar chart, and I want to order JOB_ID in asc order. | SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID |
CREATE TABLE table_203_400 (
id number,
"district" text,
"vacator" text,
"reason for change" text,
"successor" text,
"date successor\nseated" text
) | which district is listed last on this chart ? | SELECT "district" FROM table_203_400 ORDER BY id DESC LIMIT 1 |
CREATE TABLE table_2114308_1 (
broadcast_date VARCHAR,
viewers__in_millions_ VARCHAR
) | Name the broadcast date of 6.9 million viewers | SELECT broadcast_date FROM table_2114308_1 WHERE viewers__in_millions_ = "6.9" |
CREATE TABLE table_30672 (
"Couple" text,
"Style" text,
"Music" text,
"Trine Dehli Cleve" real,
"Tor Fl\u00f8ysvik" real,
"Karianne Gulliksen" real,
"Christer Tornell" real,
"Total" real
) | What is the total score received by the couple that danced to ' ymca ' village people? | SELECT MAX("Total") FROM table_30672 WHERE "Music" = ' YMCA "— Village People' |
CREATE TABLE table_204_463 (
id number,
"year" number,
"division" number,
"league" text,
"regular season" text,
"playoffs" text,
"open cup" text
) | how long after 2008 did it take for division 4 to qualify for the playoffs once again ? | SELECT "year" - 2008 FROM table_204_463 WHERE "playoffs" <> 'did not qualify' AND "year" > 2008 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.