table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE table_name_59 ( rank INTEGER, result VARCHAR, group VARCHAR, athlete VARCHAR )
What is the average rank for Group A athlete Yanina Karolchyk, and a result higher than 18?
SELECT AVG(rank) FROM table_name_59 WHERE group = "a" AND athlete = "yanina karolchyk" AND result > 18
CREATE TABLE table_name_45 ( finish INTEGER, start VARCHAR, year VARCHAR, manufacturer VARCHAR )
What is the smallest finish time for a race where start was less than 3, buick was the manufacturer, and the race was held after 1978?
SELECT MIN(finish) FROM table_name_45 WHERE year > 1978 AND manufacturer = "buick" AND start < 3
CREATE TABLE table_66952 ( "Year" real, "Division" text, "League" text, "Regular Season" text, "Playoffs" text, "Open Cup" text )
What division did the Nashville Metros play in during the year that they did not qualify for the Playoffs, where in the USL PDL League, and had the Regular Season 7th, Southeast?
SELECT "Division" FROM table_66952 WHERE "Playoffs" = 'did not qualify' AND "League" = 'usl pdl' AND "Regular Season" = '7th, southeast'
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 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
give me the number of patients whose days of hospital stay is greater than 20 and drug name is neo*iv*fat emulsion?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "20" AND prescriptions.drug = "NEO*IV*Fat Emulsion"
CREATE TABLE table_238124_1 ( bleeding_time VARCHAR, condition VARCHAR )
What is the bleeding time for glanzmann's thrombasthenia?
SELECT bleeding_time FROM table_238124_1 WHERE condition = "Glanzmann's thrombasthenia"
CREATE TABLE table_26464 ( "Confederation" text, "Teams started" text, "Teams that have secured qualification" text, "Teams that can still qualify" text, "Teams that have been eliminated" text, "Remaining places in finals" text, "Total places in finals" text, "Qualifying start date" text, "Qualifying end date" text )
What is the qualifying end date when the qualifying start date is qualifying start date?
SELECT "Qualifying end date" FROM table_26464 WHERE "Qualifying start date" = 'Qualifying start date'
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 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 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 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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
how many patients were diagnosed with sepsis and they didn't return to the hospital in a year before within 2 months?
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sepsis' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1) - (SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sepsis' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid WHERE t2.diagnosistime < patient.hospitaladmittime AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND DATETIME(patient.hospitaladmittime) BETWEEN DATETIME(t2.diagnosistime) AND DATETIME(t2.diagnosistime, '+2 month'))
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname 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 semester ( semester_id int, semester varchar, year int ) 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 ) 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 gsi ( course_offering_id int, student_id int ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) 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 program_requirement ( program_id int, category varchar, min_credit int, additional_req 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 )
For CS majors , name the classes that are available this Winter .
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE program_course.course_id = course.course_id AND program_course.course_id = course.course_id AND program.name LIKE '%CS%' AND program.program_id = program_course.program_id AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 2016
CREATE TABLE table_name_34 ( score VARCHAR, total_points VARCHAR )
What was the score where the total points was 50?
SELECT score FROM table_name_34 WHERE total_points = 50
CREATE TABLE table_name_50 ( elevator VARCHAR, elevated VARCHAR )
What is the Elevator of the Elected Elevated on September 21, 1179?
SELECT elevator FROM table_name_50 WHERE elevated = "september 21, 1179"
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 PostTypes ( Id number, Name text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment 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 Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostTags ( PostId number, TagId 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 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 PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange 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 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId 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 ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
1) Top 15 Posts, Ranked. Show post id, FavoriteCount (use column label votes), CommentCount (label:answers), ViewCount (label: views), and title
SELECT TOP(15) AS Id, FavoriteCount AS Votes, CommentCount AS Answers, ViewCount AS Views, Title FROM Posts WHERE NOT Title IS NULL ORDER BY Score DESC
CREATE TABLE table_69496 ( "Game" real, "Date" text, "Score" text, "Location" text, "Time" text, "Attendance" real )
Attendance larger than 55,189 is which average game?
SELECT AVG("Game") FROM table_69496 WHERE "Attendance" > '55,189'
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 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 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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
during the current hospital visit how many times did patient 016-9636 get a ptt test?
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'ptt'
CREATE TABLE table_32200 ( "Round" real, "Overall" real, "Player" text, "Position" text, "School/Club Team" text )
What is the total overall in round 1, in which Charles White was a player?
SELECT SUM("Overall") FROM table_32200 WHERE "Player" = 'charles white' AND "Round" < '1'
CREATE TABLE table_62659 ( "Rank" real, "Railway Station" text, "Annual entry/exit (millions) 2011\u201312" real, "Annual interchanges (millions) 2011\u201312" real, "Total Passengers (millions) 2011\u201312" real, "Location" text, "Number of Platforms" real )
What's the lowest number of total passengers (millions) for an annual entry/exit of 36.609?
SELECT MIN("Total Passengers (millions) 2011\u201312") FROM table_62659 WHERE "Annual entry/exit (millions) 2011\u201312" = '36.609'
CREATE TABLE table_204_416 ( id number, "chip" text, "flash size" text, "eeprom" number, "sram" number, "frequency\n[mhz]" number, "package" text )
what is the flash size difference in the at90s8515 chip and the at90s4414 ?
SELECT ABS((SELECT "flash size" FROM table_204_416 WHERE "chip" = 'at90s8515') - (SELECT "flash size" FROM table_204_416 WHERE "chip" = 'at90s4414'))
CREATE TABLE table_57402 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
Name the score for december 5
SELECT "Score" FROM table_57402 WHERE "Date" = 'december 5'
CREATE TABLE table_name_29 ( crowd INTEGER, away_team VARCHAR )
What is the average crowd to watch Hawthorn as the away team?
SELECT AVG(crowd) FROM table_name_29 WHERE away_team = "hawthorn"
CREATE TABLE table_name_69 ( Id VARCHAR )
2007 of 8 4 is involved in what 2002?
SELECT 2002 FROM table_name_69 WHERE 2007 = "8–4"
CREATE TABLE table_17360840_9 ( attendance INTEGER, opponent VARCHAR, record VARCHAR )
What was the attendance when the opposing team was the Ottawa Senators and the record was 24-35-17?
SELECT MAX(attendance) FROM table_17360840_9 WHERE opponent = "Ottawa Senators" AND record = "24-35-17"
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime 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 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 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 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 )
when was the first time patient 013-38992 was having less than 93.0 sao2 on the current icu visit?
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 = '013-38992') AND patient.unitdischargetime IS NULL) AND vitalperiodic.sao2 < 93.0 AND NOT vitalperiodic.sao2 IS NULL ORDER BY vitalperiodic.observationtime LIMIT 1
CREATE TABLE table_42341 ( "Year" text, "Matches" text, "Wins" text, "Losses" text, "No Result" text, "Success Rate" text )
what was the win for the 6 matches?
SELECT "Wins" FROM table_42341 WHERE "Matches" = '6'
CREATE TABLE table_169766_13 ( show VARCHAR, new_returning_same_network VARCHAR )
Which show was sent to syndication for its new/returning/same network.
SELECT show FROM table_169766_13 WHERE new_returning_same_network = "Syndication"
CREATE TABLE table_203_277 ( id number, "entered" number, "wrestler" text, "place" text, "eliminated by" text, "time" text )
how many wrestlers had a time of 6:47 ?
SELECT COUNT("wrestler") FROM table_203_277 WHERE "time" = '06:47'
CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int ) CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real )
What is the number of countries in the artist table?, I want to order from high to low by the x-axis.
SELECT Country, COUNT(Country) FROM artist GROUP BY Country ORDER BY Country DESC
CREATE TABLE table_40292 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" real, "Result" text )
On which week was the beatles the original artist and the order # smaller than 10?
SELECT "Week #" FROM table_40292 WHERE "Original artist" = 'the beatles' AND "Order #" < '10'
CREATE TABLE table_52202 ( "Rank" real, "Name" text, "Team" text, "Games" real, "Rebounds" real )
Which game did was Bud Eley a player in?
SELECT "Games" FROM table_52202 WHERE "Name" = 'bud eley'
CREATE TABLE table_54432 ( "Tournament" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text )
Which tournament has a 2011 of 1r?
SELECT "Tournament" FROM table_54432 WHERE "2011" = '1r'
CREATE TABLE table_23409 ( "No. overall" text, "No. in series" real, "Family/families" text, "Location(s)" text, "Original air date" text )
Name the number of families for uk30
SELECT COUNT("Family/families") FROM table_23409 WHERE "No. overall" = 'UK30'
CREATE TABLE table_name_33 ( place VARCHAR, performance VARCHAR )
What place had 14:11.15 as the performance?
SELECT place FROM table_name_33 WHERE performance = "14:11.15"
CREATE TABLE table_name_18 ( purpose VARCHAR, band VARCHAR, frequency VARCHAR )
Band of am, and a Frequency of 0 846 has what purpose?
SELECT purpose FROM table_name_18 WHERE band = "am" AND frequency = "0 846"
CREATE TABLE table_23670057_5 ( current_club VARCHAR, height__m_ VARCHAR )
Which clubs have players with height 2.14m?
SELECT current_club FROM table_23670057_5 WHERE height__m_ = "2.14"
CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE dorm_amenity ( amenid number, amenity_name text ) CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number )
What is the name of the dorm with both a TV Lounge and Study Room listed as amenities?
SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room'
CREATE TABLE table_name_3 ( clubs VARCHAR, number_of_fixtures VARCHAR )
What is the Clubs when there are 4 for the number of fixtures?
SELECT clubs FROM table_name_3 WHERE number_of_fixtures = 4
CREATE TABLE people ( name VARCHAR, height INTEGER )
find the name of people whose height is lower than the average.
SELECT name FROM people WHERE height < (SELECT AVG(height) FROM people)
CREATE TABLE table_28211103_1 ( winner VARCHAR, st_kilda_score VARCHAR )
Who is the winner when the st kilda score is 13.10.88?
SELECT winner FROM table_28211103_1 WHERE st_kilda_score = "13.10.88"
CREATE TABLE table_1157867_2 ( name VARCHAR, notes VARCHAR, builder VARCHAR )
Which locomotives 12' x 17' are both ex-industrial and built by Manning Wardle?
SELECT name FROM table_1157867_2 WHERE notes = "Ex-industrial" AND builder = "Manning Wardle"
CREATE TABLE course ( crs_code text, dept_code text, crs_description text, crs_credit number ) CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text ) CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number, stu_transfer number, dept_code text, stu_phone text, prof_num number ) CREATE TABLE class ( class_code text, crs_code text, class_section text, class_time text, class_room text, prof_num number ) CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) CREATE TABLE enroll ( class_code text, stu_num number, enroll_grade text )
How many classes are professor whose last name is Graztevski has?
SELECT COUNT(*) FROM employee AS T1 JOIN class AS T2 ON T1.emp_num = T2.prof_num WHERE T1.emp_lname = 'Graztevski'
CREATE TABLE table_2730 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who had highest points in game 5?
SELECT "High points" FROM table_2730 WHERE "Game" = '5'
CREATE TABLE table_name_26 ( record VARCHAR, location_attendance VARCHAR )
What was the season record when the location attendance was Air Canada Centre 19,800?
SELECT record FROM table_name_26 WHERE location_attendance = "air canada centre 19,800"
CREATE TABLE table_name_73 ( specific_orbital_energy VARCHAR, orbital_period VARCHAR )
Orbital period of 89 to 128 min has what specific orbital energy?
SELECT specific_orbital_energy FROM table_name_73 WHERE orbital_period = "89 to 128 min"
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 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 )
count the number of patients whose diagnoses short title is dmii oth uncntrld and drug route is pr?
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 = "DMII oth uncntrld" AND prescriptions.route = "PR"
CREATE TABLE table_62126 ( "Player" text, "Height" real, "Position" text, "Year born (Age)" text, "Current Club" text )
Which Current Club has a Player of bassem balaa?
SELECT "Current Club" FROM table_62126 WHERE "Player" = 'bassem balaa'
CREATE TABLE table_name_2 ( popular_votes INTEGER, year VARCHAR, office VARCHAR, percentage VARCHAR )
How many votes for the candidate after 1992, 1.59% of the vote, and the office of us representative 4?
SELECT AVG(popular_votes) FROM table_name_2 WHERE office = "us representative 4" AND percentage = "1.59%" AND year > 1992
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) 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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE 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 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id number, itemid number, label 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 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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
count the number of patients who have already received the esophagoscopy nec two or more times in 2102.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'esophagoscopy nec') AND STRFTIME('%y', procedures_icd.charttime) = '2102' GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 >= 2
CREATE TABLE table_67944 ( "Date" text, "Round" text, "Opponents" text, "Result F\u2013A" text, "Attendance" real )
Name the attendance for 4 january 2004
SELECT "Attendance" FROM table_67944 WHERE "Date" = '4 january 2004'
CREATE TABLE table_17627 ( "Municipality" text, "Population" real, "Police officers" real, "Residents per officer" real, "Total costs (2005)" text, "Cost per capita" text, "Case burden" real, "Crime rate per 1,000 people" real, "Police force" text )
What is the cost per capita in the Courtenay municipality?
SELECT "Cost per capita" FROM table_17627 WHERE "Municipality" = 'Courtenay'
CREATE TABLE table_74129 ( "Game" real, "November" real, "Opponent" text, "Score" text, "Location/Attendance" text, "Record" text, "Points" real )
What is the highest entry in November for the game 20?
SELECT MAX("November") FROM table_74129 WHERE "Game" = '20'
CREATE TABLE table_1341663_11 ( result VARCHAR, incumbent VARCHAR )
In the race involving Billy Lee Evans as the seated Representative, was he elected again?
SELECT result FROM table_1341663_11 WHERE incumbent = "Billy Lee Evans"
CREATE TABLE table_name_52 ( score VARCHAR, date VARCHAR, home VARCHAR, visitor VARCHAR )
Which Score has a Home of quebec nordiques, and a Visitor of vancouver blazers on february 28?
SELECT score FROM table_name_52 WHERE home = "quebec nordiques" AND visitor = "vancouver blazers" AND date = "february 28"
CREATE TABLE table_40087 ( "Name" text, "Status" text, "Authors" text, "Unit" text, "Location" text )
Which author is located in Mexico?
SELECT "Authors" FROM table_40087 WHERE "Location" = 'mexico'
CREATE TABLE table_17001658_10 ( date VARCHAR, team VARCHAR )
On what date was the team Philadelphia?
SELECT date FROM table_17001658_10 WHERE team = "Philadelphia"
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostHistoryTypes ( Id number, Name 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 PostTypes ( Id number, Name text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewTaskStates ( 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 ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE VoteTypes ( 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 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 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) 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 PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
Retrieve Answered Questions Tagged as 'Java' Created In The Month of January 2018.
SELECT Q.Id, Q.AcceptedAnswerId, Q.CreationDate, Q.Score, Q.Body AS "Question Body", Q.Title AS "Question Title", A.Body AS "Answer Body", Q.Tags FROM Posts AS Q INNER JOIN Posts AS A ON Q.AcceptedAnswerId = A.Id WHERE Q.Tags = '<##tag?java##>' AND Q.CreationDate BETWEEN '2018-01-01' AND '2018-01-31' AND Q.Score >= 0 ORDER BY Q.Id
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 ReviewTaskStates ( 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 PostTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment 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 Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) 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 ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) 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 PostTags ( PostId number, TagId 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId 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 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) 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 FlagTypes ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
Interest groups, user affinity Tagvector.
SELECT TOP(200) AS TagName, ROUND(10 * MIN(merit) * (AVG(merit) - STDEVP(merit)) / (AVG(merit) + STDEVP(merit)), 0) AS affinity_index, MAX(merit) AS mx, MIN(merit) AS mn FROM (SELECT Posts.OwnerUserId AS userId, TagName, ROUND(SQRT(COUNT(*)), 0) AS merit FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 WHERE Posts.OwnerUserId = @UserId1 OR Posts.OwnerUserId = @UserId2 GROUP BY Posts.OwnerUserId, TagName) AS t GROUP BY TagName HAVING COUNT(*) > 1 ORDER BY affinity_index DESC, TagName
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 ) 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
provide the number of patients whose admission year is less than 2119 and diagnoses icd9 code is 70714?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2119" AND diagnoses.icd9_code = "70714"
CREATE TABLE table_name_49 ( year INTEGER, city VARCHAR, score VARCHAR )
What is the lowest year that has chester-le-street as the city, with 345 runs as the score?
SELECT MIN(year) FROM table_name_49 WHERE city = "chester-le-street" AND score = "345 runs"
CREATE TABLE table_46979 ( "2004/ 05" text, "2006/ 07" text, "2007/ 08" text, "2009/ 10" text, "2010/ 11" text, "2011/ 12" text, "2012/ 13" text )
What was the 2012/13 result for the tournament that had a 2006/07 and 2007/08 finish of LQ, with the tournament not held in 2009/10?
SELECT "2012/ 13" FROM table_46979 WHERE "2007/ 08" = 'lq' AND "2006/ 07" = 'lq' AND "2009/ 10" = 'tournament not held'
CREATE TABLE course_prerequisite ( pre_course_id int, course_id 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 jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college 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 instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) 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 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 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 comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_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 ) CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int )
What courses that I 've taken are among the hardest in the AAPTIS department ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = 'AAPTIS' AND program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON PROGRAM_COURSEalias1.course_id = COURSEalias1.course_id WHERE COURSEalias1.department = 'AAPTIS') AND student_record.student_id = 1
CREATE TABLE table_name_5 ( sales__billion_ INTEGER, company VARCHAR, profits__billion_$_ VARCHAR )
What is the average sales in billions of walmart, which has more than 15.7 billion in profits?
SELECT AVG(sales__billion_) AS $_ FROM table_name_5 WHERE company = "walmart" AND profits__billion_$_ > 15.7
CREATE TABLE table_1827690_4 ( no VARCHAR, elected VARCHAR )
When 1462/63 was the elected what was the no.?
SELECT no FROM table_1827690_4 WHERE elected = "1462/63"
CREATE TABLE table_name_64 ( year INTEGER, sideline_reporter_s_ VARCHAR )
What was the earliest year featuring Sideline reporter(s) of michelle tafoya and suzy kolber?
SELECT MIN(year) FROM table_name_64 WHERE sideline_reporter_s_ = "michelle tafoya and suzy kolber"
CREATE TABLE table_15700367_6 ( runs_conceded VARCHAR, name VARCHAR )
How many runs conceded for chaminda vaas?
SELECT runs_conceded FROM table_15700367_6 WHERE name = "Chaminda Vaas"
CREATE TABLE flight ( flno number, origin text, destination text, distance number, departure_date time, arrival_date time, price number, aid number ) CREATE TABLE employee ( eid number, name text, salary number ) CREATE TABLE aircraft ( aid number, name text, distance number ) CREATE TABLE certificate ( eid number, aid number )
Show name and distance for all aircrafts.
SELECT name, distance FROM aircraft
CREATE TABLE table_16729063_2 ( date VARCHAR, opponent VARCHAR )
What date was the opponent the Los Angeles Raiders?
SELECT date FROM table_16729063_2 WHERE opponent = "Los Angeles Raiders"
CREATE TABLE table_33339 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
WHAT HOME TEAM SCORED 9.11 (65)?
SELECT "Home team" FROM table_33339 WHERE "Home team score" = '9.11 (65)'
CREATE TABLE table_name_93 ( to_par VARCHAR, player VARCHAR, place VARCHAR, country VARCHAR, score VARCHAR )
How far to par did ed furgol from the United States get when he scored less than 72 and was placed at t3?
SELECT to_par FROM table_name_93 WHERE country = "united states" AND score < 72 AND place = "t3" AND player = "ed furgol"
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,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) )
For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, sort by the Y from low to high.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY)
CREATE TABLE table_61083 ( "Date of release" text, "Title" text, "Billboard peak" real, "RIAA cert." text, "Label" text )
What label is released on September 20, 2005?
SELECT "Label" FROM table_61083 WHERE "Date of release" = 'september 20, 2005'
CREATE TABLE table_5783 ( "Call sign" text, "Frequency" text, "City of License" text, "Owner" text, "Format" text )
Which format is in St. George with a frequency of 0 107.3 fm?
SELECT "Format" FROM table_5783 WHERE "City of License" = 'st. george' AND "Frequency" = '0 107.3 fm'
CREATE TABLE table_name_37 ( total INTEGER, nation VARCHAR )
What was the most total medals awarded to Poland?
SELECT MAX(total) FROM table_name_37 WHERE nation = "poland"
CREATE TABLE table_name_40 ( margin INTEGER, country VARCHAR )
What is canada's margin?
SELECT SUM(margin) FROM table_name_40 WHERE country = "canada"
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 ) 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 )
how many patients with death staus 0 have been diagnosed with preterm nec1750-1999g?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Preterm NEC 1750-1999g"
CREATE TABLE table_29533 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "U.S. viewers (millions)" text, "Original U.S. air date" text, "Prod. code" real )
Name who wrote the production code 322
SELECT "Written by" FROM table_29533 WHERE "Prod. code" = '322'
CREATE TABLE table_15190346_2 ( stadium VARCHAR, bowl_game VARCHAR )
What stadium was the 1994 Gator Bowl in?
SELECT stadium FROM table_15190346_2 WHERE bowl_game = "1994 Gator Bowl"
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 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 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 ) 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 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 )
what was the monthly average value of weight for patient 018-119251 until 11/2105?
SELECT AVG(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-119251') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) <= '2105-11' GROUP BY STRFTIME('%y-%m', patient.unitadmittime)
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 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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) 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 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 all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, order the average of department id in ascending order.
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID)
CREATE TABLE table_name_58 ( interface VARCHAR, product VARCHAR )
What is the interface of the product xerox travel scanner 100?
SELECT interface FROM table_name_58 WHERE product = "xerox travel scanner 100"
CREATE TABLE table_name_81 ( opposing_teams VARCHAR, date VARCHAR )
What is Opposing Teams, when Date is '11/10/1991'?
SELECT opposing_teams FROM table_name_81 WHERE date = "11/10/1991"
CREATE TABLE table_203_654 ( id number, "position" number, "team" text, "points" number, "played" number, "won" number, "drawn" number, "lost" number, "for" number, "against" number, "difference" number )
in 1926 brazilian football , how many teams scored above 10 points in the season ?
SELECT COUNT("team") FROM table_203_654 WHERE "points" > 10
CREATE TABLE player ( pid number, pname text, ycard text, hs number ) CREATE TABLE college ( cname text, state text, enr number ) CREATE TABLE tryout ( pid number, cname text, ppos text, decision text )
Find the states where have the colleges whose enrollments are less than the largest size.
SELECT DISTINCT state FROM college WHERE enr < (SELECT MAX(enr) FROM college)
CREATE TABLE table_64675 ( "Rank:" real, "Premier:" text, "Assumed Office:" text, "Left Office:" text, "TOTAL Time in Office:" text )
What is the TOTAL Time in Office with a rank smaller than 18, and premier is Joh Bjelke-Petersen?
SELECT "TOTAL Time in Office:" FROM table_64675 WHERE "Rank:" < '18' AND "Premier:" = 'joh bjelke-petersen'
CREATE TABLE table_24807774_1 ( bosnian VARCHAR, cook_islands VARCHAR )
how many bosnian in cook islands is sri lankan
SELECT bosnian FROM table_24807774_1 WHERE cook_islands = "Sri Lankan"
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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) 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 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 d_labitems ( row_id number, itemid number, label text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE icustays ( 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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 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 )
when was patient 85131 prescribed the drug neo*iv*chlorothiazide and d5w at the same time for the last time until 19 months ago?
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'neo*iv*chlorothiazide' AND admissions.subject_id = 85131 AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-19 month')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'd5w' AND admissions.subject_id = 85131 AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-19 month')) AS t2 ON t1.subject_id = t2.subject_id WHERE DATETIME(t1.startdate) = DATETIME(t2.startdate) ORDER BY t1.startdate DESC LIMIT 1
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) ) CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER, Performer_ID INTEGER ) CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10), payment_method_description VARCHAR(80) ) 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 Order_Items ( Order_Item_ID INTEGER, Order_ID INTEGER, Product_ID INTEGER, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255) ) 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 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 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 Bookings_Services ( Order_ID INTEGER, Product_ID INTEGER ) 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 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 Ref_Service_Types ( Service_Type_Code CHAR(15), Parent_Service_Type_Code CHAR(15), Service_Type_Description 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 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 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 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 Performers ( Performer_ID INTEGER, Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
A bar chart about what are the different product names? What is the average product price for each of them?, sort X from low to high order.
SELECT Product_Name, AVG(Product_Price) FROM Products GROUP BY Product_Name ORDER BY Product_Name
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 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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY 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) )
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about manager_id over the last_name by a bar chart, could you show in desc by the Y-axis?
SELECT LAST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID DESC
CREATE TABLE table_name_75 ( area_km_2 INTEGER, official_name VARCHAR )
Can you tell me the sum of Area km 2 that has the Official Name of glenelg?
SELECT SUM(area_km_2) FROM table_name_75 WHERE official_name = "glenelg"
CREATE TABLE table_1974545_3 ( basketball_arena VARCHAR, capacity VARCHAR )
How many basketball arenas are there that belong to a school with a capacity of 3,000?
SELECT COUNT(basketball_arena) FROM table_1974545_3 WHERE capacity = "3,000"
CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number, stu_transfer number, dept_code text, stu_phone text, prof_num number ) CREATE TABLE enroll ( class_code text, stu_num number, enroll_grade text ) CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text ) CREATE TABLE class ( class_code text, crs_code text, class_section text, class_time text, class_room text, prof_num number ) CREATE TABLE course ( crs_code text, dept_code text, crs_description text, crs_credit number ) CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text )
Find the first names and offices of all professors sorted by alphabetical order of their first name.
SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname
CREATE TABLE table_11750 ( "Town/City" text, "Population" real, "Operator" text, "First year" real, "Duration" text )
What is Ivaipor , pr's biggest population?
SELECT MAX("Population") FROM table_11750 WHERE "Town/City" = 'ivaiporã, pr'
CREATE TABLE table_204_986 ( id number, "#" number, "event year" number, "season" text, "flag bearer" text )
who was the first samoan flag bearer at the olympic games ?
SELECT "flag bearer" FROM table_204_986 ORDER BY "event year" LIMIT 1
CREATE TABLE table_name_62 ( gold INTEGER, rank VARCHAR, silver VARCHAR )
What shows for gold when the rank is less than 3, and silver less than 1?
SELECT SUM(gold) FROM table_name_62 WHERE rank < 3 AND silver < 1
CREATE TABLE table_name_91 ( silver VARCHAR, gold INTEGER )
What is the number in total of silver with a gold smaller than 0?
SELECT COUNT(silver) FROM table_name_91 WHERE gold < 0
CREATE TABLE table_41890 ( "RR Romaja" text, "M\u2013R Romaja" text, "Hangul" text, "Hanja" text, "Name origin" text, "Capital" text, "Region" text, "Korean dialect" text, "Post-1896 Provinces" text )
What is the Korean dialect in the daegu capital?
SELECT "Korean dialect" FROM table_41890 WHERE "Capital" = 'daegu'
CREATE TABLE table_1771753_3 ( race_time VARCHAR, team VARCHAR, laps VARCHAR )
When 228 is the lap and chip ganassi racing is the team what is the race time?
SELECT race_time FROM table_1771753_3 WHERE team = "Chip Ganassi Racing" AND laps = "228"
CREATE TABLE table_55560 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
In the game where Collingwood is the home team what is the score of the away team?
SELECT "Away team score" FROM table_55560 WHERE "Home team" = 'collingwood'
CREATE TABLE table_8061 ( "Rank" text, "Margin" text, "Opponent" text, "Venue" text, "Season" text )
What is the Rank that has a Venue of bellerive oval , hobart, and a Margin of 115 runs?
SELECT "Rank" FROM table_8061 WHERE "Venue" = 'bellerive oval , hobart' AND "Margin" = '115 runs'
CREATE TABLE table_name_11 ( place VARCHAR, score VARCHAR )
WHAT IS THE PLACE WITH THE SCORE 69-71-66-73=279?
SELECT place FROM table_name_11 WHERE score = 69 - 71 - 66 - 73 = 279
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, 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 PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange 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 FlagTypes ( Id number, Name text, Description 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 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment 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 PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense 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 TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
Stuff Ids inside user names.
SELECT STUFF(DisplayName, 5, 0, Id) FROM Users ORDER BY Reputation DESC LIMIT 100
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime 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 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 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 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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
how many patients have had neurology consultation done until 4 years ago?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'neurology consultation' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-4 year'))
CREATE TABLE train ( Train_ID int, Name text, Time text, Service text ) CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int ) CREATE TABLE train_station ( Train_ID int, Station_ID int )
Bar chart x axis location y axis the average of number of platforms
SELECT Location, AVG(Number_of_Platforms) FROM station GROUP BY Location