table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE table_name_10 (
race_name VARCHAR,
round VARCHAR
) | Which race was in round 6? | SELECT race_name FROM table_name_10 WHERE round = 6 |
CREATE TABLE table_name_95 (
date VARCHAR,
score VARCHAR,
loss VARCHAR
) | What date has 5-3 as the score, and holt (1-1) as a loss? | SELECT date FROM table_name_95 WHERE score = "5-3" AND loss = "holt (1-1)" |
CREATE TABLE table_63941 (
"Rank" real,
"Lane" real,
"Athlete" text,
"Time ( sec )" real,
"Notes" text
) | What is the lane for notes Q, SB and time less than 11.22? | SELECT SUM("Lane") FROM table_63941 WHERE "Notes" = 'q, sb' AND "Time ( sec )" < '11.22' |
CREATE TABLE table_name_22 (
bronze INTEGER,
total VARCHAR,
nation VARCHAR,
silver VARCHAR,
gold VARCHAR
) | How many Bronzes that has a Silver of 0, and a Gold of 0, and a Nation of denmark, and a Total larger than 1? | SELECT SUM(bronze) FROM table_name_22 WHERE silver = 0 AND gold = 0 AND nation = "denmark" AND total > 1 |
CREATE TABLE table_203_836 (
id number,
"title" text,
"year" number,
"platforms" text,
"developer" text,
"publisher" text,
"notes" text
) | according to the table , what is the last title that spicy horse produced ? | SELECT "title" FROM table_203_836 WHERE "developer" = 'spicy horse' ORDER BY "year" DESC LIMIT 1 |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time... | show me flights FIRST class from SAN FRANCISCO to PITTSBURGH leaving on tuesday after 800 o'clock in the morning and before 1200 | 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, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE ((((DA... |
CREATE TABLE table_name_30 (
nationality VARCHAR,
years_for_jazz VARCHAR
) | What is the nationality of the Jazz player 1977-79? | SELECT nationality FROM table_name_30 WHERE years_for_jazz = "1977-79" |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid num... | what was the name of the drug that's been prescribed to patient 007-2498 two or more times in 02/last year? | 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 course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
description varchar,
num_semesters int,
num_enrolled int,
has_discussion varchar,
has_lab varchar,
has_p... | Prof. Radosevich is the only person who teaches Medieval Music , correct ? | SELECT DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Medieval Music%' AND NOT instructor.name LIKE '%Radosevich%' AND offering_instructor.instructor_id = inst... |
CREATE TABLE table_11240028_1 (
episodes VARCHAR,
portrayed_by VARCHAR
) | How many episodes did actress Vanessa Ferlito appear in? | SELECT episodes FROM table_11240028_1 WHERE portrayed_by = "Vanessa Ferlito" |
CREATE TABLE table_70385 (
"Year" real,
"Entrant" text,
"Class" text,
"Chassis" text,
"Engine" text,
"Tyres" text,
"Rank" text,
"Points" real
) | What is the rank of the cadillac northstar lmp02 chassis? | SELECT "Rank" FROM table_70385 WHERE "Chassis" = 'cadillac northstar lmp02' |
CREATE TABLE table_40990 (
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text
) | Which tournament had a winning score of 67-61-68-67=263? | SELECT "Tournament" FROM table_40990 WHERE "Winning score" = '67-61-68-67=263' |
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,
... | give me the number of patients whose year of death is less than or equal to 2122? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.dod_year <= "2122.0" |
CREATE TABLE table_78493 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Where does South Melbourne play? | SELECT "Venue" FROM table_78493 WHERE "Away team" = 'south melbourne' |
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 cost (
row_id number,
subject_id number,
hadm_id number,
event... | what procedure was first taken to patient 7375? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7375) ORDER BY procedures_icd.charttime LIMIT 1) |
CREATE TABLE table_7006 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | WHich Country has a ICAO of ltcd? | SELECT "Country" FROM table_7006 WHERE "ICAO" = 'ltcd' |
CREATE TABLE table_23344 (
"#" real,
"Episode" text,
"Rating" text,
"Share" real,
"Rating/Share (18-49)" text,
"Viewers (millions)" text,
"Rank (Night)" text
) | If the amount of viewers is 5.14 million and the rating/share is 2.0/6, what is the ranking? | SELECT "Rating" FROM table_23344 WHERE "Rating/Share (18-49)" = '2.0/6' AND "Viewers (millions)" = '5.14' |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25... | For those employees who was hired before 2002-06-21, return a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by time, could you show in descending by the Y-axis? | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(EMPLOYEE_ID) DESC |
CREATE TABLE table_18594107_1 (
points INTEGER,
team VARCHAR
) | What is the least number of poins for San Lorenzo? | SELECT MIN(points) FROM table_18594107_1 WHERE team = "San Lorenzo" |
CREATE TABLE table_name_4 (
visa_5 VARCHAR,
visa_1 VARCHAR
) | Which Visa 5 has a Visa 1 of emile heskey? | SELECT visa_5 FROM table_name_4 WHERE visa_1 = "emile heskey" |
CREATE TABLE Reviewer (
rID int,
name text
)
CREATE TABLE Movie (
mID int,
title text,
year int,
director text
)
CREATE TABLE Rating (
rID int,
mID int,
stars int,
ratingDate date
) | In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently, and count them by a bar chart | SELECT year, COUNT(year) FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year |
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... | count the number of patients whose discharge location is rehab/distinct part hosp. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" |
CREATE TABLE table_name_99 (
place VARCHAR,
country VARCHAR
) | What was Australia's place? | SELECT place FROM table_name_99 WHERE country = "australia" |
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... | Find posts by history event type. | SELECT ph.PostId AS "post_link", pht.Name FROM PostHistory AS ph JOIN PostHistoryTypes AS pht ON ph.PostHistoryTypeId = pht.Id WHERE ph.PostHistoryTypeId = @HistoryEventType |
CREATE TABLE weather (
date text,
max_temperature_f number,
mean_temperature_f number,
min_temperature_f number,
max_dew_point_f number,
mean_dew_point_f number,
min_dew_point_f number,
max_humidity number,
mean_humidity number,
min_humidity number,
max_sea_level_pressure_inc... | What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate. | SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5 |
CREATE TABLE table_73295 (
"Expression" text,
"Y = 2008" text,
"Y = 2009" text,
"Y = 2010" text,
"Y = 2011" text
) | what is the y = 2008 when the expression is easter day (julian calendar)? | SELECT "Y = 2008" FROM table_73295 WHERE "Expression" = 'Easter Day (Julian calendar)' |
CREATE TABLE table_29281529_2 (
challenger VARCHAR,
iron_chef VARCHAR
) | Who was the challenger when guillaume brahimi was the iron chef? | SELECT challenger FROM table_29281529_2 WHERE iron_chef = "Guillaume Brahimi" |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,... | calculate the number of medications that were prescribed to patient 005-18714 until 4 months ago. | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-18714')) AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME()... |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | how many patients whose marital status is single and diagnoses short title is malfunc oth device/graft? | 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.short_title = "Malfunc oth device/graft" |
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE cours... | What is the most straightforward class I can take to satisfy the Core ? | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co... |
CREATE TABLE table_18278508_6 (
position VARCHAR,
main_contestant VARCHAR,
date_performed VARCHAR
) | What was Kashmira Shah's position on August 14? | SELECT position FROM table_18278508_6 WHERE main_contestant = "Kashmira Shah" AND date_performed = "August 14" |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_dista... | can you show me what fares are available from OAKLAND to DALLAS on 12 16 one way only | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND C... |
CREATE TABLE table_16099880_5 (
pole_position VARCHAR,
race VARCHAR
) | Who was on the pole at Chicagoland? | SELECT pole_position FROM table_16099880_5 WHERE race = "Chicagoland" |
CREATE TABLE all_star (
player_id TEXT,
year INTEGER,
game_num INTEGER,
game_id TEXT,
team_id TEXT,
league_id TEXT,
gp NUMERIC,
starting_pos NUMERIC
)
CREATE TABLE player_award (
player_id TEXT,
award_id TEXT,
year INTEGER,
league_id TEXT,
tie TEXT,
notes TEXT
)
... | Reutrn a bar chart to bin the year into day of the week interval, and return the total number of times the team Boston Red Stockings won in the postseasons. | SELECT year, SUM(COUNT(*)) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' |
CREATE TABLE table_28051859_3 (
tenure VARCHAR,
school VARCHAR
) | When were the members tenured in the Field school? | SELECT tenure FROM table_28051859_3 WHERE school = "Field" |
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE restriction (
restriction_c... | i'd like the first flight in the morning from BOSTON to WASHINGTON | 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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHI... |
CREATE TABLE table_28688313_1 (
written_by VARCHAR,
us_viewers__in_millions_ VARCHAR
) | Who wrote the episode with 9.81 million US viewers? | SELECT written_by FROM table_28688313_1 WHERE us_viewers__in_millions_ = "9.81" |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
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... | Of all the upper-level classes , what classes involve 4 credits ? | 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 = 4 AND program_course.category LIKE 'ULCS' |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE icustays (
ro... | for patients who were prescribed with pseudoephedrine hcl, what are the four most commonly prescribed drugs at the same time, since 5 years ago? | 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 = 'pseudoephedrine hcl' AND DATETIME(prescriptions.startdate) >= DAT... |
CREATE TABLE table_35181 (
"Year" real,
"Title" text,
"Director" text,
"Writer" text,
"Notes" text
) | What is the earliest year of Wallace & Gromit: The Curse of the Were-Rabbit? | SELECT MIN("Year") FROM table_35181 WHERE "Title" = 'wallace & gromit: the curse of the were-rabbit' |
CREATE TABLE table_62501 (
"Club" text,
"Sport" text,
"Founded" real,
"League" text,
"Venue" text
) | Which club was founded in 1962? | SELECT "Club" FROM table_62501 WHERE "Founded" = '1962' |
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 Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGE... | Show the average age for male and female students with a bar chart, list Y in asc order. | SELECT Sex, AVG(Age) FROM Student GROUP BY Sex ORDER BY AVG(Age) |
CREATE TABLE table_35266 (
"Name" text,
"Term start" real,
"Term end" text,
"Date of Birth" text,
"Date of Death" text
) | When was the start of the leader's term who was born on January 8, 1859 and whose term ended in 1919? | SELECT "Term start" FROM table_35266 WHERE "Term end" = '1919' AND "Date of Birth" = 'january 8, 1859' |
CREATE TABLE table_60594 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What is the average total for 0 bronze? | SELECT AVG("Total") FROM table_60594 WHERE "Bronze" < '0' |
CREATE TABLE Transactions_Lots (
transaction_id INTEGER,
lot_id INTEGER
)
CREATE TABLE Sales (
sales_transaction_id INTEGER,
sales_details VARCHAR(255)
)
CREATE TABLE Investors (
investor_id INTEGER,
Investor_details VARCHAR(255)
)
CREATE TABLE Ref_Transaction_Types (
transaction_type_cod... | Find the transaction type descriptions and dates if the share count is smaller than 10, group by transaction type, count the date of transaction, and bin the date into the weekday interval, I want to display y axis from high to low order. | SELECT T2.date_of_transaction, COUNT(T2.date_of_transaction) FROM Ref_Transaction_Types AS T1 JOIN Transactions AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE T2.share_count < 10 GROUP BY transaction_type_description ORDER BY COUNT(date_of_transaction) DESC |
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,
... | how many patients marital status is widowed and follow the procedure icd9 code 8968? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.icd9_code = "8968" |
CREATE TABLE table_name_40 (
attendance INTEGER,
home VARCHAR
) | What is the average attendance of the game where the home team was the Blues? | SELECT AVG(attendance) FROM table_name_40 WHERE home = "blues" |
CREATE TABLE table_27011761_2 (
train_no VARCHAR,
arrival VARCHAR
) | How many trains arrive at 11:00? | SELECT COUNT(train_no) FROM table_27011761_2 WHERE arrival = "11:00" |
CREATE TABLE table_name_11 (
start INTEGER,
lost VARCHAR,
tries VARCHAR
) | What is the number of starts for the player who lost fewer than 22 and has more than 4 tries? | SELECT AVG(start) FROM table_name_11 WHERE lost < 22 AND tries > 4 |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE code_description (
code varchar,
descript... | afternoon flights from BOSTON to SAN FRANCISCO please that leave in the 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 (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FR... |
CREATE TABLE table_name_97 (
away_team VARCHAR,
venue VARCHAR
) | In the venue Corio Oval, who was the away team? | SELECT away_team FROM table_name_97 WHERE venue = "corio oval" |
CREATE TABLE table_name_46 (
tournament VARCHAR,
date VARCHAR
) | What is the tournament on 22 October 2012? | SELECT tournament FROM table_name_46 WHERE date = "22 october 2012" |
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 products with a price between 60 and 120, find name and price , and visualize them by a bar chart, and list in desc by the Y-axis. | SELECT Name, Price FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Price DESC |
CREATE TABLE table_name_15 (
poll_losses INTEGER,
wins VARCHAR,
ties VARCHAR,
poll_wins VARCHAR
) | What is the lowest poll losses of the 0 ties, poll wins greater than 1 and wins less than 2? | SELECT MIN(poll_losses) FROM table_name_15 WHERE ties = 0 AND poll_wins > 1 AND wins < 2 |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | tell me the number of patients less than 80 years with tacr5sm drug code. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "80" AND prescriptions.formulary_drug_cd = "TACR5SM" |
CREATE TABLE table_name_61 (
result VARCHAR,
location VARCHAR,
odds VARCHAR
) | What was the score for an n/a location with the odds of p + 1? | SELECT result FROM table_name_61 WHERE location = "n/a" AND odds = "p + 1" |
CREATE TABLE table_23919 (
"Year" text,
"Head Coach" text,
"Regular Season Record (W-L)" text,
"NEC Record" text,
"Standing" text,
"NEC Tournament Record" text
) | Name the regular season record for standing 11th | SELECT "Regular Season Record (W-L)" FROM table_23919 WHERE "Standing" = '11th' |
CREATE TABLE table_name_91 (
launched VARCHAR,
completed VARCHAR
) | Name the launched for 13 september 1934 completion | SELECT launched FROM table_name_91 WHERE completed = "13 september 1934" |
CREATE TABLE table_name_38 (
points INTEGER,
name VARCHAR,
drawn VARCHAR
) | What's the most points for Ea Schongau with more than 1 drawn? | SELECT MAX(points) FROM table_name_38 WHERE name = "ea schongau" AND drawn > 1 |
CREATE TABLE table_255602_1 (
area__km²_ VARCHAR,
population__2010_ VARCHAR
) | What is the area where population in 2010 is 38062? | SELECT area__km²_ FROM table_255602_1 WHERE population__2010_ = 38062 |
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 admitted before 2190 who had transplant from live non-related donor procedure. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2190" AND procedures.short_title = "Trnsplnt live nonrel don" |
CREATE TABLE table_28467 (
"Institution" text,
"Location" text,
"Nickname" text,
"Founded" real,
"Enrollment" text,
"Joined" real,
"Left" real,
"Current Conference" text
) | When was alfred university founded? | SELECT MAX("Founded") FROM table_28467 WHERE "Institution" = 'Alfred University' |
CREATE TABLE table_name_10 (
week INTEGER,
opponent VARCHAR,
attendance VARCHAR
) | In what Weeks is the game against the Tampa Bay Buccaneers with less than 44,506 in Attendance? | SELECT SUM(week) FROM table_name_10 WHERE opponent = "tampa bay buccaneers" AND attendance < 44 OFFSET 506 |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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,
JOB_ID varchar(10),
SALARY decimal(8,2),
CO... | For those employees who do not work in departments with managers that have ids between 100 and 200, find hire_date and the amount of hire_date bin hire_date by time, and visualize them by a bar chart, and display y axis in desc order. | SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COUNT(HIRE_DATE) DESC |
CREATE TABLE table_30349 (
"Season" text,
"Games" real,
"Won" real,
"Lost" real,
"Tied" real,
"Points" real,
"Goals for" real,
"Goals against" real,
"Standing" text,
"Head coaches" text
) | What sesaon(s) did they have 254 goals against? | SELECT "Season" FROM table_30349 WHERE "Goals against" = '254' |
CREATE TABLE table_13570_1 (
specifically_stains VARCHAR,
nucleus VARCHAR
) | A nucleus that is blue/black will specifically stain what? | SELECT specifically_stains FROM table_13570_1 WHERE nucleus = "Blue/black" |
CREATE TABLE table_1346137_4 (
candidates VARCHAR,
first_elected VARCHAR
) | Who were the candidates when the winner was first elected in 1910? | SELECT candidates FROM table_1346137_4 WHERE first_elected = "1910" |
CREATE TABLE table_30202 (
"No." real,
"Title" text,
"Lyricist" text,
"Composer" text,
"Arrangement" text,
"Sound Engineer" text,
"Length" text
) | How many numbers are there for kam wa7ed fina? | SELECT COUNT("No.") FROM table_30202 WHERE "Title" = 'Kam Wa7ed Fina' |
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 Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGE... | Show all allergy types and the number of allergies in each type Plot them as bar chart, order in desc by the y axis. | SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY COUNT(*) DESC |
CREATE TABLE table_name_98 (
attendance INTEGER,
opponent VARCHAR
) | What is the average attendance for the New York Jets? | SELECT AVG(attendance) FROM table_name_98 WHERE opponent = "new york jets" |
CREATE TABLE table_1341577_44 (
party VARCHAR,
incumbent VARCHAR
) | What party did Beau Boulter represent? | SELECT party FROM table_1341577_44 WHERE incumbent = "Beau Boulter" |
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... | report the number of private insurance patients who had monitoring of cardiac output by other technique. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Oth cardiac mon output" |
CREATE TABLE table_11545282_17 (
no VARCHAR,
years_for_jazz VARCHAR
) | What is the number of players that played 1987-89? | SELECT no FROM table_11545282_17 WHERE years_for_jazz = "1987-89" |
CREATE TABLE table_name_66 (
rowers VARCHAR,
country VARCHAR
) | Who are the Rowers from Poland? | SELECT rowers FROM table_name_66 WHERE country = "poland" |
CREATE TABLE table_49031 (
"Season" real,
"Level" text,
"Division" text,
"Administration" text,
"Position" text
) | What is the position in the 2004 season? | SELECT "Position" FROM table_49031 WHERE "Season" > '2004' |
CREATE TABLE exhibition_record (
Exhibition_ID int,
Date text,
Attendance int
)
CREATE TABLE exhibition (
Exhibition_ID int,
Year int,
Theme text,
Artist_ID int,
Ticket_Price real
)
CREATE TABLE artist (
Artist_ID int,
Name text,
Country text,
Year_Join int,
Age int... | For artist names who are not from United States, show me a stacked that the x-axis is the Year_Join and the group by name in Y. | SELECT Year_Join, COUNT(Year_Join) FROM artist WHERE Country <> 'United States' GROUP BY Name |
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 of asian ethnicity use the drug talc? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug = "Talc" |
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE transfers (
row_id... | are there any results of patient 75658's microbiological test since 4 years ago? | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 75658) AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-4 year') |
CREATE TABLE table_name_52 (
callsign VARCHAR,
area_served VARCHAR,
freq_currently VARCHAR
) | What is the Callsign in Brisbane with a Freq currently of 4rph? | SELECT callsign FROM table_name_52 WHERE area_served = "brisbane" AND freq_currently = "4rph" |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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... | since 5 years ago, what were the three most frequent diagnoses that patients were given after receiving a exc/dest hrt lesion open in the same hospital encounter? | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_i... |
CREATE TABLE table_80273 (
"Year" text,
"Team" text,
"Chassis" text,
"Engine" text,
"Rank" text
) | What engine was used in 1999? | SELECT "Engine" FROM table_80273 WHERE "Year" = '1999' |
CREATE TABLE advisor (
s_ID varchar(5),
i_ID varchar(5)
)
CREATE TABLE time_slot (
time_slot_id varchar(4),
day varchar(1),
start_hr numeric(2),
start_min numeric(2),
end_hr numeric(2),
end_min numeric(2)
)
CREATE TABLE section (
course_id varchar(8),
sec_id varchar(8),
sem... | How many courses are in the Psychology department in each building? Draw a bar chart, and could you list X-axis in desc order please? | SELECT building, COUNT(building) FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' GROUP BY building ORDER BY building DESC |
CREATE TABLE table_22539 (
"Position" text,
"Country" text,
"Floor" text,
"Pommel Horse" text,
"Rings" text,
"Vault" text,
"Parallel Bars" text,
"Horizontal Bar" text,
"Team Total" text
) | If the rings number is 60.000, what is the number for the vault? | SELECT COUNT("Vault") FROM table_22539 WHERE "Rings" = '60.000' |
CREATE TABLE table_19847 (
"No." real,
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text,
"Runner-up" text
) | Who are all runner-ups for No. 2? | SELECT "Runner-up" FROM table_19847 WHERE "No." = '2' |
CREATE TABLE table_46702 (
"Position" real,
"Team" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Goals For" real,
"Goals Against" real,
"Goal Difference" text,
"Points 1" real
) | W hat was the lowest Goals For when they played Team Goole Town and had a position lower than 9? | SELECT MIN("Goals For") FROM table_46702 WHERE "Team" = 'goole town' AND "Position" < '9' |
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
description varchar,
num_seme... | What classes are both upper-level and 8 credits ? | 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 = 8 AND program_course.category LIKE 'ULCS' |
CREATE TABLE table_28210383_1 (
directed_by VARCHAR,
_number__season__number_ VARCHAR
) | Who directed # (season #) is 1 ( 2 )? | SELECT directed_by FROM table_28210383_1 WHERE _number__season__number_ = "1 ( 2 )" |
CREATE TABLE Order_Items (
order_item_id INTEGER,
product_id INTEGER,
order_id INTEGER,
order_item_status VARCHAR(10),
order_item_details VARCHAR(255)
)
CREATE TABLE Shipment_Items (
shipment_id INTEGER,
order_item_id INTEGER
)
CREATE TABLE Orders (
order_id INTEGER,
customer_id IN... | Find the dates of orders which belong to the customer named 'Jeramie', and count them by a bar chart | SELECT date_order_placed, COUNT(date_order_placed) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie" |
CREATE TABLE table_8911 (
"Round" real,
"Pick" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | Which Overall has a Round larger than 7, a Pick larger than 13, and a Name of tony hall? | SELECT AVG("Overall") FROM table_8911 WHERE "Round" > '7' AND "Pick" > '13' AND "Name" = 'tony hall' |
CREATE TABLE table_1284347_2 (
distance VARCHAR,
race VARCHAR
) | How many races is different distances does Rosehill Guineas compete in? | SELECT COUNT(distance) FROM table_1284347_2 WHERE race = "Rosehill Guineas" |
CREATE TABLE table_65788 (
"Rank" real,
"Summit" text,
"Country" text,
"Island" text,
"Col (m)" real
) | What's the island with a summit of Haleakal ? | SELECT "Island" FROM table_65788 WHERE "Summit" = 'haleakalā' |
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,... | what is drug route of subject id 6983? | SELECT prescriptions.route FROM prescriptions WHERE prescriptions.subject_id = "6983" |
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE flight_leg (
flight_id int,
... | what are the cheapest flights from DENVER to PITTSBURGH that stop in ATLANTA | 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, fare, flight, flight_fare, flight_stop WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PI... |
CREATE TABLE table_19321 (
"Rank" real,
"Name" text,
"Nationality" text,
"1st (m)" text,
"2nd (m)" text,
"Points" text,
"Overall NT points" text,
"Overall WC points (Rank)" text
) | Name the overall wc points rank for 2nd m for 122.5 | SELECT "Overall WC points (Rank)" FROM table_19321 WHERE "2nd (m)" = '122.5' |
CREATE TABLE table_47759 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
) | What is the Date of Week 9? | SELECT "Date" FROM table_47759 WHERE "Week" = '9' |
CREATE TABLE table_28431 (
"Specimen weight/size" text,
"Calculated activity ( Bq )" real,
"Calculated activity ( Ci )" text,
"Estimated activity GR(api)" text,
"Estimated exposure ( mRem )/hr*" text
) | If the specimen weight /size is 1000 g / 8.79 cm, what is the estimated exposure ( mrem )/hr*? | SELECT "Estimated exposure ( mRem )/hr*" FROM table_28431 WHERE "Specimen weight/size" = '1000 g / 8.79 cm' |
CREATE TABLE table_16788123_5 (
points VARCHAR,
team VARCHAR
) | how many points scored by sportivo luque o | SELECT COUNT(points) FROM table_16788123_5 WHERE team = "Sportivo Luqueño" |
CREATE TABLE table_name_3 (
investment_earnings VARCHAR,
year VARCHAR,
other_local_sources VARCHAR
) | What were the investment earnings in a year when other local sources were $2,670,060 after 2001? | SELECT investment_earnings FROM table_name_3 WHERE year > 2001 AND other_local_sources = "$2,670,060" |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | count the number of patients whose age is less than 47 and lab test fluid is ascites? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "47" AND lab.fluid = "Ascites" |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,... | what was the last height of patient 8562 in a month before. | SELECT chartevents.valuenum 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 = 8562)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht' ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.