table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) 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 transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
how much does it cost to get diagnostic of bmi 33.0-33.9,adult?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'bmi 33.0-33.9,adult'))
CREATE TABLE table_name_38 ( to_par VARCHAR, country VARCHAR, place VARCHAR )
What is the to par of the player from the United States with a t5 place?
SELECT to_par FROM table_name_38 WHERE country = "united states" AND place = "t5"
CREATE TABLE table_18602462_22 ( round_of_16 VARCHAR, semifinals VARCHAR )
The semifinal score of vergeer ( ned ) l 0-6, 1-6 follows a round of 16 result of what?
SELECT round_of_16 FROM table_18602462_22 WHERE semifinals = "Vergeer ( NED ) L 0-6, 1-6"
CREATE TABLE table_47260 ( "Country" text, "Skip" text, "Ends Won" real, "Ends Lost" real, "Blank Ends F/A" text, "Stolen Ends For" real, "Stolen Ends Against" real, "Shot %" real )
What is the lowest ends lost when the stolen ends for is less than 13, and stolten ends against is 6?
SELECT MIN("Ends Lost") FROM table_47260 WHERE "Stolen Ends For" < '13' AND "Stolen Ends Against" = '6'
CREATE TABLE table_29464 ( "#" real, "Episode" text, "Air Date" text, "Rating" text, "Share" text, "18-49 (Rating/Share)" text, "Viewers (m)" text, "Weekly Rank (#)" text )
when air date is october 14, 2010 what are all 18-49 (rating/share date.
SELECT "18-49 (Rating/Share)" FROM table_29464 WHERE "Air Date" = 'October 14, 2010'
CREATE TABLE table_11820086_1 ( directed_by VARCHAR, us_viewers__millions_ VARCHAR )
Who directed the episode that was viewed by 2.57 million people in the U.S.?
SELECT directed_by FROM table_11820086_1 WHERE us_viewers__millions_ = "2.57"
CREATE TABLE table_name_6 ( bronze VARCHAR, silver VARCHAR, total VARCHAR )
What is Bronze, when Silver is less than 89, and when Total is '4'?
SELECT bronze FROM table_name_6 WHERE silver < 89 AND total = 4
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 FlagTypes ( Id number, Name text, Description 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 PostTypes ( Id number, Name text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskTypes ( 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense 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 PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description 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 ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress 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 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 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 PostTags ( PostId number, TagId number )
Questions with title length shorter than 15 characters.
SELECT Id AS "post_link", LENGTH(Title), * FROM Posts WHERE PostTypeId = 1 AND LENGTH(Title) < 15
CREATE TABLE table_203_215 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text )
did ito take 1st in the 10,000 m before or after he took 28th in the 10,000 m ?
SELECT (SELECT "year" FROM table_203_215 WHERE "position" = 1 AND "event" = '10,000m') < (SELECT "year" FROM table_203_215 WHERE "position" = 28 AND "event" = '10,000m')
CREATE TABLE table_name_14 ( money___ VARCHAR, to_par VARCHAR )
How much money has a to par of E?
SELECT COUNT(money___) AS $__ FROM table_name_14 WHERE to_par = "e"
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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) 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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) 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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
how many patients until 4 years ago were diagnosed with change in mental status during the same month after being diagnosed with esophagitis - regurgitant?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'change in mental status' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-4 year')) AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'esophagitis - regurgitant' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-4 year')) AS t2 WHERE t1.diagnosistime < t2.diagnosistime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.diagnosistime, 'start of month')
CREATE TABLE table_204_364 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text )
how many 800m events ?
SELECT COUNT("event") FROM table_204_364 WHERE "event" = 800
CREATE TABLE table_name_39 ( end_term INTEGER, start_term VARCHAR, name VARCHAR )
What is the smallest End term with a Start term of 1913, and a Name of ludwig iii?
SELECT MIN(end_term) FROM table_name_39 WHERE start_term = 1913 AND name = "ludwig iii"
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 ) 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 )
show me the number of patients on main type of drug prescription who have procedure icd9 code 4523.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "4523" AND prescriptions.drug_type = "MAIN"
CREATE TABLE table_45394 ( "Rank" text, "Name" text, "Height (m)" real, "Height (ft)" real, "Floors" text )
What is the Height of the Canterbury House with 12 Floors and a Rank of 75=?
SELECT AVG("Height (ft)") FROM table_45394 WHERE "Floors" = '12' AND "Rank" = '75=' AND "Name" = 'canterbury house'
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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) 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 CloseReasonTypes ( 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 Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 ReviewTaskResultTypes ( 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 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 ReviewTaskStates ( 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 ReviewTaskTypes ( 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostTypes ( 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
Fast-gun' distribution for a user.
WITH Dates AS (SELECT a.Id, q.CreationDate AS QDate, a.CreationDate AS ADate FROM Posts AS q, Posts AS a WHERE q.Id = a.ParentId AND q.PostTypeId = 1 AND a.PostTypeId = 2 AND a.OwnerUserId = '##UserId##'), Delays AS (SELECT Id, CAST((JULIANDAY(ADate) - JULIANDAY(QDate)) * 1440.0 AS INT) AS Delay FROM Dates) SELECT SUM(CASE WHEN Delay <= 15 THEN 1 ELSE 0 END) AS WITHin15, SUM(CASE WHEN Delay > 15 AND Delay <= 30 THEN 1 ELSE 0 END) AS WITHin30, SUM(CASE WHEN Delay > 30 AND Delay <= 45 THEN 1 ELSE 0 END) AS WITHin45, SUM(CASE WHEN Delay > 45 AND Delay <= 60 THEN 1 ELSE 0 END) AS WITHinHour, SUM(CASE WHEN Delay > 60 THEN 1 ELSE 0 END) AS MoreThanHour FROM Delays
CREATE TABLE table_5182 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text )
Location of brendan byrne arena had what score?
SELECT "Score" FROM table_5182 WHERE "Location" = 'brendan byrne arena'
CREATE TABLE table_67516 ( "Venue" text, "City" text, "State" text, "Tickets Sold / Available" text, "Gross Revenue (1982)" text, "Gross Revenue (2011)" text )
Which city had a gross revenue in 2011 of $739,578?
SELECT "City" FROM table_67516 WHERE "Gross Revenue (2011)" = '$739,578'
CREATE TABLE table_67054 ( "BR No." real, "Name" text, "Builder" text, "Whenbuilt" text, "Withdrawn" text )
When was moray firth built?
SELECT "Whenbuilt" FROM table_67054 WHERE "Name" = 'moray firth'
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) )
Which departments have the top 3 highest number of students? Show the department address and number of students with a pie chart.
SELECT DEPT_ADDRESS, COUNT(*) FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE ORDER BY COUNT(*) DESC LIMIT 3
CREATE TABLE table_name_10 ( cpu_chip VARCHAR, model VARCHAR, modem VARCHAR, type VARCHAR )
What is the CPU chip in the Dishplayer 7100, which is a dish tuner with a v.90 modem?
SELECT cpu_chip FROM table_name_10 WHERE modem = "v.90" AND type = "dish tuner" AND model = "dishplayer 7100"
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 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
count the number of patients whose year of birth is less than 2200 and lab test name is homocysteine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2200" AND lab.label = "Homocysteine"
CREATE TABLE table_17482534_1 ( no_in_series VARCHAR, production_code VARCHAR )
What number in the series are the episodes with production code 5016/5017?
SELECT no_in_series FROM table_17482534_1 WHERE production_code = "5016/5017"
CREATE TABLE endowment ( endowment_id int, School_id int, donator_name text, amount real ) CREATE TABLE School ( School_id text, School_name text, Location text, Mascot text, Enrollment int, IHSAA_Class text, IHSAA_Football_Class text, County text ) CREATE TABLE budget ( School_id int, Year int, Budgeted int, total_budget_percent_budgeted real, Invested int, total_budget_percent_invested real, Budget_invested_percent text )
Compute the total sum enrollment across county as a pie chart.
SELECT County, SUM(Enrollment) FROM School GROUP BY County
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 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE ta ( campus_job_id int, student_id int, location 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 ) 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 gsi ( course_offering_id int, student_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text 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 course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
What are the PreMajor classes ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
CREATE TABLE table_204_982 ( id number, "party/electoral alliance" text, "seats" number, "change" number, "votes" number, "%" text )
total number of parties who lost seats in the argentine chamber of deputies in the legislative election of 1930
SELECT COUNT("party/electoral alliance") FROM table_204_982 WHERE "change" < 0
CREATE TABLE table_69586 ( "Birth" text, "Marriage" text, "Became Consort" text, "Ceased to be Consort" text, "Death" text, "Spouse" text )
Name the marriage of the person who is married for christian viii
SELECT "Marriage" FROM table_69586 WHERE "Spouse" = 'christian viii'
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) ) CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME ) CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test_taken DATETIME, test_result VARCHAR(255) )
Find the number of the enrollment date for all the tests that have 'Pass' result.
SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass"
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 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 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 )
provide the number of patients whose admission type is emergency and procedure icd9 code is 9955?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.icd9_code = "9955"
CREATE TABLE table_name_68 ( length VARCHAR, version VARCHAR )
What is the length of the UK remix version?
SELECT length FROM table_name_68 WHERE version = "uk remix"
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 ) 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
provide the number of patients whose gender is m and diagnoses long title is unspecified procedure as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Unspecified procedure as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure"
CREATE TABLE table_name_1 ( location VARCHAR, circuit VARCHAR )
What is Location, when Circuit is August 16?
SELECT location FROM table_name_1 WHERE circuit = "august 16"
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime 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 treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) 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 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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
when is the last time that patient 006-66713 had the minimum value of heartrate until 2100 days ago?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-66713')) AND NOT vitalperiodic.heartrate IS NULL AND DATETIME(vitalperiodic.observationtime) <= DATETIME(CURRENT_TIME(), '-2100 day') ORDER BY vitalperiodic.heartrate, vitalperiodic.observationtime DESC LIMIT 1
CREATE TABLE fires ( fire_year number, discovery_date number, discovery_doy number, discovery_time text, stat_cause_code number, stat_cause_descr text, cont_date text, cont_doy text, cont_time text, fire_size number, fire_size_class text, latitude number, longitude number, owner_code number, owner_descr text, state text, county text, fips_code text, fips_name text )
How many wildfires in Gloucester county have been larger than 10 acres?
SELECT COUNT(*) FROM fires WHERE county = "Gloucester" AND fire_size > 10
CREATE TABLE artwork ( Id VARCHAR )
How many artworks are there?
SELECT COUNT(*) FROM artwork
CREATE TABLE table_4106 ( "Player" text, "County" text, "Matches" real, "Innings" real, "Runs" real, "Average" text, "Highest Score" text, "100s" real, "50s" real )
What is the average for the player from Lancashire 1 100?
SELECT "Average" FROM table_4106 WHERE "County" = 'Lancashire' AND "100s" = '1'
CREATE TABLE table_name_75 ( shooter VARCHAR, total VARCHAR )
Which shooter was the olympic bronze medalist?
SELECT shooter FROM table_name_75 WHERE total = "olympic bronze medalist"
CREATE TABLE table_64779 ( "Channel" real, "Video" text, "Aspect" text, "PSIP Short Name" text, "Network" text )
Which video has a 16:9 aspect?
SELECT "Video" FROM table_64779 WHERE "Aspect" = '16:9'
CREATE TABLE table_22163 ( "Title" text, "Developer" text, "Category" text, "Function" text, "Release date" text, "Version" text )
What is the function of 1.4 version of Windows live messenger?
SELECT "Function" FROM table_22163 WHERE "Version" = '1.4' AND "Title" = 'Windows Live Messenger'
CREATE TABLE table_60897 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real )
What is To par, when Total is less than 148, and when Country is 'South Africa'?
SELECT "To par" FROM table_60897 WHERE "Total" < '148' AND "Country" = 'south africa'
CREATE TABLE table_name_35 ( result VARCHAR, date VARCHAR )
What was the result of the game played on May 9, 2012?
SELECT result FROM table_name_35 WHERE date = "may 9, 2012"
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 ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostHistoryTypes ( 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 ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) 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 PostTypes ( Id number, Name text ) CREATE TABLE VoteTypes ( Id number, Name 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 CloseReasonTypes ( 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 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 )
Single awarded badges and users.
WITH awarded AS (SELECT COUNT(*) AS num, Name, Class FROM Badges GROUP BY Name, Class HAVING COUNT(*) = 1) SELECT b.Name, b.Class, u.DisplayName FROM Badges AS b JOIN awarded AS a ON a.Name = b.Name AND a.Class = b.Class JOIN Users AS u ON u.Id = b.UserId
CREATE TABLE table_5658 ( "Club" text, "Position in 2012\u201313" text, "First season in top division" text, "Number of seasons in top division" real, "Number of seasons in Prva HNL" real, "First season of current spell in top division" text, "Top division titles" text, "Last top division title" text )
Name the average number of seasons for Prva HNL of 17
SELECT AVG("Number of seasons in top division") FROM table_5658 WHERE "Number of seasons in Prva HNL" = '17'
CREATE TABLE table_1930 ( "Country" text, "Contestant" text, "Age" real, "Height (cm)" real, "Height (ft)" text, "Hometown" text )
When santiago del estero is the hometown who is the contestant?
SELECT "Contestant" FROM table_1930 WHERE "Hometown" = 'Santiago del Estero'
CREATE TABLE table_26005 ( "Round" real, "Finishing Date" text, "Rally Name" text, "Rally Base" text, "Surface" text, "Support Category" text )
Name the rally base for rallye de france alsace
SELECT "Rally Base" FROM table_26005 WHERE "Rally Name" = 'Rallye de France Alsace'
CREATE TABLE music_festival ( id number, music_festival text, date_of_ceremony text, category text, volume number, result text ) CREATE TABLE artist ( artist_id number, artist text, age number, famous_title text, famous_release_date text ) CREATE TABLE volume ( volume_id number, volume_issue text, issue_date text, weeks_on_top number, song text, artist_id number )
What are the famous titles of artists who have not only had volumes that spent more than 2 weeks on top but also volumes that spent less than 2 weeks on top?
SELECT T1.famous_title FROM artist AS T1 JOIN volume AS T2 ON T1.artist_id = T2.artist_id WHERE T2.weeks_on_top > 2 INTERSECT SELECT T1.famous_title FROM artist AS T1 JOIN volume AS T2 ON T1.artist_id = T2.artist_id WHERE T2.weeks_on_top < 2
CREATE TABLE table_52527 ( "Munsee Delaware" text, "Unami Delaware" text, "De Laet (1633)" text, "Campanius (ca. 1645)" text, "Interpreter (1684?)" text, "Thomas (1698)" text )
What is the Campanius term for an Unami Delaware term of pal naxk?
SELECT "Campanius (ca. 1645)" FROM table_52527 WHERE "Unami Delaware" = 'palé·naxk'
CREATE TABLE table_name_59 ( country VARCHAR, to_par VARCHAR )
What is the Country of the Player with a To par of +1?
SELECT country FROM table_name_59 WHERE to_par = "+1"
CREATE TABLE table_62467 ( "Parish (Prestegjeld)" text, "Sub-Parish (Sokn)" text, "Church Name" text, "Year Built" text, "Location of the Church" text )
What is the Sub-Parish (Sokn) that was built in 1957 in the location of Stavang?
SELECT "Sub-Parish (Sokn)" FROM table_62467 WHERE "Year Built" = '1957' AND "Location of the Church" = 'stavang'
CREATE TABLE table_name_28 ( team VARCHAR, car_no VARCHAR )
What team operates car 11?
SELECT team FROM table_name_28 WHERE car_no = "11"
CREATE TABLE table_68244 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
Which of the opponents has a record of 17-25?
SELECT "Opponent" FROM table_68244 WHERE "Record" = '17-25'
CREATE TABLE table_33417 ( "Round" real, "Overall" real, "Player" text, "Position" text, "School/Club Team" text )
Which player was drafted higher than 374 and went to the school Stephen F. Austin?
SELECT "Player" FROM table_33417 WHERE "Overall" < '374' AND "School/Club Team" = 'stephen f. austin'
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 )
Return a bar chart on what are the names and average prices of products for manufacturers whose products cost on average 150 or more?, display in descending by the Name.
SELECT T2.Name, AVG(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC
CREATE TABLE table_48263 ( "State" text, "Type" text, "Name" text, "Title" text, "Royal house" text, "From" text )
What is State, when From is '830 BC'?
SELECT "State" FROM table_48263 WHERE "From" = '830 bc'
CREATE TABLE table_29647 ( "Member" text, "Electorate" text, "Province" text, "MPs term" text, "Election date" text )
What was the province if the electorate was Collingwood?
SELECT "Province" FROM table_29647 WHERE "Electorate" = 'Collingwood'
CREATE TABLE company ( Company_ID int, Rank int, Company text, Headquarters text, Main_Industry text, Sales_billion real, Profits_billion real, Assets_billion real, Market_Value real ) CREATE TABLE station_company ( Station_ID int, Company_ID int, Rank_of_the_Year int ) CREATE TABLE gas_station ( Station_ID int, Open_Year int, Location text, Manager_Name text, Vice_Manager_Name text, Representative_Name text )
How many companies in each headquarter? Plot a bar chart, and I want to sort from low to high by the x-axis.
SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Headquarters ORDER BY Headquarters
CREATE TABLE table_41823 ( "Week" real, "Date" text, "Time (CST)" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "NFL Recap" text )
What time (cst) has and NFL recap of recap with october 19, 2008 as the date?
SELECT "Time (CST)" FROM table_41823 WHERE "NFL Recap" = 'recap' AND "Date" = 'october 19, 2008'
CREATE TABLE table_74411 ( "Rd." text, "Race" text, "Pole position" text, "Fastest lap" text, "Most laps led" text, "Winning driver" text, "Winning team" text )
Who had the fastest lap(s) when stefan wilson had the pole?
SELECT "Fastest lap" FROM table_74411 WHERE "Pole position" = 'Stefan Wilson'
CREATE TABLE table_20351295_2 ( high_checkout VARCHAR, player VARCHAR )
What's Trina Gulliver's high checkout?
SELECT high_checkout FROM table_20351295_2 WHERE player = "Trina Gulliver"
CREATE TABLE table_name_39 ( score VARCHAR, place VARCHAR, player VARCHAR )
What is Score, when Place is 'T9', and when Player is 'Jeff Sluman'?
SELECT score FROM table_name_39 WHERE place = "t9" AND player = "jeff sluman"
CREATE TABLE table_17319931_1 ( car_no VARCHAR, time_retired VARCHAR )
How many car numbers were recorded when the time/retired is +4.0019?
SELECT COUNT(car_no) FROM table_17319931_1 WHERE time_retired = "+4.0019"
CREATE TABLE table_7808 ( "State" text, "Preliminary Average" text, "Interview" text, "Swimsuit" text, "Evening Gown" text, "Semifinal Average" text )
what is the swimsuit score when the semifinal average score is 8.367 (10)?
SELECT "Swimsuit" FROM table_7808 WHERE "Semifinal Average" = '8.367 (10)'
CREATE TABLE table_19487922_2 ( current_march_20 VARCHAR, _2010 VARCHAR, country VARCHAR )
How many current drivers, as of March 20, 2010 does Denmark have?
SELECT current_march_20, _2010 FROM table_19487922_2 WHERE country = "Denmark"
CREATE TABLE table_name_89 ( marks VARCHAR, season VARCHAR )
How many marks did he get in 2005?
SELECT marks FROM table_name_89 WHERE season = "2005"
CREATE TABLE table_18600760_20 ( longitude VARCHAR, township VARCHAR )
What longitude is tatman township?
SELECT longitude FROM table_18600760_20 WHERE township = "Tatman"
CREATE TABLE table_67953 ( "Sydney" text, "Melbourne" text, "Perth" text, "Adelaide" text, "Gold Coast" text, "Auckland" text )
Name the Adelaide for Sydney of yes and Perth of yes
SELECT "Adelaide" FROM table_67953 WHERE "Sydney" = 'yes' AND "Perth" = 'yes'
CREATE TABLE table_34345 ( "Rank" real, "Name" text, "Nationality" text, "1st (m)" real, "2nd (m)" real, "Points" real, "Overall WC points (Rank)" text )
What is the 2nd (m) value for Gregor Schlierenzauer?
SELECT MIN("2nd (m)") FROM table_34345 WHERE "Name" = 'gregor schlierenzauer'
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
when has patient 14836 first received the urine microbiology test in the first hospital visit?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14836 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND microbiologyevents.spec_type_desc = 'urine' ORDER BY microbiologyevents.charttime LIMIT 1
CREATE TABLE table_46862 ( "State" text, "Type" text, "Name" text, "Title" text, "Royal house" text, "From" text )
In which state did Marquis Li rule?
SELECT "State" FROM table_46862 WHERE "Name" = 'li' AND "Title" = 'marquis'
CREATE TABLE table_64816 ( "Ref#" real, "Name" text, "Built" real, "Location" text, "Construction" text )
What is the name of the mill located on Anawan Street with a reference number larger than 8?
SELECT "Name" FROM table_64816 WHERE "Ref#" > '8' AND "Location" = 'anawan street'
CREATE TABLE table_60502 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( \u00a3 )" text )
What is the to par of the player from the United States with a t1 place?
SELECT "To par" FROM table_60502 WHERE "Country" = 'united states' AND "Place" = 't1'
CREATE TABLE user_profiles ( uid number, name text, email text, partitionid number, followers number ) CREATE TABLE tweets ( id number, uid number, text text, createdate time ) CREATE TABLE follows ( f1 number, f2 number )
Find the name and partition id for users who tweeted less than twice.
SELECT T1.name, T1.partitionid FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING COUNT(*) < 2
CREATE TABLE table_203_416 ( id number, "school name" text, "city" text, "grades" text, "establishment" number, "charter" text )
how many schools are only charter ?
SELECT COUNT("school name") FROM table_203_416 WHERE "charter" = 'charter'
CREATE TABLE table_name_41 ( date_of_birth__age_ VARCHAR, caps VARCHAR, position VARCHAR )
What is the date of birth of the player that has 11 caps and plays the prop position?
SELECT date_of_birth__age_ FROM table_name_41 WHERE caps = 11 AND position = "prop"
CREATE TABLE program_course ( program_id int, course_id int, workload int, category 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 ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) 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 area ( course_id int, area 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 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) 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 )
Which is the easiest class that fulfills the PreMajor requirement ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%PreMajor%')
CREATE TABLE table_name_33 ( nfl_team VARCHAR, college VARCHAR )
Which NFL team has a player that came from a college in Washington?
SELECT nfl_team FROM table_name_33 WHERE college = "washington"
CREATE TABLE table_33457 ( "Year" real, "Drivers" text, "Wins" real, "Points" text, "D.C." text )
Before 2007, how many wins were there when the point total was 48?
SELECT SUM("Wins") FROM table_33457 WHERE "Points" = '48' AND "Year" < '2007'
CREATE TABLE table_42846 ( "Year" real, "Chassis" text, "Engine" text, "Start" real, "Finish" real, "Entrant" text )
What chassis has patrick racing as an entrant, with a start greater than 6?
SELECT "Chassis" FROM table_42846 WHERE "Entrant" = 'patrick racing' AND "Start" > '6'
CREATE TABLE table_54758 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the least amount of silver medals a team with less than 0 gold medals has?
SELECT MIN("Silver") FROM table_54758 WHERE "Gold" < '0'
CREATE TABLE table_68308 ( "Name" text, "Birth" text, "Marriage" text, "Became Consort" text, "Ceased to be Consort" text, "Spouse" text )
Name the became consort for christian ix spouse
SELECT "Became Consort" FROM table_68308 WHERE "Spouse" = 'christian ix'
CREATE TABLE table_name_10 ( inf_stem VARCHAR, subj_pres VARCHAR )
What is the infinitive stem that has a subjunctive present of ou?
SELECT inf_stem FROM table_name_10 WHERE subj_pres = "ou"
CREATE TABLE table_name_30 ( week INTEGER, date VARCHAR, attendance VARCHAR )
How many weeks have a Date of december 4, 1976, and an Attendance larger than 57,366?
SELECT SUM(week) FROM table_name_30 WHERE date = "december 4, 1976" AND attendance > 57 OFFSET 366
CREATE TABLE table_43629 ( "Position" real, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
What is the total number of played for the goals against over 44 and a goal difference of 11?
SELECT COUNT("Played") FROM table_43629 WHERE "Goal Difference" = '11' AND "Goals against" > '44'
CREATE TABLE Part_Faults ( part_fault_id INTEGER, part_id INTEGER, fault_short_name VARCHAR(20), fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) CREATE TABLE Fault_Log ( fault_log_entry_id INTEGER, asset_id INTEGER, recorded_by_staff_id INTEGER, fault_log_entry_datetime DATETIME, fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) ) CREATE TABLE Engineer_Visits ( engineer_visit_id INTEGER, contact_staff_id INTEGER, engineer_id INTEGER, fault_log_entry_id INTEGER, fault_status VARCHAR(10), visit_start_datetime DATETIME, visit_end_datetime DATETIME, other_visit_details VARCHAR(255) ) CREATE TABLE Assets ( asset_id INTEGER, maintenance_contract_id INTEGER, supplier_company_id INTEGER, asset_details VARCHAR(255), asset_make VARCHAR(20), asset_model VARCHAR(20), asset_acquired_date DATETIME, asset_disposed_date DATETIME, other_asset_details VARCHAR(255) ) CREATE TABLE Third_Party_Companies ( company_id INTEGER, company_type VARCHAR(5), company_name VARCHAR(255), company_address VARCHAR(255), other_company_details VARCHAR(255) ) CREATE TABLE Maintenance_Engineers ( engineer_id INTEGER, company_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), other_details VARCHAR(255) ) CREATE TABLE Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) ) CREATE TABLE Skills_Required_To_Fix ( part_fault_id INTEGER, skill_id INTEGER ) CREATE TABLE Staff ( staff_id INTEGER, staff_name VARCHAR(255), gender VARCHAR(1), other_staff_details VARCHAR(255) ) CREATE TABLE Engineer_Skills ( engineer_id INTEGER, skill_id INTEGER ) CREATE TABLE Asset_Parts ( asset_id INTEGER, part_id INTEGER ) CREATE TABLE Maintenance_Contracts ( maintenance_contract_id INTEGER, maintenance_contract_company_id INTEGER, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR(255) ) CREATE TABLE Parts ( part_id INTEGER, part_name VARCHAR(255), chargeable_yn VARCHAR(1), chargeable_amount VARCHAR(20), other_part_details VARCHAR(255) )
Show the number of assets and group by asset make in a bar chart, and display in desc by the asset_make.
SELECT asset_make, COUNT(asset_make) FROM Assets GROUP BY asset_make ORDER BY asset_make DESC
CREATE TABLE table_10413597_5 ( setting VARCHAR, no_in_series VARCHAR )
How many settings where there for episode 29 of the season?
SELECT COUNT(setting) FROM table_10413597_5 WHERE no_in_series = 29
CREATE TABLE table_57312 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the average crowd size for Brunswick street oval?
SELECT AVG("Crowd") FROM table_57312 WHERE "Venue" = 'brunswick street oval'
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) 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 airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) 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 ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) 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 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 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 month ( month_number int, month_name text ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE 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 airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) 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 ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE code_description ( code varchar, description text )
list flights between BOSTON and SAN FRANCISCO that serve BREAKFAST
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, food_service WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND food_service.meal_code = flight.meal_code AND food_service.meal_description = 'BREAKFAST') AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
CREATE TABLE table_name_27 ( team VARCHAR, name VARCHAR )
Name of sue bird that involves what team?
SELECT team FROM table_name_27 WHERE name = "sue bird"
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,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) )
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, show y-axis in asc order.
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(SALARY)
CREATE TABLE table_2259285_1 ( winning_pct__percentage VARCHAR, goals_for VARCHAR )
What was the winning % when there were 322 goals?
SELECT winning_pct__percentage FROM table_2259285_1 WHERE goals_for = 322
CREATE TABLE table_65993 ( "Year" real, "Formula" text, "Driver" text, "Constructor" text, "Location" text, "Report" text )
Which formula had a driver of John Moore-Brabazon?
SELECT "Formula" FROM table_65993 WHERE "Driver" = 'john moore-brabazon'
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 )
calculate the average age of urgent hospital admission patients who were admitted on or after 2179.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.admityear >= "2179"
CREATE TABLE table_61491 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( \u00a3 )" real )
What country has player Nick Faldo?
SELECT "Country" FROM table_61491 WHERE "Player" = 'nick faldo'
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int )
Return a histogram on how many professors have a Ph.D. in each department?
SELECT DEPT_CODE, COUNT(*) FROM PROFESSOR WHERE PROF_HIGH_DEGREE = 'Ph.D.' GROUP BY DEPT_CODE
CREATE TABLE table_21407 ( "Year" real, "Indians admitted" real, "Pakistanis admitted" real, "Sri Lankans admitted" real, "Bangladeshis admitted" real, "Nepalis admitted" real )
How many Indians were admitted in 2001?
SELECT "Indians admitted" FROM table_21407 WHERE "Year" = '2001'
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) 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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
when was patient 65582 tested for magnesium for the last time this month?
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'magnesium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65582) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY labevents.charttime DESC LIMIT 1
CREATE TABLE table_name_62 ( high_rebounds VARCHAR, score VARCHAR )
Which High rebounds has a Score of w 81-69?
SELECT high_rebounds FROM table_name_62 WHERE score = "w 81-69"
CREATE TABLE table_29122 ( "No." real, "#" real, "Title" text, "Directed by" text, "Story by" text, "Teleplay by" text, "Original air date" text, "U.S. viewers (millions)" text )
How many viewers watched the episode with a story by david simon & mari kornhauser?
SELECT "U.S. viewers (millions)" FROM table_29122 WHERE "Story by" = 'David Simon & Mari Kornhauser'
CREATE TABLE table_name_27 ( result VARCHAR, opponent VARCHAR, venue VARCHAR )
What is the result of the match with clyde as the opponent in the h venue?
SELECT result FROM table_name_27 WHERE opponent = "clyde" AND venue = "h"
CREATE TABLE table_204_568 ( id number, "pennant" text, "name" text, "hull builder" text, "ordered" text, "laid down" text, "launched" text, "accepted into service" text, "commissioned" text, "est. building cost" text, "fate" text )
how many boats costed less than # 20m to build ?
SELECT COUNT(*) FROM table_204_568 WHERE "est. building cost" < 20