table
stringlengths 33
7.14k
| question
stringlengths 4
1.06k
| output
stringlengths 2
4.44k
⌀ |
|---|---|---|
CREATE TABLE table_24859 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
)
|
How many viewers in millions watched the episode with the production code 6acx16?
|
SELECT "U.S. viewers (million)" FROM table_24859 WHERE "Production code" = '6ACX16'
|
CREATE TABLE table_name_67 (
pick VARCHAR,
round VARCHAR,
position VARCHAR
)
|
What is the pick number for the tight end who was picked after round 6?
|
SELECT COUNT(pick) FROM table_name_67 WHERE round > 6 AND position = "tight end"
|
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 patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
|
when did patient 035-6788 receive the last test of a lab?
|
SELECT 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 = '035-6788')) ORDER BY lab.labresulttime DESC LIMIT 1
|
CREATE TABLE table_30166 (
"Series episode" real,
"Season episode" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (in million)" text
)
|
What was the episode number for the episode viewed by 5.68 million viewers?
|
SELECT "Season episode" FROM table_30166 WHERE "U.S. viewers (in million)" = '5.68'
|
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
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
)
|
what's the name of the diagnosis that patient 006-80884 was given for the last time since 2105?
|
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-80884')) AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105' ORDER BY diagnosis.diagnosistime DESC LIMIT 1
|
CREATE TABLE table_3283 (
"Player" text,
"Position" text,
"Starter" text,
"Touchdowns" real,
"Extra points" real,
"Field goals" real,
"Points" real
)
|
What is the smallest number of extra points?
|
SELECT MIN("Extra points") FROM table_3283
|
CREATE TABLE table_name_68 (
winner VARCHAR,
season VARCHAR
)
|
Who had the women's win when Norway was the winner overall in season 2001/02?
|
SELECT winner AS Women FROM table_name_68 WHERE winner = "norway" AND season = "2001/02"
|
CREATE TABLE driverstandings (
driverstandingsid number,
raceid number,
driverid number,
points number,
position number,
positiontext text,
wins number
)
CREATE TABLE qualifying (
qualifyid number,
raceid number,
driverid number,
constructorid number,
number number,
position number,
q1 text,
q2 text,
q3 text
)
CREATE TABLE drivers (
driverid number,
driverref text,
number number,
code text,
forename text,
surname text,
dob text,
nationality text,
url text
)
CREATE TABLE status (
statusid number,
status text
)
CREATE TABLE constructorresults (
constructorresultsid number,
raceid number,
constructorid number,
points number,
status number
)
CREATE TABLE seasons (
year number,
url text
)
CREATE TABLE results (
resultid number,
raceid number,
driverid number,
constructorid number,
number number,
grid number,
position number,
positiontext text,
positionorder number,
points number,
laps number,
time text,
milliseconds number,
fastestlap number,
rank number,
fastestlaptime text,
fastestlapspeed text,
statusid number
)
CREATE TABLE circuits (
circuitid number,
circuitref text,
name text,
location text,
country text,
lat number,
lng number,
alt number,
url text
)
CREATE TABLE constructorstandings (
constructorstandingsid number,
raceid number,
constructorid number,
points number,
position number,
positiontext text,
wins number
)
CREATE TABLE races (
raceid number,
year number,
round number,
circuitid number,
name text,
date text,
time text,
url text
)
CREATE TABLE pitstops (
raceid number,
driverid number,
stop number,
lap number,
time text,
duration text,
milliseconds number
)
CREATE TABLE laptimes (
raceid number,
driverid number,
lap number,
position number,
time text,
milliseconds number
)
CREATE TABLE constructors (
constructorid number,
constructorref text,
name text,
nationality text,
url text
)
|
Find the names of all races held in 2017.
|
SELECT name FROM races WHERE year = 2017
|
CREATE TABLE table_name_44 (
males VARCHAR,
percentage___percentage_ VARCHAR
)
|
Which language do 87.5% of males speak?
|
SELECT males FROM table_name_44 WHERE percentage___percentage_ = "87.5"
|
CREATE TABLE table_77980 (
"Player" text,
"Height" text,
"School" text,
"Hometown" text,
"College" text,
"NBA Draft" text
)
|
Which height is associated with Franklin High School?
|
SELECT "Height" FROM table_77980 WHERE "School" = 'franklin high school'
|
CREATE TABLE table_3260 (
"Date" text,
"Time (ET)" text,
"Event #" real,
"Event" text,
"Winner" text,
"Prize" text,
"Entries" text,
"Prize Pool" text,
"Elapsed Time" text
)
|
Name the prize pool for 706 (481 r, 346 a)
|
SELECT "Prize Pool" FROM table_3260 WHERE "Entries" = '706 (481 R, 346 A)'
|
CREATE TABLE table_1969634_1 (
enrollment VARCHAR,
location VARCHAR
)
|
What is the total enrollment for the school in garden city, new york?
|
SELECT enrollment FROM table_1969634_1 WHERE location = "Garden City, New York"
|
CREATE TABLE table_20494 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Bills points" real,
"Opponents" real,
"Bills first downs" real,
"Record" text
)
|
How many points did the bills score when their opponent had 14
|
SELECT "Bills points" FROM table_20494 WHERE "Opponents" = '14'
|
CREATE TABLE table_26758262_1 (
judges_residence VARCHAR,
municipalities_served VARCHAR
)
|
Where does the judge who serves Beacon Falls , Naugatuck , Middlebury , Prospect reside?
|
SELECT judges_residence FROM table_26758262_1 WHERE municipalities_served = "Beacon Falls , Naugatuck , Middlebury , Prospect"
|
CREATE TABLE table_14606 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Record" text
)
|
Who did the Blue Jays lose to on July 16?
|
SELECT "Loss" FROM table_14606 WHERE "Date" = 'july 16'
|
CREATE TABLE Behavior_Incident (
incident_id INTEGER,
incident_type_code VARCHAR(10),
student_id INTEGER,
date_incident_start DATETIME,
date_incident_end DATETIME,
incident_summary VARCHAR(255),
recommendations VARCHAR(255),
other_details VARCHAR(255)
)
CREATE TABLE Ref_Address_Types (
address_type_code VARCHAR(15),
address_type_description VARCHAR(80)
)
CREATE TABLE Detention (
detention_id INTEGER,
detention_type_code VARCHAR(10),
teacher_id INTEGER,
datetime_detention_start DATETIME,
datetime_detention_end DATETIME,
detention_summary VARCHAR(255),
other_details VARCHAR(255)
)
CREATE TABLE Teachers (
teacher_id INTEGER,
address_id INTEGER,
first_name VARCHAR(80),
middle_name VARCHAR(80),
last_name VARCHAR(80),
gender VARCHAR(1),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
other_details VARCHAR(255)
)
CREATE TABLE Ref_Incident_Type (
incident_type_code VARCHAR(10),
incident_type_description VARCHAR(80)
)
CREATE TABLE Students_in_Detention (
student_id INTEGER,
detention_id INTEGER,
incident_id INTEGER
)
CREATE TABLE Ref_Detention_Type (
detention_type_code VARCHAR(10),
detention_type_description VARCHAR(80)
)
CREATE TABLE Addresses (
address_id INTEGER,
line_1 VARCHAR(120),
line_2 VARCHAR(120),
line_3 VARCHAR(120),
city VARCHAR(80),
zip_postcode VARCHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
other_address_details VARCHAR(255)
)
CREATE TABLE Assessment_Notes (
notes_id INTEGER,
student_id INTEGER,
teacher_id INTEGER,
date_of_notes DATETIME,
text_of_notes VARCHAR(255),
other_details VARCHAR(255)
)
CREATE TABLE Student_Addresses (
student_id INTEGER,
address_id INTEGER,
date_address_from DATETIME,
date_address_to DATETIME,
monthly_rental DECIMAL(19,4),
other_details VARCHAR(255)
)
CREATE TABLE Students (
student_id INTEGER,
address_id INTEGER,
first_name VARCHAR(80),
middle_name VARCHAR(40),
last_name VARCHAR(40),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
date_first_rental DATETIME,
date_left_university DATETIME,
other_student_details VARCHAR(255)
)
|
Draw a bar chart about the distribution of date_address_from and the sum of monthly_rental bin date_address_from by time.
|
SELECT date_address_from, SUM(monthly_rental) FROM Student_Addresses ORDER BY monthly_rental DESC
|
CREATE TABLE table_79810 (
"Club" text,
"Manager" text,
"Captain" text,
"Manufacturer" text,
"Sponsor" text
)
|
Who is the captain of Middlesbrough?
|
SELECT "Captain" FROM table_79810 WHERE "Club" = 'middlesbrough'
|
CREATE TABLE table_75857 (
"Date" text,
"Time" text,
"Home" text,
"Away" text,
"Score" text,
"Ground" text
)
|
What is the Date with a Home that is hamilton wildcats?
|
SELECT "Date" FROM table_75857 WHERE "Home" = 'hamilton wildcats'
|
CREATE TABLE table_name_46 (
venue VARCHAR,
home_team VARCHAR
)
|
What venue is the home field of Richmond?
|
SELECT venue FROM table_name_46 WHERE home_team = "richmond"
|
CREATE TABLE table_57423 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
)
|
What Venue has an Away Team Score of 9.12 (66)?
|
SELECT "Venue" FROM table_57423 WHERE "Away team score" = '9.12 (66)'
|
CREATE TABLE table_9969 (
"Game" real,
"March" real,
"Opponent" text,
"Score" text,
"Record" text
)
|
What is the sum of March, when Score is '2 - 2', and when Game is greater than 67?
|
SELECT SUM("March") FROM table_9969 WHERE "Score" = '2 - 2' AND "Game" > '67'
|
CREATE TABLE table_79861 (
"Game" real,
"Date" text,
"Location" text,
"Time" text,
"Attendance" real
)
|
yankee stadium (i), and a Time of 3:00 has what attendance for this location?
|
SELECT "Attendance" FROM table_79861 WHERE "Location" = 'yankee stadium (i)' AND "Time" = '3:00'
|
CREATE TABLE table_67021 (
"Year" real,
"Chassis" text,
"Engine" text,
"Start" text,
"Finish" text,
"Entrant" text
)
|
What Engine had a Finish of 27?
|
SELECT "Engine" FROM table_67021 WHERE "Finish" = '27'
|
CREATE TABLE table_70364 (
"Rank" real,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
)
|
Name the average total for gold less than 1 and rank less than 5
|
SELECT AVG("Total") FROM table_70364 WHERE "Gold" < '1' AND "Rank" < '5'
|
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
|
tell me the price of a vancomycin - trough lab test?
|
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'lab' AND cost.eventid IN (SELECT lab.labid FROM lab WHERE lab.labname = 'vancomycin - trough')
|
CREATE TABLE table_30049462_4 (
location_attendance VARCHAR,
team VARCHAR
)
|
What was the location and it's corresponding attendance during the game against Los Angeles?
|
SELECT location_attendance FROM table_30049462_4 WHERE team = "Los Angeles"
|
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDate time,
ApprovalModeratorId number,
DeactivationDate time,
DeactivationModeratorId number
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE PostsWithDeleted (
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
|
Latest activity across all sites..
|
SELECT DisplayName, ProfileImageUrl FROM Users WHERE DisplayName LIKE '%M%' AND ProfileImageUrl != ''
|
CREATE TABLE table_204_318 (
id number,
"date" text,
"opponent" text,
"venue" text,
"result" text,
"attendance" number,
"scorers" text
)
|
how many people attended the game in november against sunderland ?
|
SELECT "attendance" FROM table_204_318 WHERE "date" = 11 AND "opponent" = 'sunderland'
|
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
|
For those records from the products and each product's manufacturer, show me about the distribution of name and the average of code , and group by attribute name in a bar chart, and order total number in descending order please.
|
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code DESC
|
CREATE TABLE table_61671 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
)
|
What Player has a To par of 2?
|
SELECT "Player" FROM table_61671 WHERE "To par" = '–2'
|
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 semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
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_projects varchar,
has_exams varchar,
num_reviews int,
clarity_score int,
easiness_score int,
helpfulness_score int
)
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE 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_project varchar,
has_final_exam varchar,
textbook varchar,
class_address varchar,
allow_audit varchar
)
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,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int,
long_lectures int,
extra_credit int,
few_tests int,
good_feedback int,
tough_tests int,
heavy_papers int,
cares_for_students int,
heavy_assignments int,
respected int,
participation int,
heavy_reading int,
tough_grader int,
hilarious int,
would_take_again int,
good_lecture int,
no_skip int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
|
Are any other requirements fulfilled for POLISH 432 besides general elective ?
|
SELECT DISTINCT program_course.category FROM course, program_course WHERE course.department = 'POLISH' AND course.number = 432 AND program_course.course_id = course.course_id
|
CREATE TABLE table_16966 (
"Date" text,
"Tournament" text,
"Location" text,
"Purse( $ )" real,
"Winner" text,
"Score" text,
"1st Prize( $ )" real
)
|
Which located featured the first prize of 33500?
|
SELECT "Location" FROM table_16966 WHERE "1st Prize( $ )" = '33500'
|
CREATE TABLE table_16449 (
"1973 Democratic initial primary" text,
"Manhattan" text,
"The Bronx" text,
"Brooklyn" text,
"Queens" text,
"Richmond [Staten Is.]" text,
"Total" real,
"%" text
)
|
What is the queens where richmond staten is 42%?
|
SELECT "Queens" FROM table_16449 WHERE "Richmond [Staten Is.]" = '42%'
|
CREATE TABLE table_63326 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
)
|
What's the tie number of Chelsea when they were home?
|
SELECT "Tie no" FROM table_63326 WHERE "Home team" = 'chelsea'
|
CREATE TABLE table_50038 (
"Year" real,
"Round" text,
"Player" text,
"Nationality" text,
"Position" text,
"College/High School/Club" text
)
|
What is the round of the pf position player from 1996 and the college/high school/club mississippi state?
|
SELECT "Round" FROM table_50038 WHERE "Position" = 'pf' AND "Year" = '1996' AND "College/High School/Club" = 'mississippi state'
|
CREATE TABLE table_29285 (
"Team" text,
"Outgoing manager" text,
"Manner of departure" text,
"Date of vacancy" text,
"Replaced by" text,
"Date of appointment" text
)
|
How many date of appointment entries are there when the team is khazar lankaran?
|
SELECT COUNT("Date of appointment") FROM table_29285 WHERE "Team" = 'Khazar Lankaran'
|
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
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),
COUNTRY_ID varchar(2)
)
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 countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
|
For those employees who did not have any job in the past, visualize a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, I want to show by the the average of employee id in asc.
|
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(EMPLOYEE_ID)
|
CREATE TABLE table_80078 (
"Name" text,
"Years" text,
"Gender" text,
"Area" text,
"Authority" text,
"Decile" real,
"Roll" real
)
|
Where is the school with state authority that has a roll of more than 157 students?
|
SELECT "Area" FROM table_80078 WHERE "Authority" = 'state' AND "Roll" > '157'
|
CREATE TABLE table_name_44 (
opponents_in_the_final VARCHAR,
partnering VARCHAR
)
|
Who are the finals opponents for the match with partner Ricardo Hocevar?
|
SELECT opponents_in_the_final FROM table_name_44 WHERE partnering = "ricardo hocevar"
|
CREATE TABLE table_204_775 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
|
what is the only nation to receive three gold medals ?
|
SELECT "nation" FROM table_204_775 WHERE "gold" = 3
|
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE 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
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
|
get me the long title of diagnoses and primary disease of patient betty campbell.
|
SELECT demographic.diagnosis, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Betty Campbell"
|
CREATE TABLE table_name_27 (
republican_ticket VARCHAR,
prohibition_ticket VARCHAR
)
|
What kind of Republican ticket has a Prohibition ticket of stephen mead wing?
|
SELECT republican_ticket FROM table_name_27 WHERE prohibition_ticket = "stephen mead wing"
|
CREATE TABLE table_16429 (
"Rnd" real,
"Race Name" text,
"Pole position" text,
"Fastest lap" text,
"Winning driver" text,
"Winning team" text,
"Report" text
)
|
Who drove the fastest lap at the Tenneco Automotive Grand Prix of Detroit?
|
SELECT "Fastest lap" FROM table_16429 WHERE "Race Name" = 'Tenneco Automotive Grand Prix of Detroit'
|
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDate time,
ApprovalModeratorId number,
DeactivationDate time,
DeactivationModeratorId number
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostsWithDeleted (
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
|
Tags Without Excerpt or Wiki (unbalanced).
|
SELECT c.TagName, c.CountPosts AS "Number of Posts", e.Body AS "Excerpt", w.Body AS "Wiki" FROM (SELECT t.TagName, t.ExcerptPostId, t.WikiPostId, COUNT(*) AS CountPosts FROM Tags AS t LEFT OUTER JOIN TagSynonyms AS s ON (t.TagName = s.SourceTagName) INNER JOIN PostTags AS p ON (p.TagId = t.Id) WHERE s.ApprovalDate IS NULL GROUP BY t.TagName, t.ExcerptPostId, t.WikiPostId) AS c LEFT OUTER JOIN Posts AS e ON (c.ExcerptPostId = e.Id) LEFT OUTER JOIN Posts AS w ON (c.WikiPostId = w.Id) WHERE (LENGTH(LTRIM(RTRIM(e.Body))) != 0 AND LENGTH(LTRIM(RTRIM(w.Body))) = 0) OR (LENGTH(LTRIM(RTRIM(e.Body))) = 0 AND LENGTH(LTRIM(RTRIM(w.Body))) != 0) ORDER BY c.CountPosts DESC, c.TagName
|
CREATE TABLE table_name_82 (
visitor VARCHAR,
leading_scorer VARCHAR
)
|
Which team was the visitor when Milt Palacio (15) was the leading scorer?
|
SELECT visitor FROM table_name_82 WHERE leading_scorer = "milt palacio (15)"
|
CREATE TABLE table_226619_12 (
points VARCHAR,
respect_toward_opponents VARCHAR
)
|
Name the points for 212 respect toward opponents
|
SELECT points FROM table_226619_12 WHERE respect_toward_opponents = 212
|
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
|
what is the number of patients whose diagnoses short title is mv collision nos-driver and drug route is id?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Mv collision NOS-driver" AND prescriptions.route = "ID"
|
CREATE TABLE table_76307 (
"Season" text,
"Series" text,
"Team Name" text,
"Races" real,
"Wins" real,
"Poles" real,
"F.L." real,
"Podiums" real,
"Points" text,
"Position" text
)
|
What is the race in the 8th position?
|
SELECT "Races" FROM table_76307 WHERE "Position" = '8th'
|
CREATE TABLE table_43314 (
"Pick #" real,
"NFL Team" text,
"Player" text,
"Position" text,
"College" text
)
|
What was the pick number for the wide receiver drafted from Michigan State?
|
SELECT "Pick #" FROM table_43314 WHERE "Position" = 'wide receiver' AND "College" = 'michigan state'
|
CREATE TABLE table_1140117_5 (
report VARCHAR,
race_name VARCHAR
)
|
What's the report for the race name, XIII Grand Prix de l'Albigeois?
|
SELECT report FROM table_1140117_5 WHERE race_name = "XIII Grand Prix de l'Albigeois"
|
CREATE TABLE table_46750 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
)
|
What Country is Rocco Mediate from?
|
SELECT "Country" FROM table_46750 WHERE "Player" = 'rocco mediate'
|
CREATE TABLE table_28116528_1 (
original_air_date VARCHAR,
production_code VARCHAR
)
|
What date did the episode with a production code of 3x6316 originally air?
|
SELECT original_air_date FROM table_28116528_1 WHERE production_code = "3X6316"
|
CREATE TABLE table_name_68 (
attendance INTEGER,
home VARCHAR
)
|
What was the lowest attendance at a game when Pittsburgh was the home team?
|
SELECT MIN(attendance) FROM table_name_68 WHERE home = "pittsburgh"
|
CREATE TABLE table_31528 (
"Episode no." real,
"US Airdate" text,
"US Total viewers" text,
"UK Airdate" text,
"UK Total viewers" text
)
|
How many viewers in the UK did episode 50 have?
|
SELECT "UK Total viewers" FROM table_31528 WHERE "Episode no." = '50'
|
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostsWithDeleted (
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDate time,
ApprovalModeratorId number,
DeactivationDate time,
DeactivationModeratorId number
)
|
How many users have a location in their profile.
|
SELECT HasLocation, COUNT(*) FROM (SELECT Id AS "user_link", CASE WHEN Location IS NULL THEN 'No' ELSE 'Yes' END AS HasLocation FROM Users) AS t GROUP BY HasLocation
|
CREATE TABLE table_1165 (
"Team" text,
"Copa Libertadores 1992" text,
"Supercopa Sudamericana 1992" text,
"Copa CONMEBOL 1992" text,
"Recopa Sudamericana 1992" text,
"Intercontinental Cup 1992" text
)
|
Name the recopa sudamericana 1992 for did not qualify for libertadores 1992 and round of 16 for bragantino
|
SELECT "Recopa Sudamericana 1992" FROM table_1165 WHERE "Copa Libertadores 1992" = 'Did not qualify' AND "Copa CONMEBOL 1992" = 'Round of 16' AND "Team" = 'Bragantino'
|
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostsWithDeleted (
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,
LastEditDate time,
LastActivityDate time,
Title text,
Tags text,
AnswerCount number,
CommentCount number,
FavoriteCount number,
ClosedDate time,
CommunityOwnedDate time,
ContentLicense text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDate time,
ApprovalModeratorId number,
DeactivationDate time,
DeactivationModeratorId number
)
|
Questions with negative score favorited only by the OP.
|
SELECT Posts.Id AS "post_link", Posts.FavoriteCount, Posts.Score, Posts.CreationDate, Votes.UserId AS "user_link" FROM Votes JOIN Posts ON (Posts.Id = Votes.PostId) WHERE Posts.FavoriteCount = 1 AND Posts.Score < 0 AND VoteTypeId = 5 AND Posts.PostTypeId = 1 AND Posts.OwnerUserId = Votes.UserId ORDER BY Posts.CreationDate DESC
|
CREATE TABLE table_name_37 (
opponent VARCHAR,
home_away VARCHAR,
result VARCHAR
)
|
Name the opponent when the result is w 16-15 and has home/away of home
|
SELECT opponent FROM table_name_37 WHERE home_away = "home" AND result = "w 16-15"
|
CREATE TABLE table_name_79 (
notes VARCHAR,
title VARCHAR
)
|
What are the notes for Happy Camp?
|
SELECT notes FROM table_name_79 WHERE title = "happy camp"
|
CREATE TABLE table_36968 (
"Frequency (kHz)" real,
"Call letters" text,
"Licensed location" text,
"Type" text,
"Format" text
)
|
What is the smallest frequency (kHz) that is in the location of Longview?
|
SELECT MIN("Frequency (kHz)") FROM table_36968 WHERE "Licensed location" = 'longview'
|
CREATE TABLE table_8818 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
)
|
What was Raymond Floyd's score?
|
SELECT "Score" FROM table_8818 WHERE "Player" = 'raymond floyd'
|
CREATE TABLE table_name_18 (
score VARCHAR,
record VARCHAR,
game VARCHAR,
decision VARCHAR
)
|
What's the score for a game over 56 with a record of 29-24-7 with a lundqvist decision?
|
SELECT score FROM table_name_18 WHERE game > 56 AND decision = "lundqvist" AND record = "29-24-7"
|
CREATE TABLE WINE (
Name VARCHAR,
price VARCHAR
)
|
List the names of all distinct wines ordered by price.
|
SELECT DISTINCT Name FROM WINE ORDER BY price
|
CREATE TABLE table_name_95 (
tournament VARCHAR,
opponents_in_the_final VARCHAR
)
|
What tournament had an opponent of Els Callens Nancy Feber?
|
SELECT tournament FROM table_name_95 WHERE opponents_in_the_final = "els callens nancy feber"
|
CREATE TABLE table_10015132_9 (
school_club_team VARCHAR,
player VARCHAR
)
|
What school/club team is Trey Johnson on?
|
SELECT school_club_team FROM table_10015132_9 WHERE player = "Trey Johnson"
|
CREATE TABLE table_19130829_4 (
team__number2 VARCHAR
)
|
What's the 2nd leg result in the round where Panionios is team #2?
|
SELECT 2 AS nd_leg FROM table_19130829_4 WHERE team__number2 = "Panionios"
|
CREATE TABLE table_name_61 (
total_seats INTEGER,
share_of_votes VARCHAR
)
|
When the share of votes equals 21.8%, what's the sum of the total amount of seats?
|
SELECT SUM(total_seats) FROM table_name_61 WHERE share_of_votes = "21.8%"
|
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,
route text,
drug_dose text
)
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 text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
|
Calculate the total number of patients who had icd9 code v1006 and a duration of stay in hospital of more than 17 days
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "17" AND diagnoses.icd9_code = "V1006"
|
CREATE TABLE table_204_938 (
id number,
"year" number,
"edmonton\nhundred" number,
"elthorne\nhundred" number,
"gore\nhundred" number,
"isleworth\nhundred" number,
"ossulstone\nhundred\nholborn\ndivision" number,
"ossulstone\nhundred\nfinsbury\ndivision" number,
"ossulstone\nhundred\nkensington\ndivision" number,
"ossulstone\nhundred\ntower\ndivision" number,
"spelthorne\nhundred" number,
"london city\nwithin\nthe walls" number,
"london city\nwithout\nthe walls" number,
"inns of court\nand\nchancery" number,
"westminster\ncity and\nliberty" number,
"total" number
)
|
what was the total population in 1801 ?
|
SELECT "total" FROM table_204_938 WHERE "year" = 1801
|
CREATE TABLE table_name_28 (
number_ VARCHAR,
_name VARCHAR,
date INTEGER
)
|
What's the number & name for the date after 1954?
|
SELECT number_ & _name FROM table_name_28 WHERE date > 1954
|
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
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 intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
|
during this year was patient 009-10007 prescribed pantoprazole sodium 40 mg po tbec?
|
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-10007')) AND medication.drugname = 'pantoprazole sodium 40 mg po tbec' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
|
CREATE TABLE table_33181 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
)
|
What was the attendance in week 6?
|
SELECT "Attendance" FROM table_33181 WHERE "Week" = '6'
|
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
|
provide the number of patients whose insurance is private and lab test name is bilirubin, indirect?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Private" AND lab.label = "Bilirubin, Indirect"
|
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
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 lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
|
what is the name of the treatment that patient 006-43795 had been given two times during the first hospital encounter?
|
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-43795' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 = 2
|
CREATE TABLE table_67030 (
"Number" text,
"Player" text,
"Position" text,
"Height" text,
"Weight" text,
"Home Town" text
)
|
Which player's home town is Swift Current, AB?
|
SELECT "Player" FROM table_67030 WHERE "Home Town" = 'swift current, ab'
|
CREATE TABLE table_train_83 (
"id" int,
"systolic_blood_pressure_sbp" int,
"renal_disease" bool,
"diabetic" string,
"estimated_glomerular_filtration_rate_egfr" int,
"iq" int,
"geriatric_depression_scale_gds" int,
"NOUSE" float
)
|
systolic blood pressure ( supine ) >= 100 mmhg;
|
SELECT * FROM table_train_83 WHERE systolic_blood_pressure_sbp >= 100
|
CREATE TABLE city (
Status VARCHAR
)
|
Please show the different statuses, ordered by the number of cities that have each.
|
SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*)
|
CREATE TABLE table_name_58 (
long INTEGER,
avg_g VARCHAR,
loss VARCHAR,
gain VARCHAR
)
|
How much Long has a Loss larger than 2, and a Gain of 157, and an Avg/G smaller than 129?
|
SELECT SUM(long) FROM table_name_58 WHERE loss > 2 AND gain = 157 AND avg_g < 129
|
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
)
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
)
|
What are the different ship flags, and how many ships have each. Show a pie chart.
|
SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag
|
CREATE TABLE table_name_79 (
perfect_stem VARCHAR,
future_stem VARCHAR
)
|
What is the perfect stem for the word that has a future stem of emango?
|
SELECT perfect_stem FROM table_name_79 WHERE future_stem = "emango"
|
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Score text
)
CREATE TABLE club (
Club_ID int,
name text,
Region text,
Start_year text
)
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
CREATE TABLE club_rank (
Rank real,
Club_ID int,
Gold real,
Silver real,
Bronze real,
Total real
)
CREATE TABLE player (
Player_ID int,
name text,
Position text,
Club_ID int,
Apps real,
Tries real,
Goals text,
Points real
)
|
For each position, what is the average number of points for players in that position Plot them as bar chart, could you show y axis from low to high order?
|
SELECT Position, AVG(Points) FROM player GROUP BY Position ORDER BY AVG(Points)
|
CREATE TABLE table_75591 (
"Tournament" text,
"Wins" real,
"Top-10" real,
"Top-25" real,
"Events" real,
"Cuts made" real
)
|
What is his low win total when he has over 3 top 25s and under 9 cuts made?
|
SELECT MIN("Wins") FROM table_75591 WHERE "Top-25" = '3' AND "Cuts made" < '9'
|
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
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,
round_trip_required varchar
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_miles int,
pressurized varchar
)
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
arrival_time int,
arrival_airline text,
arrival_flight_number int,
departure_time int,
departure_airline text,
departure_flight_number int,
stop_time int
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time int,
dual_carrier text,
flight_days text,
flight_id int,
flight_number int,
from_airport varchar,
meal_code text,
stops int,
time_elapsed int,
to_airport varchar
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE restriction (
restriction_code text,
advance_purchase int,
stopovers text,
saturday_stay_required text,
minimum_stay int,
maximum_stay int,
application text,
no_discounts text
)
|
how much does a FIRST class ticket cost from BOSTON to SAN FRANCISCO round trip
|
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare 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 FRANCISCO' AND NOT fare.round_trip_cost IS NULL AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_code
|
CREATE TABLE Addresses (
address_id INTEGER,
address_details VARCHAR(255)
)
CREATE TABLE Customer_Orders (
order_id INTEGER,
customer_id INTEGER,
order_status_code VARCHAR(10),
order_date DATETIME
)
CREATE TABLE Department_Store_Chain (
dept_store_chain_id INTEGER,
dept_store_chain_name VARCHAR(80)
)
CREATE TABLE Departments (
department_id INTEGER,
dept_store_id INTEGER,
department_name VARCHAR(80)
)
CREATE TABLE Order_Items (
order_item_id INTEGER,
order_id INTEGER,
product_id INTEGER
)
CREATE TABLE Products (
product_id INTEGER,
product_type_code VARCHAR(10),
product_name VARCHAR(80),
product_price DECIMAL(19,4)
)
CREATE TABLE Customer_Addresses (
customer_id INTEGER,
address_id INTEGER,
date_from DATETIME,
date_to DATETIME
)
CREATE TABLE Staff_Department_Assignments (
staff_id INTEGER,
department_id INTEGER,
date_assigned_from DATETIME,
job_title_code VARCHAR(10),
date_assigned_to DATETIME
)
CREATE TABLE Customers (
customer_id INTEGER,
payment_method_code VARCHAR(10),
customer_code VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
customer_phone VARCHAR(80),
customer_email VARCHAR(80)
)
CREATE TABLE Staff (
staff_id INTEGER,
staff_gender VARCHAR(1),
staff_name VARCHAR(80)
)
CREATE TABLE Product_Suppliers (
product_id INTEGER,
supplier_id INTEGER,
date_supplied_from DATETIME,
date_supplied_to DATETIME,
total_amount_purchased VARCHAR(80),
total_value_purchased DECIMAL(19,4)
)
CREATE TABLE Suppliers (
supplier_id INTEGER,
supplier_name VARCHAR(80),
supplier_phone VARCHAR(80)
)
CREATE TABLE Supplier_Addresses (
supplier_id INTEGER,
address_id INTEGER,
date_from DATETIME,
date_to DATETIME
)
CREATE TABLE Department_Stores (
dept_store_id INTEGER,
dept_store_chain_id INTEGER,
store_name VARCHAR(80),
store_address VARCHAR(255),
store_phone VARCHAR(80),
store_email VARCHAR(80)
)
|
What is the lowest price of product, grouped by product type? Show a bar chart.
|
SELECT product_type_code, MIN(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code
|
CREATE TABLE table_75388 (
"Game" real,
"December" real,
"Opponent" text,
"Score" text,
"Record" text
)
|
Game smaller than 34, and a December smaller than 14, and a Score of 10 - 6 has what opponent?
|
SELECT "Opponent" FROM table_75388 WHERE "Game" < '34' AND "December" < '14' AND "Score" = '10 - 6'
|
CREATE TABLE table_31649 (
"Year" real,
"Championship" text,
"Winning score" text,
"Margin" text,
"Runner(s)-up" text
)
|
What is the margin at the Nabisco Championship?
|
SELECT "Margin" FROM table_31649 WHERE "Championship" = 'nabisco championship'
|
CREATE TABLE table_name_27 (
bronze INTEGER,
gold VARCHAR,
silver VARCHAR,
total VARCHAR
)
|
Name the average bronze with silver more than 0, total of 6 and gold more than 0
|
SELECT AVG(bronze) FROM table_name_27 WHERE silver > 0 AND total = 6 AND gold > 0
|
CREATE TABLE table_57476 (
"Name" text,
"Block" text,
"Launch date/time (UTC)" text,
"COSPAR ID" text,
"Rocket" text
)
|
What block has a COSPAR ID of 1995-060a?
|
SELECT "Block" FROM table_57476 WHERE "COSPAR ID" = '1995-060a'
|
CREATE TABLE table_45790 (
"Date" text,
"Tournament" text,
"Winning score" text,
"Margin of victory" text,
"Runner(s)-up" text
)
|
On what date is Jerilyn Britz the runner-up?
|
SELECT "Date" FROM table_45790 WHERE "Runner(s)-up" = 'jerilyn britz'
|
CREATE TABLE table_2718 (
"Conference" text,
"Regular Season Winner" text,
"Conference Player of the Year" text,
"Conference Tournament" text,
"Tournament Venue (City)" text,
"Tournament Winner" text
)
|
Name the number of conference tournament for james madison
|
SELECT COUNT("Conference Tournament") FROM table_2718 WHERE "Tournament Winner" = 'James Madison'
|
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
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 text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
|
count the number of patients whose diagnosis short title is ath ext ntv at w claudct.
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Ath ext ntv at w claudct"
|
CREATE TABLE table_train_273 (
"id" int,
"systolic_blood_pressure_sbp" int,
"hemoglobin_a1c_hba1c" float,
"body_weight" float,
"hba1c" float,
"insulin_requirement" float,
"body_mass_index_bmi" float,
"NOUSE" float
)
|
body mass index ( bmi ) of 27 to 45 kg / m2 with weight < / = 136 kg ( 300 lbs.
|
SELECT * FROM table_train_273 WHERE body_mass_index_bmi >= 27 AND body_mass_index_bmi <= 45 AND body_weight <= 136
|
CREATE TABLE Settlements (
Settlement_ID INTEGER,
Claim_ID INTEGER,
Date_Claim_Made DATE,
Date_Claim_Settled DATE,
Amount_Claimed INTEGER,
Amount_Settled INTEGER,
Customer_Policy_ID INTEGER
)
CREATE TABLE Payments (
Payment_ID INTEGER,
Settlement_ID INTEGER,
Payment_Method_Code VARCHAR(255),
Date_Payment_Made DATE,
Amount_Payment INTEGER
)
CREATE TABLE Customers (
Customer_ID INTEGER,
Customer_Details VARCHAR(255)
)
CREATE TABLE Customer_Policies (
Policy_ID INTEGER,
Customer_ID INTEGER,
Policy_Type_Code CHAR(15),
Start_Date DATE,
End_Date DATE
)
CREATE TABLE Claims (
Claim_ID INTEGER,
Policy_ID INTEGER,
Date_Claim_Made DATE,
Date_Claim_Settled DATE,
Amount_Claimed INTEGER,
Amount_Settled INTEGER
)
|
For those payments processed with Visa, bin the payment day into Year interval and compute the average amount payment as the Y-axis.
|
SELECT Date_Payment_Made, AVG(Amount_Payment) FROM Payments WHERE Payment_Method_Code = 'Visa'
|
CREATE TABLE Order_Items (
Order_Item_ID INTEGER,
Order_ID INTEGER,
Product_ID INTEGER,
Order_Quantity VARCHAR(288),
Other_Item_Details VARCHAR(255)
)
CREATE TABLE Bookings (
Booking_ID INTEGER,
Customer_ID INTEGER,
Workshop_Group_ID VARCHAR(100),
Status_Code CHAR(15),
Store_ID INTEGER,
Order_Date DATETIME,
Planned_Delivery_Date DATETIME,
Actual_Delivery_Date DATETIME,
Other_Order_Details VARCHAR(255)
)
CREATE TABLE Clients (
Client_ID INTEGER,
Address_ID INTEGER,
Customer_Email_Address VARCHAR(255),
Customer_Name VARCHAR(255),
Customer_Phone VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Customers (
Customer_ID VARCHAR(100),
Address_ID INTEGER,
Customer_Name VARCHAR(255),
Customer_Phone VARCHAR(255),
Customer_Email_Address VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Addresses (
Address_ID VARCHAR(100),
Line_1 VARCHAR(255),
Line_2 VARCHAR(255),
City_Town VARCHAR(255),
State_County VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Products (
Product_ID VARCHAR(100),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
Product_Description VARCHAR(255),
Other_Product_Service_Details VARCHAR(255)
)
CREATE TABLE Ref_Service_Types (
Service_Type_Code CHAR(15),
Parent_Service_Type_Code CHAR(15),
Service_Type_Description VARCHAR(255)
)
CREATE TABLE Invoices (
Invoice_ID INTEGER,
Order_ID INTEGER,
payment_method_code CHAR(15),
Product_ID INTEGER,
Order_Quantity VARCHAR(288),
Other_Item_Details VARCHAR(255),
Order_Item_ID INTEGER
)
CREATE TABLE Stores (
Store_ID VARCHAR(100),
Address_ID INTEGER,
Marketing_Region_Code CHAR(15),
Store_Name VARCHAR(255),
Store_Phone VARCHAR(255),
Store_Email_Address VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Services (
Service_ID INTEGER,
Service_Type_Code CHAR(15),
Workshop_Group_ID INTEGER,
Product_Description VARCHAR(255),
Product_Name VARCHAR(255),
Product_Price DECIMAL(20,4),
Other_Product_Service_Details VARCHAR(255)
)
CREATE TABLE Ref_Payment_Methods (
payment_method_code CHAR(10),
payment_method_description VARCHAR(80)
)
CREATE TABLE Marketing_Regions (
Marketing_Region_Code CHAR(15),
Marketing_Region_Name VARCHAR(255),
Marketing_Region_Descriptrion VARCHAR(255),
Other_Details VARCHAR(255)
)
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 Performers_in_Bookings (
Order_ID INTEGER,
Performer_ID INTEGER
)
CREATE TABLE Bookings_Services (
Order_ID INTEGER,
Product_ID INTEGER
)
CREATE TABLE Drama_Workshop_Groups (
Workshop_Group_ID INTEGER,
Address_ID INTEGER,
Currency_Code CHAR(15),
Marketing_Region_Code CHAR(15),
Store_Name VARCHAR(255),
Store_Phone VARCHAR(255),
Store_Email_Address VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Performers (
Performer_ID INTEGER,
Address_ID INTEGER,
Customer_Name VARCHAR(255),
Customer_Phone VARCHAR(255),
Customer_Email_Address VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Customer_Orders (
Order_ID INTEGER,
Customer_ID INTEGER,
Store_ID INTEGER,
Order_Date DATETIME,
Planned_Delivery_Date DATETIME,
Actual_Delivery_Date DATETIME,
Other_Order_Details VARCHAR(255)
)
|
Show all payment method codes and the number of orders for each code in a bar chart, show by the payment_method_code in descending please.
|
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code ORDER BY payment_method_code DESC
|
CREATE TABLE table_name_28 (
seats INTEGER,
_percentage_change VARCHAR,
_percentage_votes VARCHAR
)
|
What are the fewest seats with a -3.7% change and more than 4.7% votes?
|
SELECT MIN(seats) FROM table_name_28 WHERE _percentage_change = -3.7 AND _percentage_votes > 4.7
|
CREATE TABLE table_69873 (
"Year" text,
"Team" text,
"Number" text,
"BB +HBP" real,
"BA (Place)" text
)
|
In the year 1992 for the Seibu Lions, the BB + HBP which is larger than 49 was this as a BA (Place)?
|
SELECT "BA (Place)" FROM table_69873 WHERE "BB +HBP" > '49' AND "Team" = 'seibu lions' AND "Year" = '1992'
|
CREATE TABLE table_76915 (
"Year" real,
"Film" text,
"Role" text,
"Director" text,
"Studio" text
)
|
What is the Year of the Film Klondike Annie?
|
SELECT SUM("Year") FROM table_76915 WHERE "Film" = 'klondike annie'
|
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 text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
|
what is drug name and drug route of drug code asa325?
|
SELECT prescriptions.drug, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "ASA325"
|
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear 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
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
|
give the number of patients who were admitted before the year 2158 and whose diagnosis long title is unspecified pleural effusion.
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2158" AND diagnoses.long_title = "Unspecified pleural effusion"
|
CREATE TABLE table_46528 (
"car model" text,
"displacement & configuration" text,
"max. motive power @ rpm" text,
"max. torque @ rpm" text,
"max. speed" text,
"emissions CO2" text
)
|
What is the displacement & configuration with CO2 of 204 g/km emissions?
|
SELECT "displacement & configuration" FROM table_46528 WHERE "emissions CO2" = '204 g/km'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.