schema
stringlengths
20
14.6k
query
stringlengths
17
2.58k
question
stringlengths
8
1.06k
<table0>[vitalperiodic] { <col0>[vitalperiodicid]:[number] <col1>[patientunitstayid]:[number] <col2>[temperature]:[number] <col3>[sao2]:[number] <col4>[heartrate]:[number] <col5>[respiration]:[number] <col6>[systemicsystolic]:[number] <col7>[systemicdiastolic]:[number] <col8>[systemicmean]:[number] <col9>[observationtime]:[time] } <table1>[diagnosis] { <col0>[diagnosisid]:[number] <col1>[patientunitstayid]:[number] <col2>[diagnosisname]:[text] <col3>[diagnosistime]:[time] <col4>[icd9code]:[text] } <table2>[lab] { <col0>[labid]:[number] <col1>[patientunitstayid]:[number] <col2>[labname]:[text] <col3>[labresult]:[number] <col4>[labresulttime]:[time] } <table3>[allergy] { <col0>[allergyid]:[number] <col1>[patientunitstayid]:[number] <col2>[drugname]:[text] <col3>[allergyname]:[text] <col4>[allergytime]:[time] } <table4>[intakeoutput] { <col0>[intakeoutputid]:[number] <col1>[patientunitstayid]:[number] <col2>[cellpath]:[text] <col3>[celllabel]:[text] <col4>[cellvaluenumeric]:[number] <col5>[intakeoutputtime]:[time] } <table5>[microlab] { <col0>[microlabid]:[number] <col1>[patientunitstayid]:[number] <col2>[culturesite]:[text] <col3>[organism]:[text] <col4>[culturetakentime]:[time] } <table6>[patient] { <col0>[uniquepid]:[text] <col1>[patienthealthsystemstayid]:[number] <col2>[patientunitstayid]:[number] <col3>[gender]:[text] <col4>[age]:[text] <col5>[ethnicity]:[text] <col6>[hospitalid]:[number] <col7>[wardid]:[number] <col8>[admissionheight]:[number] <col9>[admissionweight]:[number] <col10>[dischargeweight]:[number] <col11>[hospitaladmittime]:[time] <col12>[hospitaladmitsource]:[text] <col13>[unitadmittime]:[time] <col14>[unitdischargetime]:[time] <col15>[hospitaldischargetime]:[time] <col16>[hospitaldischargestatus]:[text] } <table7>[treatment] { <col0>[treatmentid]:[number] <col1>[patientunitstayid]:[number] <col2>[treatmentname]:[text] <col3>[treatmenttime]:[time] } <table8>[cost] { <col0>[costid]:[number] <col1>[uniquepid]:[text] <col2>[patienthealthsystemstayid]:[number] <col3>[eventtype]:[text] <col4>[eventid]:[number] <col5>[chargetime]:[time] } <table9>[medication] { <col0>[medicationid]:[number] <col1>[patientunitstayid]:[number] <col2>[drugname]:[text] <col3>[dosage]:[text] <col4>[routeadmin]:[text] <col5>[drugstarttime]:[time] <col6>[drugstoptime]:[time] }
SELECT MAX( `<table2>`.`<table2>`result ) FROM `<table2>` WHERE `<table2>`.`<table6>`unitstayid IN ( SELECT `<table6>`.`<table6>`unitstayid FROM `<table6>` WHERE `<table6>`.`<table6>`healthsystemstayid IN ( SELECT `<table6>`.`<table6>`healthsystemstayid FROM `<table6>` WHERE `<table6>`.uniquepid = '022-6959' ) ) AND `<table2>`.`<table2>`name = '-eos' AND DATETIME( `<table2>`.`<table2>`resulttime, 'start of month' ) = DATETIME( CURRENT_TIME( ), 'start of month', '-0 month' )
hey what was patient 022-6959's maximum -eos value in this month?
<table0>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table1>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table2>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table3>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table4>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] }
SELECT COUNT( DISTINCT `<table3>`.subject_id ) FROM `<table3>` INNER JOIN diagnoses ON `<table3>`.hadm_id = diagnoses.hadm_id WHERE `<table3>`.expire_flag = "0" AND diagnoses.icd9_code = "99662"
what is the number of patients whose death status is 0 and diagnoses icd9 code is 99662?
<table0>[outputevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] <col6>[value]:[number] } <table1>[patients] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[gender]:[text] <col3>[dob]:[time] <col4>[dod]:[time] } <table2>[transfers] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[eventtype]:[text] <col5>[careunit]:[text] <col6>[wardid]:[number] <col7>[intime]:[time] <col8>[outtime]:[time] } <table3>[admissions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[admittime]:[time] <col4>[dischtime]:[time] <col5>[admission_type]:[text] <col6>[admission_location]:[text] <col7>[discharge_location]:[text] <col8>[insurance]:[text] <col9>[language]:[text] <col10>[marital_status]:[text] <col11>[ethnicity]:[text] <col12>[age]:[number] } <table4>[d_labitems] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] } <table5>[labevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[itemid]:[number] <col4>[charttime]:[time] <col5>[valuenum]:[number] <col6>[valueuom]:[text] } <table6>[d_icd_diagnoses] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table7>[d_icd_procedures] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table8>[microbiologyevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[charttime]:[time] <col4>[spec_type_desc]:[text] <col5>[org_name]:[text] } <table9>[cost] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[event_type]:[text] <col4>[event_id]:[number] <col5>[chargetime]:[time] } <table10>[d_items] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] <col3>[linksto]:[text] } <table11>[diagnoses_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table12>[prescriptions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[startdate]:[time] <col4>[enddate]:[time] <col5>[drug]:[text] <col6>[dose_val_rx]:[text] <col7>[dose_unit_rx]:[text] <col8>[route]:[text] } <table13>[chartevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[itemid]:[number] <col5>[charttime]:[time] <col6>[valuenum]:[number] <col7>[valueuom]:[text] } <table14>[procedures_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table15>[inputevents_cv] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] } <table16>[icustays] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[first_careunit]:[text] <col5>[last_careunit]:[text] <col6>[first_wardid]:[number] <col7>[last_wardid]:[number] <col8>[intime]:[time] <col9>[outtime]:[time] }
SELECT COUNT( * ) > 0 FROM `<table3>` WHERE `<table3>`.subject_id = 25365 AND STRFTIME( '%y', `<table3>`.admittime ) = '2105'
has patient 25365 been admitted to the hospital in 2105?
<table0>[table_name_20] { <col0>[date]:[VARCHAR] <col1>[score]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "5-1"
Which date had a score of 5-1?
<table0>[table_name_8] { <col0>[opponent]:[VARCHAR] <col1>[tournament]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "phuket , thailand"
What is Opponent, when Tournament is 'Phuket , Thailand'?
<table0>[PostNotices] { <col0>[number]:[PostId] <col1>[number]:[PostNoticeTypeId] <col2>[number]:[CreationDate] <col3>[time]:[DeletionDate] <col4>[time]:[ExpiryDate] <col5>[time]:[Body] <col6>[text]:[OwnerUserId] <col7>[number]:[DeletionUserId] } <table1>[PostNoticeTypes] { <col0>[number]:[ClassId] <col1>[number]:[text] <col2>[Body]:[text] <col3>[IsHidden]:[boolean] <col4>[Predefined]:[boolean] <col5>[PostNoticeDurationId]:[number] } <table2>[PostsWithDeleted] { <col0>[number]:[PostTypeId] <col1>[number]:[AcceptedAnswerId] <col2>[number]:[ParentId] <col3>[number]:[CreationDate] <col4>[time]:[DeletionDate] <col5>[time]:[Score] <col6>[number]:[ViewCount] <col7>[number]:[Body] <col8>[text]:[OwnerUserId] <col9>[number]:[OwnerDisplayName] <col10>[text]:[LastEditorUserId] <col11>[number]:[LastEditorDisplayName] <col12>[text]:[LastEditDate] <col13>[time]:[LastActivityDate] <col14>[time]:[Title] <col15>[text]:[Tags] <col16>[text]:[AnswerCount] <col17>[number]:[CommentCount] <col18>[number]:[FavoriteCount] <col19>[number]:[ClosedDate] <col20>[time]:[CommunityOwnedDate] <col21>[time]:[ContentLicense] } <table3>[Comments] { <col0>[number]:[PostId] <col1>[number]:[Score] <col2>[number]:[Text] <col3>[text]:[CreationDate] <col4>[time]:[UserDisplayName] <col5>[text]:[UserId] <col6>[number]:[ContentLicense] } <table4>[PostHistoryTypes] { <col0>[number]:[text] } <table5>[ReviewRejectionReasons] { <col0>[number]:[text] <col1>[Description]:[text] <col2>[PostTypeId]:[number] } <table6>[PendingFlags] { <col0>[number]:[FlagTypeId] <col1>[number]:[PostId] <col2>[number]:[CreationDate] <col3>[time]:[CloseReasonTypeId] <col4>[number]:[CloseAsOffTopicReasonTypeId] <col5>[number]:[DuplicateOfQuestionId] <col6>[number]:[BelongsOnBaseHostAddress] } <table7>[ReviewTaskTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table8>[SuggestedEditVotes] { <col0>[number]:[SuggestedEditId] <col1>[number]:[UserId] <col2>[number]:[VoteTypeId] <col3>[number]:[CreationDate] <col4>[time]:[TargetUserId] <col5>[number]:[TargetRepChange] } <table9>[PostHistory] { <col0>[number]:[PostHistoryTypeId] <col1>[number]:[PostId] <col2>[number]:[RevisionGUID] <col3>[CreationDate]:[time] <col4>[UserId]:[number] <col5>[UserDisplayName]:[text] <col6>[Comment]:[text] <col7>[Text]:[text] <col8>[ContentLicense]:[text] } <table10>[TagSynonyms] { <col0>[number]:[SourceTagName] <col1>[text]:[TargetTagName] <col2>[text]:[CreationDate] <col3>[time]:[OwnerUserId] <col4>[number]:[AutoRenameCount] <col5>[number]:[LastAutoRename] <col6>[time]:[Score] <col7>[number]:[ApprovedByUserId] <col8>[number]:[ApprovalDate] } <table11>[FlagTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table12>[Posts] { <col0>[number]:[PostTypeId] <col1>[number]:[AcceptedAnswerId] <col2>[number]:[ParentId] <col3>[number]:[CreationDate] <col4>[time]:[DeletionDate] <col5>[time]:[Score] <col6>[number]:[ViewCount] <col7>[number]:[Body] <col8>[text]:[OwnerUserId] <col9>[number]:[OwnerDisplayName] <col10>[text]:[LastEditorUserId] <col11>[number]:[LastEditorDisplayName] <col12>[text]:[LastEditDate] <col13>[time]:[LastActivityDate] <col14>[time]:[Title] <col15>[text]:[Tags] <col16>[text]:[AnswerCount] <col17>[number]:[CommentCount] <col18>[number]:[FavoriteCount] <col19>[number]:[ClosedDate] <col20>[time]:[CommunityOwnedDate] <col21>[time]:[ContentLicense] } <table13>[Votes] { <col0>[number]:[PostId] <col1>[number]:[VoteTypeId] <col2>[number]:[UserId] <col3>[number]:[CreationDate] <col4>[time]:[BountyAmount] } <table14>[PostTypes] { <col0>[number]:[text] } <table15>[ReviewTaskResults] { <col0>[number]:[ReviewTaskId] <col1>[number]:[ReviewTaskResultTypeId] <col2>[number]:[CreationDate] <col3>[time]:[RejectionReasonId] <col4>[number]:[Comment] } <table16>[ReviewTasks] { <col0>[number]:[ReviewTaskTypeId] <col1>[number]:[CreationDate] <col2>[time]:[DeletionDate] <col3>[time]:[ReviewTaskStateId] <col4>[number]:[PostId] <col5>[number]:[SuggestedEditId] <col6>[number]:[CompletedByReviewTaskId] } <table17>[ReviewTaskResultTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table18>[SuggestedEdits] { <col0>[number]:[PostId] <col1>[number]:[CreationDate] <col2>[time]:[ApprovalDate] <col3>[time]:[RejectionDate] <col4>[time]:[OwnerUserId] <col5>[number]:[Comment] <col6>[text]:[Text] <col7>[text]:[Title] <col8>[text]:[Tags] <col9>[text]:[RevisionGUID] } <table19>[Badges] { <col0>[number]:[UserId] <col1>[number]:[text] <col2>[Date]:[time] <col3>[Class]:[number] <col4>[TagBased]:[boolean] } <table20>[PostLinks] { <col0>[number]:[CreationDate] <col1>[time]:[PostId] <col2>[number]:[RelatedPostId] <col3>[number]:[LinkTypeId] } <table21>[VoteTypes] { <col0>[number]:[text] } <table22>[PostTags] { <col0>[PostId]:[number] <col1>[TagId]:[number] } <table23>[ReviewTaskStates] { <col0>[number]:[text] <col1>[Description]:[text] } <table24>[CloseAsOffTopicReasonTypes] { <col0>[number]:[IsUniversal] <col1>[boolean]:[InputTitle] <col2>[text]:[MarkdownInputGuidance] <col3>[text]:[MarkdownPostOwnerGuidance] <col4>[text]:[MarkdownPrivilegedUserGuidance] <col5>[text]:[MarkdownConcensusDescription] <col6>[text]:[CreationDate] <col7>[time]:[CreationModeratorId] <col8>[number]:[ApprovalDate] <col9>[time]:[ApprovalModeratorId] <col10>[number]:[DeactivationDate] <col11>[time]:[DeactivationModeratorId] } <table25>[Users] { <col0>[number]:[Reputation] <col1>[number]:[CreationDate] <col2>[time]:[DisplayName] <col3>[text]:[LastAccessDate] <col4>[time]:[WebsiteUrl] <col5>[text]:[Location] <col6>[text]:[AboutMe] <col7>[text]:[Views] <col8>[number]:[UpVotes] <col9>[number]:[DownVotes] <col10>[number]:[ProfileImageUrl] <col11>[text]:[EmailHash] <col12>[text]:[AccountId] } <table26>[CloseReasonTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table27>[PostFeedback] { <col0>[number]:[PostId] <col1>[number]:[IsAnonymous] <col2>[boolean]:[VoteTypeId] <col3>[number]:[CreationDate] } <table28>[Tags] { <col0>[number]:[TagName] <col1>[text]:[Count] <col2>[number]:[ExcerptPostId] <col3>[number]:[WikiPostId] }
WITH Closed`<table12>`Votes AS ( SELECT p.Id AS "Post Link", SUM( CASE WHEN a.Score > 0 THEN 1 ELSE 0 END ) AS Up, SUM( CASE WHEN a.Score < 0 THEN 1 ELSE 0 END ) AS Down, SUM( CASE WHEN a.Score = 0 THEN 1 ELSE 0 END ) AS Neutral FROM `<table12>` AS p INNER JOIN `<table12>` AS a ON a.ParentId = p.Id WHERE NOT p.ClosedDate IS NULL GROUP BY p.Id ) SELECT COUNT( * ) AS Questions, SUM( CASE WHEN v.Up > 0 THEN 1 ELSE 0 END ) AS Up, SUM( CASE WHEN v.Down > 0 THEN 1 ELSE 0 END ) AS Down, SUM( CASE WHEN v.Neutral > 0 THEN 1 ELSE 0 END ) AS Neutral FROM Closed`<table12>`Votes AS v
Closed posts by votes on answers. This is used to see how many closed questions have up, down and neutral voted answers. A single post can be in all three categories if there is an answer which is positive, negative and neutral.
<table0>[table_name_75] { <col0>[title]:[VARCHAR] <col1>[production_code]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "k1504"
What is the title of the episode with a production code of K1504?
<table0>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table1>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table2>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table3>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table4>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] }
SELECT COUNT( DISTINCT `<table3>`.subject_id ) FROM `<table3>` INNER JOIN lab ON `<table3>`.hadm_id = lab.hadm_id WHERE `<table3>`.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND lab.label = "Lymphs"
how many american indian/alaska native patients had lab test named lymphs?
<table0>[weather] { <col0>[date]:[text] <col1>[max_temperature_f]:[number] <col2>[mean_temperature_f]:[number] <col3>[min_temperature_f]:[number] <col4>[max_dew_point_f]:[number] <col5>[mean_dew_point_f]:[number] <col6>[min_dew_point_f]:[number] <col7>[max_humidity]:[number] <col8>[mean_humidity]:[number] <col9>[min_humidity]:[number] <col10>[max_sea_level_pressure_inches]:[number] <col11>[mean_sea_level_pressure_inches]:[number] <col12>[min_sea_level_pressure_inches]:[number] <col13>[max_visibility_miles]:[number] <col14>[mean_visibility_miles]:[number] <col15>[min_visibility_miles]:[number] <col16>[max_wind_speed_mph]:[number] <col17>[mean_wind_speed_mph]:[number] <col18>[max_gust_speed_mph]:[number] <col19>[precipitation_inches]:[number] <col20>[cloud_cover]:[number] <col21>[events]:[text] <col22>[wind_dir_degrees]:[number] <col23>[zip_code]:[number] } <table1>[status] { <col0>[station_id]:[number] <col1>[bikes_available]:[number] <col2>[docks_available]:[number] <col3>[time]:[text] } <table2>[station] { <col0>[number]:[name] <col1>[text]:[lat] <col2>[number]:[long] <col3>[number]:[dock_count] <col4>[number]:[city] <col5>[text]:[installation_date] } <table3>[trip] { <col0>[number]:[duration] <col1>[number]:[start_date] <col2>[text]:[start_station_name] <col3>[text]:[start_station_id] <col4>[number]:[end_date] <col5>[text]:[end_station_name] <col6>[text]:[end_station_id] <col7>[number]:[bike_id] <col8>[number]:[subscription_type] <col9>[text]:[zip_code] }
SELECT name FROM `<table2>` WHERE lat < 37.5
What are the names of all stations with a latitude smaller than 37.5?
<table0>[table_39255] { <col0>[Rank]:[text] <col1>[Nation]:[text] <col2>[Gold]:[real] <col3>[Silver]:[real] <col4>[Bronze]:[real] <col5>[Total]:[real] }
SELECT "Bronze" FROM `<table0>` WHERE "Nation" = 'bulgaria'
How many bronze medals did Bulgaria receive?
<table0>[smoothie_bar] { <col0>[smoothie_name]:[TEXT] <col1>[protein]:[INTEGER] }
SELECT SUM( protein ) FROM smoothie_bar;
What is the total protein content in the smoothie_bar table?
<table0>[teams] { <col0>[team_id]:[INT] <col1>[team_name]:[VARCHAR] <col2>[100]:[INSERT] } <table1>[matches] { <col0>[match_id]:[INT] <col1>[team_home_id]:[INT] <col2>[team_away_id]:[INT] <col3>[tickets_sold]:[INT] }
SELECT team_name, home_sales - away_sales as diff FROM ( SELECT team_home_id, SUM( `<col3>` ) as home_sales FROM `<table1>` GROUP BY `<col1>` ) home_sales JOIN ( SELECT team_away_id, SUM( `<col3>` ) as away_sales FROM `<table1>` GROUP BY `<col2>` ) away_sales JOIN teams t ON home_sales.team_home_id = t.team_id OR away_sales.team_away_id = t.team_id ORDER BY diff DESC;
Find the teams with the greatest difference in ticket sales between home and away matches.
<table0>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table1>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table2>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table3>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table4>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] }
SELECT COUNT( DISTINCT `<table4>`.subject_id ) FROM `<table4>` INNER JOIN diagnoses ON `<table4>`.hadm_id = diagnoses.hadm_id WHERE `<table4>`.admityear < "2165" AND diagnoses.icd9_code = "V1083"
how many patients were admitted before the year 2165 with the diagnosis icd9 code v1083?
<table0>[list] { <col0>[lastname]:[text] <col1>[firstname]:[text] <col2>[grade]:[number] <col3>[classroom]:[number] } <table1>[teachers] { <col0>[lastname]:[text] <col1>[firstname]:[text] <col2>[classroom]:[number] }
SELECT `<col3>` FROM `<table0>` GROUP BY `<col3>` ORDER BY COUNT( * ) DESC LIMIT 1
Find the classroom that the most students use.
<table0>[table_17548] { <col0>[series]:[real] <col1>[Title]:[text] <col2>[Directed]:[text] <col3>[Written]:[text] <col4>[Original]:[air] <col5>[date]:[text] <col6>[Production]:[code] }
SELECT "Written by" FROM `<table0>` WHERE "Title" = 'The Wedding Anniversary'
Who wrote the episode titled 'the wedding anniversary'?
<table0>[Faculty_Participates_in] { <col0>[FacID]:[INTEGER] <col1>[actid]:[INTEGER] } <table1>[Faculty] { <col0>[FacID]:[INTEGER] <col1>[Lname]:[VARCHAR] <col2>[Fname]:[VARCHAR] <col3>[Rank]:[VARCHAR] <col4>[Sex]:[VARCHAR] <col5>[Phone]:[INTEGER] <col6>[Room]:[VARCHAR] <col7>[Building]:[VARCHAR] } <table2>[Participates_in] { <col0>[stuid]:[INTEGER] <col1>[actid]:[INTEGER] } <table3>[Activity] { <col0>[actid]:[INTEGER] <col1>[activity_name]:[varchar] } <table4>[Student] { <col0>[StuID]:[INTEGER] <col1>[LName]:[VARCHAR] <col2>[Fname]:[VARCHAR] <col3>[Age]:[INTEGER] <col4>[Sex]:[VARCHAR] <col5>[Major]:[INTEGER] <col6>[Advisor]:[INTEGER] <col7>[city_code]:[VARCHAR] }
SELECT Sex, COUNT( * ) FROM `<table1>` WHERE `<col3>` = "AsstProf" GROUP BY `<col4>` ORDER BY `<col4>` DESC
Display a bar chart for how many male and female assistant professors do we have?, list by the names in desc.
<table0>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table1>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table2>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table3>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table4>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] }
SELECT `<table1>`.days_stay, `<table1>`.diagnosis FROM `<table1>` WHERE `<table1>`.subject_id = "8440"
tell me the primary disease and days for which patient with patient id 8440 was hospitalized.
<table0>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table1>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table2>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table3>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table4>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] }
SELECT COUNT( DISTINCT `<table0>`.subject_id ) FROM `<table0>` INNER JOIN diagnoses ON `<table0>`.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON `<table0>`.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Knee joint replacement" AND prescriptions.route = "DIALYS"
how many patients on dialys route of drug administration have a diagnoses of knee joint replacement?
<table0>[table_49685] { <col0>[Rank]:[text] <col1>[Nation]:[text] <col2>[Gold]:[real] <col3>[Silver]:[real] <col4>[Bronze]:[real] <col5>[Total]:[real] }
SELECT "Nation" FROM `<table0>` WHERE "Bronze" = '1' AND "Gold" > '0' AND "Rank" = '2'
What is Nation, when Bronze is 1, when Gold is greater than 0, and when Rank is 2?
<table0>[menu] { <col0>[INT]:[PRIMARY] <col1>[KEY]:[name] <col2>[VARCHAR]:[100] <col3>[category]:[VARCHAR] <col4>[price]:[DECIMAL] }
SELECT name, `<col4>` FROM `<table0>` WHERE `<col3>` = 'Salad' OR `<col3>` = 'Pasta' AND `<col4>` = ( SELECT MAX( `<col4>` ) FROM `<table0>` WHERE `<col3>` = 'Salad' OR `<col3>` = 'Pasta' );
What is the most expensive vegetarian menu item?
<table0>[table_name_79] { <col0>[goals_scored]:[INTEGER] <col1>[points]:[VARCHAR] <col2>[wins]:[VARCHAR] }
SELECT SUM( `<col0>` ) FROM `<table0>` WHERE `<col1>` > 26 AND `<col2>` > 11
Which Goals scored has Points larger than 26 and Wins larger than 11?
<table0>[Services] { <col0>[Service_ID]:[INTEGER] <col1>[Service_name]:[VARCHAR] } <table1>[Customers_Policies] { <col0>[Customer_ID]:[INTEGER] <col1>[Policy_ID]:[INTEGER] <col2>[Date_Opened]:[DATE] <col3>[Date_Closed]:[DATE] } <table2>[First_Notification_of_Loss] { <col0>[FNOL_ID]:[INTEGER] <col1>[Customer_ID]:[INTEGER] <col2>[Policy_ID]:[INTEGER] <col3>[Service_ID]:[INTEGER] } <table3>[Customers] { <col0>[Customer_ID]:[INTEGER] <col1>[Customer_name]:[VARCHAR] } <table4>[Claims] { <col0>[Claim_ID]:[INTEGER] <col1>[FNOL_ID]:[INTEGER] <col2>[Effective_Date]:[DATE] } <table5>[Settlements] { <col0>[Settlement_ID]:[INTEGER] <col1>[Claim_ID]:[INTEGER] <col2>[Effective_Date]:[DATE] <col3>[Settlement_Amount]:[REAL] } <table6>[Available_Policies] { <col0>[Policy_ID]:[INTEGER] <col1>[policy_type_code]:[CHAR] <col2>[Customer_Phone]:[VARCHAR] }
SELECT Customer_name, `<col0>` FROM `<table3>` ORDER BY `<col0>`
List all the customers in increasing order of IDs by a bar chart.
<table0>[time_interval] { <col0>[period]:[text] <col1>[begin_time]:[int] <col2>[end_time]:[int] } <table1>[code_description] { <col0>[code]:[varchar] <col1>[description]:[text] } <table2>[fare_basis] { <col0>[fare_basis_code]:[text] <col1>[booking_class]:[text] <col2>[class_type]:[text] <col3>[premium]:[text] <col4>[economy]:[text] <col5>[discounted]:[text] <col6>[night]:[text] <col7>[season]:[text] <col8>[basis_days]:[text] } <table3>[compartment_class] { <col0>[compartment]:[varchar] <col1>[class_type]:[varchar] } <table4>[dual_carrier] { <col0>[main_airline]:[varchar] <col1>[low_flight_number]:[int] <col2>[high_flight_number]:[int] <col3>[dual_airline]:[varchar] <col4>[service_name]:[text] } <table5>[month] { <col0>[month_number]:[int] <col1>[month_name]:[text] } <table6>[flight_fare] { <col0>[flight_id]:[int] <col1>[fare_id]:[int] } <table7>[restriction] { <col0>[restriction_code]:[text] <col1>[advance_purchase]:[int] <col2>[stopovers]:[text] <col3>[saturday_stay_required]:[text] <col4>[minimum_stay]:[int] <col5>[maximum_stay]:[int] <col6>[application]:[text] <col7>[no_discounts]:[text] } <table8>[airline] { <col0>[airline_code]:[varchar] <col1>[airline_name]:[text] <col2>[note]:[text] } <table9>[food_service] { <col0>[meal_code]:[text] <col1>[meal_number]:[int] <col2>[compartment]:[text] <col3>[meal_description]:[varchar] } <table10>[ground_service] { <col0>[city_code]:[text] <col1>[airport_code]:[text] <col2>[transport_type]:[text] <col3>[ground_fare]:[int] } <table11>[city] { <col0>[city_code]:[varchar] <col1>[city_name]:[varchar] <col2>[state_code]:[varchar] <col3>[country_name]:[varchar] <col4>[time_zone_code]:[varchar] } <table12>[flight_stop] { <col0>[flight_id]:[int] <col1>[stop_number]:[int] <col2>[stop_days]:[text] <col3>[stop_airport]:[text] <col4>[arrival_time]:[int] <col5>[arrival_airline]:[text] <col6>[arrival_flight_number]:[int] <col7>[departure_time]:[int] <col8>[departure_airline]:[text] <col9>[departure_flight_number]:[int] <col10>[stop_time]:[int] } <table13>[equipment_sequence] { <col0>[aircraft_code_sequence]:[varchar] <col1>[aircraft_code]:[varchar] } <table14>[flight] { <col0>[aircraft_code_sequence]:[text] <col1>[airline_code]:[varchar] } <table15>[date_day] { <col0>[month_number]:[int] <col1>[day_number]:[int] <col2>[year]:[int] <col3>[day_name]:[varchar] } <table16>[state] { <col0>[state_code]:[text] <col1>[state_name]:[text] <col2>[country_name]:[text] } <table17>[time_zone] { <col0>[time_zone_code]:[text] <col1>[time_zone_name]:[text] <col2>[hours_from_gmt]:[int] } <table18>[class_of_service] { <col0>[booking_class]:[varchar] <col1>[rank]:[int] <col2>[class_description]:[text] } <table19>[days] { <col0>[days_code]:[varchar] <col1>[day_name]:[varchar] } <table20>[airport_service] { <col0>[city_code]:[varchar] <col1>[airport_code]:[varchar] <col2>[miles_distant]:[int] <col3>[direction]:[varchar] <col4>[minutes_distant]:[int] } <table21>[aircraft] { <col0>[aircraft_code]:[varchar] <col1>[aircraft_description]:[varchar] <col2>[manufacturer]:[varchar] <col3>[basic_type]:[varchar] <col4>[engines]:[int] <col5>[propulsion]:[varchar] <col6>[wide_body]:[varchar] <col7>[wing_span]:[int] <col8>[length]:[int] <col9>[weight]:[int] <col10>[capacity]:[int] <col11>[pay_load]:[int] <col12>[cruising_speed]:[int] <col13>[range_miles]:[int] <col14>[pressurized]:[varchar] } <table22>[fare] { <col0>[fare_id]:[int] <col1>[from_airport]:[varchar] <col2>[to_airport]:[varchar] <col3>[fare_basis_code]:[text] <col4>[fare_airline]:[text] <col5>[restriction_code]:[text] <col6>[one_direction_cost]:[int] <col7>[round_trip_cost]:[int] <col8>[round_trip_required]:[varchar] } <table23>[airport] { <col0>[airport_code]:[varchar] <col1>[airport_name]:[text] <col2>[airport_location]:[text] <col3>[state_code]:[varchar] <col4>[country_name]:[varchar] <col5>[time_zone_code]:[varchar] <col6>[minimum_connect_time]:[int] } <table24>[flight_leg] { <col0>[flight_id]:[int] <col1>[leg_number]:[int] <col2>[leg_flight]:[int] }
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city AS CITY_0, city AS CITY_1, ground_service WHERE airport.airport_code = airport_service.airport_code AND CITY_0.city_code = airport_service.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_name = 'ATLANTA' AND ground_service.airport_code = airport.airport_code AND ground_service.city_code = CITY_1.city_code
what ground transportation is there from the airport in ATLANTA to downtown
<table0>[table_name_75] { <col0>[publication]:[VARCHAR] <col1>[country]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "uk"
Which publication happened in the UK?
<table0>[table_203_102] { <col0>[number]:[event] <col1>[text]:[performance] <col2>[text]:[athlete] <col3>[text]:[nation] <col4>[text]:[place] <col5>[text]:[date] }
SELECT "athlete" FROM `<table0>` WHERE "athlete" IN ( 'usain bolt', 'haile gebrselassie' ) GROUP BY "athlete" ORDER BY COUNT( * ) DESC LIMIT 1
in 2008 in track and field events who broke more world records , usain bolt or haile gebrselassie ?
<table0>[Vessels] { <col0>[vessel_name]:[VARCHAR] <col1>[255]:[INSERT] } <table1>[Maintenance] { <col0>[vessel_name]:[VARCHAR] <col1>[255]:[maintenance_start_date] <col2>[DATE]:[maintenance_end_date] <col3>[DATE]:[INSERT] }
SELECT SUM( DATEDIFF( hour, maintenance_start_date, maintenance_end_date ) ) FROM `<table1>` WHERE `<col0>` = 'VesselI' AND maintenance_start_date BETWEEN '2020-07-01' AND '2020-09-30';
Calculate the total downtime (in hours) for 'VesselI' during its maintenance periods in Q3 of 2020.
<table0>[time_interval] { <col0>[period]:[text] <col1>[begin_time]:[int] <col2>[end_time]:[int] } <table1>[compartment_class] { <col0>[compartment]:[varchar] <col1>[class_type]:[varchar] } <table2>[state] { <col0>[state_code]:[text] <col1>[state_name]:[text] <col2>[country_name]:[text] } <table3>[flight] { <col0>[aircraft_code_sequence]:[text] <col1>[airline_code]:[varchar] } <table4>[month] { <col0>[month_number]:[int] <col1>[month_name]:[text] } <table5>[airport_service] { <col0>[city_code]:[varchar] <col1>[airport_code]:[varchar] <col2>[miles_distant]:[int] <col3>[direction]:[varchar] <col4>[minutes_distant]:[int] } <table6>[equipment_sequence] { <col0>[aircraft_code_sequence]:[varchar] <col1>[aircraft_code]:[varchar] } <table7>[food_service] { <col0>[meal_code]:[text] <col1>[meal_number]:[int] <col2>[compartment]:[text] <col3>[meal_description]:[varchar] } <table8>[flight_stop] { <col0>[flight_id]:[int] <col1>[stop_number]:[int] <col2>[stop_days]:[text] <col3>[stop_airport]:[text] <col4>[arrival_time]:[int] <col5>[arrival_airline]:[text] <col6>[arrival_flight_number]:[int] <col7>[departure_time]:[int] <col8>[departure_airline]:[text] <col9>[departure_flight_number]:[int] <col10>[stop_time]:[int] } <table9>[airline] { <col0>[airline_code]:[varchar] <col1>[airline_name]:[text] <col2>[note]:[text] } <table10>[date_day] { <col0>[month_number]:[int] <col1>[day_number]:[int] <col2>[year]:[int] <col3>[day_name]:[varchar] } <table11>[flight_leg] { <col0>[flight_id]:[int] <col1>[leg_number]:[int] <col2>[leg_flight]:[int] } <table12>[fare_basis] { <col0>[fare_basis_code]:[text] <col1>[booking_class]:[text] <col2>[class_type]:[text] <col3>[premium]:[text] <col4>[economy]:[text] <col5>[discounted]:[text] <col6>[night]:[text] <col7>[season]:[text] <col8>[basis_days]:[text] } <table13>[class_of_service] { <col0>[booking_class]:[varchar] <col1>[rank]:[int] <col2>[class_description]:[text] } <table14>[fare] { <col0>[fare_id]:[int] <col1>[from_airport]:[varchar] <col2>[to_airport]:[varchar] <col3>[fare_basis_code]:[text] <col4>[fare_airline]:[text] <col5>[restriction_code]:[text] <col6>[one_direction_cost]:[int] <col7>[round_trip_cost]:[int] <col8>[round_trip_required]:[varchar] } <table15>[city] { <col0>[city_code]:[varchar] <col1>[city_name]:[varchar] <col2>[state_code]:[varchar] <col3>[country_name]:[varchar] <col4>[time_zone_code]:[varchar] } <table16>[time_zone] { <col0>[time_zone_code]:[text] <col1>[time_zone_name]:[text] <col2>[hours_from_gmt]:[int] } <table17>[code_description] { <col0>[code]:[varchar] <col1>[description]:[text] } <table18>[aircraft] { <col0>[aircraft_code]:[varchar] <col1>[aircraft_description]:[varchar] <col2>[manufacturer]:[varchar] <col3>[basic_type]:[varchar] <col4>[engines]:[int] <col5>[propulsion]:[varchar] <col6>[wide_body]:[varchar] <col7>[wing_span]:[int] <col8>[length]:[int] <col9>[weight]:[int] <col10>[capacity]:[int] <col11>[pay_load]:[int] <col12>[cruising_speed]:[int] <col13>[range_miles]:[int] <col14>[pressurized]:[varchar] } <table19>[airport] { <col0>[airport_code]:[varchar] <col1>[airport_name]:[text] <col2>[airport_location]:[text] <col3>[state_code]:[varchar] <col4>[country_name]:[varchar] <col5>[time_zone_code]:[varchar] <col6>[minimum_connect_time]:[int] } <table20>[dual_carrier] { <col0>[main_airline]:[varchar] <col1>[low_flight_number]:[int] <col2>[high_flight_number]:[int] <col3>[dual_airline]:[varchar] <col4>[service_name]:[text] } <table21>[ground_service] { <col0>[city_code]:[text] <col1>[airport_code]:[text] <col2>[transport_type]:[text] <col3>[ground_fare]:[int] } <table22>[flight_fare] { <col0>[flight_id]:[int] <col1>[fare_id]:[int] } <table23>[restriction] { <col0>[restriction_code]:[text] <col1>[advance_purchase]:[int] <col2>[stopovers]:[text] <col3>[saturday_stay_required]:[text] <col4>[minimum_stay]:[int] <col5>[maximum_stay]:[int] <col6>[application]:[text] <col7>[no_discounts]:[text] } <table24>[days] { <col0>[days_code]:[varchar] <col1>[day_name]:[varchar] }
SELECT DISTINCT flight.flight_id FROM `<table5>` AS AIRPORT_SERVICE_0, `<table5>` AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE ( CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code ) AND fare.round_trip_cost = ( SELECT MIN( FAREalias1.round_trip_cost ) FROM `<table5>` AS AIRPORT_SERVICEalias2, `<table5>` AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'ATLANTA' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'PITTSBURGH' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code ) AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id
what is the cheapest round trip flight from ATLANTA to PITTSBURGH
<table0>[table_name_69] { <col0>[position]:[INTEGER] <col1>[best_3_year_period]:[VARCHAR] }
SELECT MAX( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "petrosian"
Which Position has a best 3-year period of petrosian?
<table0>[PostLinks] { <col0>[number]:[CreationDate] <col1>[time]:[PostId] <col2>[number]:[RelatedPostId] <col3>[number]:[LinkTypeId] } <table1>[PostNoticeTypes] { <col0>[number]:[ClassId] <col1>[number]:[text] <col2>[Body]:[text] <col3>[IsHidden]:[boolean] <col4>[Predefined]:[boolean] <col5>[PostNoticeDurationId]:[number] } <table2>[Tags] { <col0>[number]:[TagName] <col1>[text]:[Count] <col2>[number]:[ExcerptPostId] <col3>[number]:[WikiPostId] } <table3>[PostTags] { <col0>[PostId]:[number] <col1>[TagId]:[number] } <table4>[CloseReasonTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table5>[PendingFlags] { <col0>[number]:[FlagTypeId] <col1>[number]:[PostId] <col2>[number]:[CreationDate] <col3>[time]:[CloseReasonTypeId] <col4>[number]:[CloseAsOffTopicReasonTypeId] <col5>[number]:[DuplicateOfQuestionId] <col6>[number]:[BelongsOnBaseHostAddress] } <table6>[Users] { <col0>[number]:[Reputation] <col1>[number]:[CreationDate] <col2>[time]:[DisplayName] <col3>[text]:[LastAccessDate] <col4>[time]:[WebsiteUrl] <col5>[text]:[Location] <col6>[text]:[AboutMe] <col7>[text]:[Views] <col8>[number]:[UpVotes] <col9>[number]:[DownVotes] <col10>[number]:[ProfileImageUrl] <col11>[text]:[EmailHash] <col12>[text]:[AccountId] } <table7>[PostNotices] { <col0>[number]:[PostId] <col1>[number]:[PostNoticeTypeId] <col2>[number]:[CreationDate] <col3>[time]:[DeletionDate] <col4>[time]:[ExpiryDate] <col5>[time]:[Body] <col6>[text]:[OwnerUserId] <col7>[number]:[DeletionUserId] } <table8>[PostHistoryTypes] { <col0>[number]:[text] } <table9>[ReviewTaskResults] { <col0>[number]:[ReviewTaskId] <col1>[number]:[ReviewTaskResultTypeId] <col2>[number]:[CreationDate] <col3>[time]:[RejectionReasonId] <col4>[number]:[Comment] } <table10>[Posts] { <col0>[number]:[PostTypeId] <col1>[number]:[AcceptedAnswerId] <col2>[number]:[ParentId] <col3>[number]:[CreationDate] <col4>[time]:[DeletionDate] <col5>[time]:[Score] <col6>[number]:[ViewCount] <col7>[number]:[Body] <col8>[text]:[OwnerUserId] <col9>[number]:[OwnerDisplayName] <col10>[text]:[LastEditorUserId] <col11>[number]:[LastEditorDisplayName] <col12>[text]:[LastEditDate] <col13>[time]:[LastActivityDate] <col14>[time]:[Title] <col15>[text]:[Tags] <col16>[text]:[AnswerCount] <col17>[number]:[CommentCount] <col18>[number]:[FavoriteCount] <col19>[number]:[ClosedDate] <col20>[time]:[CommunityOwnedDate] <col21>[time]:[ContentLicense] } <table11>[ReviewRejectionReasons] { <col0>[number]:[text] <col1>[Description]:[text] <col2>[PostTypeId]:[number] } <table12>[PostHistory] { <col0>[number]:[PostHistoryTypeId] <col1>[number]:[PostId] <col2>[number]:[RevisionGUID] <col3>[CreationDate]:[time] <col4>[UserId]:[number] <col5>[UserDisplayName]:[text] <col6>[Comment]:[text] <col7>[Text]:[text] <col8>[ContentLicense]:[text] } <table13>[PostsWithDeleted] { <col0>[number]:[PostTypeId] <col1>[number]:[AcceptedAnswerId] <col2>[number]:[ParentId] <col3>[number]:[CreationDate] <col4>[time]:[DeletionDate] <col5>[time]:[Score] <col6>[number]:[ViewCount] <col7>[number]:[Body] <col8>[text]:[OwnerUserId] <col9>[number]:[OwnerDisplayName] <col10>[text]:[LastEditorUserId] <col11>[number]:[LastEditorDisplayName] <col12>[text]:[LastEditDate] <col13>[time]:[LastActivityDate] <col14>[time]:[Title] <col15>[text]:[Tags] <col16>[text]:[AnswerCount] <col17>[number]:[CommentCount] <col18>[number]:[FavoriteCount] <col19>[number]:[ClosedDate] <col20>[time]:[CommunityOwnedDate] <col21>[time]:[ContentLicense] } <table14>[ReviewTaskResultTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table15>[Badges] { <col0>[number]:[UserId] <col1>[number]:[text] <col2>[Date]:[time] <col3>[Class]:[number] <col4>[TagBased]:[boolean] } <table16>[PostTypes] { <col0>[number]:[text] } <table17>[ReviewTasks] { <col0>[number]:[ReviewTaskTypeId] <col1>[number]:[CreationDate] <col2>[time]:[DeletionDate] <col3>[time]:[ReviewTaskStateId] <col4>[number]:[PostId] <col5>[number]:[SuggestedEditId] <col6>[number]:[CompletedByReviewTaskId] } <table18>[FlagTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table19>[ReviewTaskStates] { <col0>[number]:[text] <col1>[Description]:[text] } <table20>[CloseAsOffTopicReasonTypes] { <col0>[number]:[IsUniversal] <col1>[boolean]:[InputTitle] <col2>[text]:[MarkdownInputGuidance] <col3>[text]:[MarkdownPostOwnerGuidance] <col4>[text]:[MarkdownPrivilegedUserGuidance] <col5>[text]:[MarkdownConcensusDescription] <col6>[text]:[CreationDate] <col7>[time]:[CreationModeratorId] <col8>[number]:[ApprovalDate] <col9>[time]:[ApprovalModeratorId] <col10>[number]:[DeactivationDate] <col11>[time]:[DeactivationModeratorId] } <table21>[ReviewTaskTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table22>[SuggestedEdits] { <col0>[number]:[PostId] <col1>[number]:[CreationDate] <col2>[time]:[ApprovalDate] <col3>[time]:[RejectionDate] <col4>[time]:[OwnerUserId] <col5>[number]:[Comment] <col6>[text]:[Text] <col7>[text]:[Title] <col8>[text]:[Tags] <col9>[text]:[RevisionGUID] } <table23>[VoteTypes] { <col0>[number]:[text] } <table24>[TagSynonyms] { <col0>[number]:[SourceTagName] <col1>[text]:[TargetTagName] <col2>[text]:[CreationDate] <col3>[time]:[OwnerUserId] <col4>[number]:[AutoRenameCount] <col5>[number]:[LastAutoRename] <col6>[time]:[Score] <col7>[number]:[ApprovedByUserId] <col8>[number]:[ApprovalDate] } <table25>[SuggestedEditVotes] { <col0>[number]:[SuggestedEditId] <col1>[number]:[UserId] <col2>[number]:[VoteTypeId] <col3>[number]:[CreationDate] <col4>[time]:[TargetUserId] <col5>[number]:[TargetRepChange] } <table26>[Comments] { <col0>[number]:[PostId] <col1>[number]:[Score] <col2>[number]:[Text] <col3>[text]:[CreationDate] <col4>[time]:[UserDisplayName] <col5>[text]:[UserId] <col6>[number]:[ContentLicense] } <table27>[Votes] { <col0>[number]:[PostId] <col1>[number]:[VoteTypeId] <col2>[number]:[UserId] <col3>[number]:[CreationDate] <col4>[time]:[BountyAmount] } <table28>[PostFeedback] { <col0>[number]:[PostId] <col1>[number]:[IsAnonymous] <col2>[boolean]:[VoteTypeId] <col3>[number]:[CreationDate] }
SELECT COUNT( Questions.Id ) AS Questions FROM `<table10>` AS Questions INNER JOIN PostTags ON Questions.Id = PostTags.PostId INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Questions.PostTypeId = 1 AND Tags.TagName = 'microsoft-cognitive' OR Tags.TagName = 'azure-cognitive-services'
Number of Questions for a given tag.
<table0>[table_name_69] { <col0>[pleasure]:[VARCHAR] <col1>[psychological_dependence]:[VARCHAR] <col2>[drug]:[VARCHAR] }
SELECT COUNT( `<col0>` ) FROM `<table0>` WHERE `<col1>` > 1.9 AND `<col2>` = "benzodiazepines"
What is the total number of Pleasure(s), when Psychological Dependence is greater than 1.9, and when Drug is "Benzodiazepines"?
<table0>[microlab] { <col0>[microlabid]:[number] <col1>[patientunitstayid]:[number] <col2>[culturesite]:[text] <col3>[organism]:[text] <col4>[culturetakentime]:[time] } <table1>[intakeoutput] { <col0>[intakeoutputid]:[number] <col1>[patientunitstayid]:[number] <col2>[cellpath]:[text] <col3>[celllabel]:[text] <col4>[cellvaluenumeric]:[number] <col5>[intakeoutputtime]:[time] } <table2>[medication] { <col0>[medicationid]:[number] <col1>[patientunitstayid]:[number] <col2>[drugname]:[text] <col3>[dosage]:[text] <col4>[routeadmin]:[text] <col5>[drugstarttime]:[time] <col6>[drugstoptime]:[time] } <table3>[allergy] { <col0>[allergyid]:[number] <col1>[patientunitstayid]:[number] <col2>[drugname]:[text] <col3>[allergyname]:[text] <col4>[allergytime]:[time] } <table4>[vitalperiodic] { <col0>[vitalperiodicid]:[number] <col1>[patientunitstayid]:[number] <col2>[temperature]:[number] <col3>[sao2]:[number] <col4>[heartrate]:[number] <col5>[respiration]:[number] <col6>[systemicsystolic]:[number] <col7>[systemicdiastolic]:[number] <col8>[systemicmean]:[number] <col9>[observationtime]:[time] } <table5>[cost] { <col0>[costid]:[number] <col1>[uniquepid]:[text] <col2>[patienthealthsystemstayid]:[number] <col3>[eventtype]:[text] <col4>[eventid]:[number] <col5>[chargetime]:[time] } <table6>[patient] { <col0>[uniquepid]:[text] <col1>[patienthealthsystemstayid]:[number] <col2>[patientunitstayid]:[number] <col3>[gender]:[text] <col4>[age]:[text] <col5>[ethnicity]:[text] <col6>[hospitalid]:[number] <col7>[wardid]:[number] <col8>[admissionheight]:[number] <col9>[admissionweight]:[number] <col10>[dischargeweight]:[number] <col11>[hospitaladmittime]:[time] <col12>[hospitaladmitsource]:[text] <col13>[unitadmittime]:[time] <col14>[unitdischargetime]:[time] <col15>[hospitaldischargetime]:[time] <col16>[hospitaldischargestatus]:[text] } <table7>[diagnosis] { <col0>[diagnosisid]:[number] <col1>[patientunitstayid]:[number] <col2>[diagnosisname]:[text] <col3>[diagnosistime]:[time] <col4>[icd9code]:[text] } <table8>[treatment] { <col0>[treatmentid]:[number] <col1>[patientunitstayid]:[number] <col2>[treatmentname]:[text] <col3>[treatmenttime]:[time] } <table9>[lab] { <col0>[labid]:[number] <col1>[patientunitstayid]:[number] <col2>[labname]:[text] <col3>[labresult]:[number] <col4>[labresulttime]:[time] }
SELECT t1.drugname FROM ( SELECT `<table2>`.drugname, COUNT( `<table2>`.drugstarttime ) AS c1 FROM `<table2>` WHERE `<table2>`.`<table6>`unitstayid IN ( SELECT `<table6>`.`<table6>`unitstayid FROM `<table6>` WHERE `<table6>`.`<table6>`healthsystemstayid IN ( SELECT `<table6>`.`<table6>`healthsystemstayid FROM `<table6>` WHERE `<table6>`.uniquepid = '015-58787' ) ) AND STRFTIME( '%y-%m', `<table2>`.drugstarttime ) = '2105-12' GROUP BY `<table2>`.drugname ) AS t1 WHERE t1.c1 >= 2
what is the name of the drug that has been prescribed two or more times in 12/2105 to patient 015-58787?
<table0>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table1>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table2>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table3>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table4>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] }
SELECT COUNT( DISTINCT `<table4>`.subject_id ) FROM `<table4>` WHERE `<table4>`.diagnosis = "GASTROINTESTINAL BLEED" AND `<table4>`.age < "79"
count the number of patients whose primary disease is gastrointestinal bleed and age is less than 79?
<table0>[field_temperatures] { <col0>[field_id]:[VARCHAR] <col1>[temperature]:[INT] <col2>[reading_date]:[DATE] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` > 30 AND `<col2>` BETWEEN '2021-07-01' AND '2021-07-31';
List all fields that had a maximum temperature above 30 degrees Celsius in July 2021.
<table0>[table_2562572_52] { <col0>[dominant_religion__2002]:[VARCHAR] <col1>[settlement]:[VARCHAR] }
SELECT COUNT( dominant_religion__2002_ ) FROM `<table0>` WHERE `<col1>` = "Karlovčić"
How many times is the settlement karlov i ?
<table0>[labevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[itemid]:[number] <col4>[charttime]:[time] <col5>[valuenum]:[number] <col6>[valueuom]:[text] } <table1>[inputevents_cv] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] } <table2>[d_icd_diagnoses] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table3>[patients] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[gender]:[text] <col3>[dob]:[time] <col4>[dod]:[time] } <table4>[chartevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[itemid]:[number] <col5>[charttime]:[time] <col6>[valuenum]:[number] <col7>[valueuom]:[text] } <table5>[microbiologyevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[charttime]:[time] <col4>[spec_type_desc]:[text] <col5>[org_name]:[text] } <table6>[cost] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[event_type]:[text] <col4>[event_id]:[number] <col5>[chargetime]:[time] } <table7>[icustays] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[first_careunit]:[text] <col5>[last_careunit]:[text] <col6>[first_wardid]:[number] <col7>[last_wardid]:[number] <col8>[intime]:[time] <col9>[outtime]:[time] } <table8>[admissions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[admittime]:[time] <col4>[dischtime]:[time] <col5>[admission_type]:[text] <col6>[admission_location]:[text] <col7>[discharge_location]:[text] <col8>[insurance]:[text] <col9>[language]:[text] <col10>[marital_status]:[text] <col11>[ethnicity]:[text] <col12>[age]:[number] } <table9>[d_icd_procedures] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table10>[procedures_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table11>[outputevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] <col6>[value]:[number] } <table12>[d_labitems] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] } <table13>[d_items] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] <col3>[linksto]:[text] } <table14>[prescriptions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[startdate]:[time] <col4>[enddate]:[time] <col5>[drug]:[text] <col6>[dose_val_rx]:[text] <col7>[dose_unit_rx]:[text] <col8>[route]:[text] } <table15>[diagnoses_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table16>[transfers] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[eventtype]:[text] <col5>[careunit]:[text] <col6>[wardid]:[number] <col7>[intime]:[time] <col8>[outtime]:[time] }
SELECT `<table4>`.valuenum FROM `<table4>` WHERE `<table4>`.icustay_id IN ( SELECT `<table7>`.icustay_id FROM `<table7>` WHERE `<table7>`.hadm_id IN ( SELECT `<table8>`.hadm_id FROM `<table8>` WHERE `<table8>`.subject_id = 4401 ) ) AND `<table4>`.itemid IN ( SELECT `<table13>`.itemid FROM `<table13>` WHERE `<table13>`.label = 'temperature c ( calc )' AND `<table13>`.linksto = '`<table4>`' ) AND DATETIME( `<table4>`.charttime, 'start of day' ) = DATETIME( CURRENT_TIME( ), 'start of day', '-1 day' ) ORDER BY `<table4>`.charttime DESC LIMIT 1
i mean what was the last temperature c (calc) for patient 4401 during the previous day?
<table0>[Members] { <col0>[MemberID]:[INT] <col1>[Age]:[INT] <col2>[Gender]:[VARCHAR] <col3>[MembershipType]:[VARCHAR] } <table1>[ClassAttendance] { <col0>[MemberID]:[INT] <col1>[Class]:[VARCHAR] <col2>[Date]:[DATE] }
SELECT AVG( `<table0>`.Age ) FROM `<table0>` JOIN ClassAttendance ON `<table0>`.MemberID = ClassAttendance.MemberID WHERE ClassAttendance.Class = 'Cycling';
What is the average age of members who have attended a 'Cycling' class?
<table0>[table_name_7] { <col0>[round]:[INTEGER] <col1>[event]:[VARCHAR] }
SELECT SUM( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "ufc 34"
How many rounds was the fight at UFC 34?
<table0>[product_info] { <col0>[product_name]:[TEXT] <col1>[is_tested_on_animals]:[BOOLEAN] <col2>[consumer_rating]:[REAL] }
SELECT product_name, `<col2>` FROM `<table0>` WHERE `<col1>` = true;
Display the names and consumer ratings of all cosmetics products that have been tested on animals.
<table0>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table1>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table2>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table3>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table4>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] }
SELECT COUNT( DISTINCT `<table1>`.subject_id ) FROM `<table1>` INNER JOIN prescriptions ON `<table1>`.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "TD"
count the number of patients whose drug route is td?
<table0>[table_name_26] { <col0>[general_classification]:[VARCHAR] <col1>[points_classification]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "levi leipheimer"
What general classification has levi leipheimer as points classification?
<table0>[table_name_22] { <col0>[year]:[INTEGER] <col1>[result]:[VARCHAR] }
SELECT AVG( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "24-14"
What year was the game that ended with a score of 24-14?
<table0>[users] { <col0>[user_id]:[INT] <col1>[username]:[VARCHAR] <col2>[region]:[VARCHAR] } <table1>[transactions] { <col0>[transaction_id]:[INT] <col1>[user_id]:[INT] <col2>[DECIMAL]:[transaction_time] }
SELECT user_id, AVG( amount ) as avg_amount FROM ( SELECT user_id, amount, ROW_NUMBER( ) OVER ( PARTITION BY `<col1>` ORDER BY transaction_time ) as transaction_count FROM `<table1>` ) t GROUP BY `<col1>` ORDER BY transaction_count DESC;
What is the average transaction amount per user, ordered by the total transaction count?
<table0>[Invoice_Items] { <col0>[Invoice_Item_ID]:[INTEGER] <col1>[Invoice_ID]:[INTEGER] <col2>[Order_ID]:[INTEGER] <col3>[Order_Item_ID]:[INTEGER] <col4>[Product_ID]:[INTEGER] <col5>[Order_Quantity]:[INTEGER] <col6>[Other_Item_Details]:[VARCHAR] } <table1>[Services] { <col0>[Service_ID]:[INTEGER] <col1>[Service_Type_Code]:[CHAR] <col2>[Workshop_Group_ID]:[INTEGER] <col3>[Product_Description]:[VARCHAR] <col4>[255]:[Product_Name] <col5>[VARCHAR]:[255] <col6>[Product_Price]:[DECIMAL] <col7>[Other_Product_Service_Details]:[VARCHAR] } <table2>[Order_Items] { <col0>[Order_Item_ID]:[INTEGER] <col1>[Order_ID]:[INTEGER] <col2>[Product_ID]:[INTEGER] <col3>[Order_Quantity]:[VARCHAR] <col4>[288]:[Other_Item_Details] <col5>[VARCHAR]:[255] } <table3>[Ref_Payment_Methods] { <col0>[payment_method_code]:[CHAR] <col1>[payment_method_description]:[VARCHAR] } <table4>[Performers] { <col0>[Performer_ID]:[INTEGER] <col1>[Address_ID]:[INTEGER] <col2>[Customer_Name]:[VARCHAR] <col3>[255]:[Customer_Phone] <col4>[VARCHAR]:[255] <col5>[Customer_Email_Address]:[VARCHAR] <col6>[255]:[Other_Details] <col7>[VARCHAR]:[255] } <table5>[Bookings] { <col0>[Booking_ID]:[INTEGER] <col1>[Customer_ID]:[INTEGER] <col2>[Workshop_Group_ID]:[VARCHAR] <col3>[100]:[Status_Code] <col4>[CHAR]:[Store_ID] <col5>[INTEGER]:[Order_Date] <col6>[DATETIME]:[Planned_Delivery_Date] <col7>[DATETIME]:[Actual_Delivery_Date] <col8>[DATETIME]:[Other_Order_Details] <col9>[VARCHAR]:[255] } <table6>[Customer_Orders] { <col0>[Order_ID]:[INTEGER] <col1>[Customer_ID]:[INTEGER] <col2>[Store_ID]:[INTEGER] <col3>[Order_Date]:[DATETIME] <col4>[Planned_Delivery_Date]:[DATETIME] <col5>[Actual_Delivery_Date]:[DATETIME] <col6>[Other_Order_Details]:[VARCHAR] } <table7>[Drama_Workshop_Groups] { <col0>[Workshop_Group_ID]:[INTEGER] <col1>[Address_ID]:[INTEGER] <col2>[Currency_Code]:[CHAR] <col3>[Marketing_Region_Code]:[CHAR] <col4>[Store_Name]:[VARCHAR] <col5>[255]:[Store_Phone] <col6>[VARCHAR]:[255] <col7>[Store_Email_Address]:[VARCHAR] <col8>[255]:[Other_Details] <col9>[VARCHAR]:[255] } <table8>[Invoices] { <col0>[Invoice_ID]:[INTEGER] <col1>[Order_ID]:[INTEGER] <col2>[payment_method_code]:[CHAR] <col3>[Product_ID]:[INTEGER] <col4>[Order_Quantity]:[VARCHAR] <col5>[288]:[Other_Item_Details] <col6>[VARCHAR]:[255] <col7>[Order_Item_ID]:[INTEGER] } <table9>[Ref_Service_Types] { <col0>[Service_Type_Code]:[CHAR] <col1>[Parent_Service_Type_Code]:[CHAR] <col2>[Service_Type_Description]:[VARCHAR] } <table10>[Addresses] { <col0>[Address_ID]:[VARCHAR] <col1>[100]:[Line_1] <col2>[VARCHAR]:[255] <col3>[Line_2]:[VARCHAR] <col4>[255]:[City_Town] <col5>[VARCHAR]:[255] <col6>[State_County]:[VARCHAR] <col7>[255]:[Other_Details] <col8>[VARCHAR]:[255] } <table11>[Stores] { <col0>[Store_ID]:[VARCHAR] <col1>[100]:[Address_ID] <col2>[INTEGER]:[Marketing_Region_Code] <col3>[CHAR]:[Store_Name] <col4>[VARCHAR]:[255] <col5>[Store_Phone]:[VARCHAR] <col6>[255]:[Store_Email_Address] <col7>[VARCHAR]:[255] <col8>[Other_Details]:[VARCHAR] } <table12>[Bookings_Services] { <col0>[Order_ID]:[INTEGER] <col1>[Product_ID]:[INTEGER] } <table13>[Products] { <col0>[Product_ID]:[VARCHAR] <col1>[100]:[Product_Name] <col2>[VARCHAR]:[255] <col3>[Product_Price]:[DECIMAL] <col4>[Product_Description]:[VARCHAR] <col5>[255]:[Other_Product_Service_Details] <col6>[VARCHAR]:[255] } <table14>[Customers] { <col0>[Customer_ID]:[VARCHAR] <col1>[100]:[Address_ID] <col2>[INTEGER]:[Customer_Name] <col3>[VARCHAR]:[255] <col4>[Customer_Phone]:[VARCHAR] <col5>[255]:[Customer_Email_Address] <col6>[VARCHAR]:[255] <col7>[Other_Details]:[VARCHAR] } <table15>[Marketing_Regions] { <col0>[Marketing_Region_Code]:[CHAR] <col1>[Marketing_Region_Name]:[VARCHAR] <col2>[255]:[Marketing_Region_Descriptrion] <col3>[VARCHAR]:[255] <col4>[Other_Details]:[VARCHAR] } <table16>[Performers_in_Bookings] { <col0>[Order_ID]:[INTEGER] <col1>[Performer_ID]:[INTEGER] } <table17>[Clients] { <col0>[Client_ID]:[INTEGER] <col1>[Address_ID]:[INTEGER] <col2>[Customer_Email_Address]:[VARCHAR] <col3>[255]:[Customer_Name] <col4>[VARCHAR]:[255] <col5>[Customer_Phone]:[VARCHAR] <col6>[255]:[Other_Details] <col7>[VARCHAR]:[255] }
SELECT Service_Type_Description, COUNT( `<col2>` ) FROM `<table9>` AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY `<col2>` ORDER BY COUNT( `<col2>` )
A bar chart for giveing me the number of the descriptions of the service types that cost more than 100, and display total number in ascending order.
<table0>[drama_workshop_groups] { <col0>[workshop_group_id]:[number] <col1>[address_id]:[number] <col2>[currency_code]:[text] <col3>[marketing_region_code]:[text] <col4>[store_name]:[text] <col5>[store_phone]:[text] <col6>[store_email_address]:[text] <col7>[other_details]:[text] } <table1>[products] { <col0>[product_id]:[text] <col1>[product_name]:[text] <col2>[product_price]:[number] <col3>[product_description]:[text] <col4>[other_product_service_details]:[text] } <table2>[bookings_services] { <col0>[order_id]:[number] <col1>[product_id]:[number] } <table3>[performers_in_bookings] { <col0>[order_id]:[number] <col1>[performer_id]:[number] } <table4>[customers] { <col0>[customer_id]:[text] <col1>[address_id]:[number] <col2>[customer_name]:[text] <col3>[customer_phone]:[text] <col4>[customer_email_address]:[text] <col5>[other_details]:[text] } <table5>[performers] { <col0>[performer_id]:[number] <col1>[address_id]:[number] <col2>[customer_name]:[text] <col3>[customer_phone]:[text] <col4>[customer_email_address]:[text] <col5>[other_details]:[text] } <table6>[services] { <col0>[service_id]:[number] <col1>[service_type_code]:[text] <col2>[workshop_group_id]:[number] <col3>[product_description]:[text] <col4>[product_name]:[text] <col5>[product_price]:[number] <col6>[other_product_service_details]:[text] } <table7>[ref_payment_methods] { <col0>[payment_method_code]:[text] <col1>[payment_method_description]:[text] } <table8>[addresses] { <col0>[address_id]:[text] <col1>[line_1]:[text] <col2>[line_2]:[text] <col3>[city_town]:[text] <col4>[state_county]:[text] <col5>[other_details]:[text] } <table9>[order_items] { <col0>[order_item_id]:[number] <col1>[order_id]:[number] <col2>[product_id]:[number] <col3>[order_quantity]:[text] <col4>[other_item_details]:[text] } <table10>[stores] { <col0>[store_id]:[text] <col1>[address_id]:[number] <col2>[marketing_region_code]:[text] <col3>[store_name]:[text] <col4>[store_phone]:[text] <col5>[store_email_address]:[text] <col6>[other_details]:[text] } <table11>[marketing_regions] { <col0>[marketing_region_code]:[text] <col1>[marketing_region_name]:[text] <col2>[marketing_region_descriptrion]:[text] <col3>[other_details]:[text] } <table12>[clients] { <col0>[client_id]:[number] <col1>[address_id]:[number] <col2>[customer_email_address]:[text] <col3>[customer_name]:[text] <col4>[customer_phone]:[text] <col5>[other_details]:[text] } <table13>[customer_orders] { <col0>[order_id]:[number] <col1>[customer_id]:[number] <col2>[store_id]:[number] <col3>[order_date]:[time] <col4>[planned_delivery_date]:[time] <col5>[actual_delivery_date]:[time] <col6>[other_order_details]:[text] } <table14>[ref_service_types] { <col0>[service_type_code]:[text] <col1>[parent_service_type_code]:[text] <col2>[service_type_description]:[text] } <table15>[invoices] { <col0>[invoice_id]:[number] <col1>[order_id]:[number] <col2>[payment_method_code]:[text] <col3>[product_id]:[number] <col4>[order_quantity]:[text] <col5>[other_item_details]:[text] <col6>[order_item_id]:[number] } <table16>[bookings] { <col0>[booking_id]:[number] <col1>[customer_id]:[number] <col2>[workshop_group_id]:[text] <col3>[status_code]:[text] <col4>[store_id]:[number] <col5>[order_date]:[time] <col6>[planned_delivery_date]:[time] <col7>[actual_delivery_date]:[time] <col8>[other_order_details]:[text] } <table17>[invoice_items] { <col0>[invoice_item_id]:[number] <col1>[invoice_id]:[number] <col2>[order_id]:[number] <col3>[order_item_id]:[number] <col4>[product_id]:[number] <col5>[order_quantity]:[number] <col6>[other_item_details]:[text] }
SELECT T1.other_item_details FROM `<table9>` AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T2.product_price > 2000
Find the order detail for the products with price above 2000.
<table0>[boeing_defense_projects] { <col0>[project_id]:[INT] <col1>[project_name]:[VARCHAR] <col2>[country]:[VARCHAR] } <table1>[raytheon_defense_projects] { <col0>[project_id]:[INT] <col1>[project_name]:[VARCHAR] <col2>[country]:[VARCHAR] }
SELECT COUNT( * ) FROM ( SELECT * FROM `<table0>` UNION ALL SELECT * FROM `<table1>` ) AS combined_projects;
What is the total number of defense projects with Boeing and Raytheon combined?
<table0>[locations] { <col0>[LOCATION_ID]:[decimal] <col1>[STREET_ADDRESS]:[varchar] <col2>[POSTAL_CODE]:[varchar] <col3>[CITY]:[varchar] <col4>[STATE_PROVINCE]:[varchar] <col5>[COUNTRY_ID]:[varchar] } <table1>[jobs] { <col0>[JOB_ID]:[varchar] <col1>[JOB_TITLE]:[varchar] <col2>[MIN_SALARY]:[decimal] <col3>[MAX_SALARY]:[decimal] } <table2>[departments] { <col0>[DEPARTMENT_ID]:[decimal] <col1>[DEPARTMENT_NAME]:[varchar] <col2>[MANAGER_ID]:[decimal] <col3>[LOCATION_ID]:[decimal] } <table3>[countries] { <col0>[COUNTRY_ID]:[varchar] <col1>[COUNTRY_NAME]:[varchar] <col2>[REGION_ID]:[decimal] } <table4>[job_history] { <col0>[EMPLOYEE_ID]:[decimal] <col1>[START_DATE]:[date] <col2>[END_DATE]:[date] <col3>[JOB_ID]:[varchar] <col4>[DEPARTMENT_ID]:[decimal] } <table5>[regions] { <col0>[REGION_ID]:[decimal] <col1>[REGION_NAME]:[varchar] } <table6>[employees] { <col0>[EMPLOYEE_ID]:[decimal] <col1>[FIRST_NAME]:[varchar] <col2>[LAST_NAME]:[varchar] <col3>[EMAIL]:[varchar] <col4>[PHONE_NUMBER]:[varchar] <col5>[HIRE_DATE]:[date] <col6>[JOB_ID]:[varchar] <col7>[SALARY]:[decimal] <col8>[COMMISSION_PCT]:[decimal] <col9>[MANAGER_ID]:[decimal] <col10>[DEPARTMENT_ID]:[decimal] }
SELECT HIRE_DATE, SUM( `<col0>` ) FROM `<table6>` WHERE `<col7>` BETWEEN 8000 AND 12000 AND `<col8>` <> "null" OR `<col10>` <> 40 ORDER BY SUM( `<col0>` ) DESC
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize a bar chart about the distribution of hire_date and the sum of employee_id bin hire_date by weekday, order by the y-axis in descending.
<table0>[table_10470082_3] { <col0>[writer]:[VARCHAR] <col1>[us_air_date]:[VARCHAR] }
SELECT COUNT( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "September 25, 1993"
How many writers had an US air date of september 25, 1993?
<table0>[Reservations] { <col0>[Code]:[INTEGER] <col1>[Room]:[TEXT] <col2>[CheckIn]:[TEXT] <col3>[CheckOut]:[TEXT] <col4>[Rate]:[REAL] <col5>[LastName]:[TEXT] <col6>[FirstName]:[TEXT] <col7>[Adults]:[INTEGER] <col8>[Kids]:[INTEGER] } <table1>[Rooms] { <col0>[RoomId]:[TEXT] <col1>[roomName]:[TEXT] <col2>[beds]:[INTEGER] <col3>[bedType]:[TEXT] <col4>[maxOccupancy]:[INTEGER] <col5>[basePrice]:[INTEGER] <col6>[decor]:[TEXT] }
SELECT roomName, COUNT( roomName ) FROM `<table0>` AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE `<col6>` LIKE '%ROY%' GROUP BY roomName ORDER BY roomName DESC
Find the name of rooms booked by some customers whose first name contains ROY, and count them by a bar chart, sort x-axis from high to low order.
<table0>[table_24600706_1] { <col0>[released]:[INTEGER] <col1>[song]:[VARCHAR] }
SELECT MAX( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "Apologize"
Name the most released for apologize
<table0>[table_name_6] { <col0>[place]:[INTEGER] <col1>[artist]:[VARCHAR] <col2>[points]:[VARCHAR] }
SELECT MAX( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "henri dès" AND `<col2>` < 8
What is the highest place of a song by Henri D s that has fewer than 8 points?
<table0>[table_17900] { <col0>[Unit]:[text] <col1>[Type]:[text] <col2>[Net]:[power] <col3>[text]:[Total] <col4>[power]:[text] <col5>[Construction]:[start] <col6>[text]:[Construction] <col7>[finish]:[text] <col8>[Commercial]:[operation] <col9>[text]:[Shut] }
SELECT "Total power" FROM `<table0>` WHERE "Construction finish" = '14.06.1963'
What's the total power of the unit whose construction finished on 14.06.1963?
<table0>[table_name_3] { <col0>[location]:[VARCHAR] <col1>[runner_up]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "tbd"
At what Location was the Runner-up TBD?
<table0>[spacecrafts] { <col0>[manufacturer]:[VARCHAR] <col1>[255]:[mass] <col2>[FLOAT]:[manufacture_date] <col3>[DATE]:[INSERT] }
SELECT COUNT( * ) FROM `<table0>` WHERE `<col0>` = 'AstroCorp' AND manufacture_date LIKE '2017%';
How many spacecrafts were manufactured by AstroCorp in 2017?
<table0>[arson_incidents] { <col0>[INT]:[incident_date] <col1>[DATE]:[location] <col2>[VARCHAR]:[INSERT] }
SELECT COUNT( * ) FROM `<table0>` WHERE location = 'compton' AND incident_date >= DATE_SUB( CURRENT_DATE, INTERVAL 3 MONTH );
What is the total number of arson incidents in 'compton' in the last 3 months?
<table0>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table1>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table2>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table3>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table4>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] }
SELECT COUNT( DISTINCT `<table3>`.subject_id ) FROM `<table3>` INNER JOIN diagnoses ON `<table3>`.hadm_id = diagnoses.hadm_id WHERE `<table3>`.dob_year < "2024" AND diagnoses.short_title = "Chronic liver dis NEC"
provide the number of patients born before 2024 diagnosed with other chronic nonalcoholic liver disease.
<table0>[table_name_11] { <col0>[partnering]:[VARCHAR] <col1>[score]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "7–6 7 , 6–1"
Which Partnering has a Score of 7 6 7 , 6 1?
<table0>[providers] { <col0>[INT]:[name] <col1>[TEXT]:[location] <col2>[TEXT]:[country] <col3>[TEXT]:[departure_date] <col4>[DATE]:[departure_reason] <col5>[TEXT]:[INSERT] }
SELECT COUNT( * ) AS number_of_`<table0>`, departure_reason FROM `<table0>` WHERE location LIKE '%rural%' AND country = 'India' GROUP BY departure_reason
Find the number of healthcare providers who have left their positions in rural India and the reasons for their departure.
<table0>[city] { <col0>[city_code]:[varchar] <col1>[city_name]:[varchar] <col2>[state_code]:[varchar] <col3>[country_name]:[varchar] <col4>[time_zone_code]:[varchar] } <table1>[airport_service] { <col0>[city_code]:[varchar] <col1>[airport_code]:[varchar] <col2>[miles_distant]:[int] <col3>[direction]:[varchar] <col4>[minutes_distant]:[int] } <table2>[code_description] { <col0>[code]:[varchar] <col1>[description]:[text] } <table3>[flight_stop] { <col0>[flight_id]:[int] <col1>[stop_number]:[int] <col2>[stop_days]:[text] <col3>[stop_airport]:[text] <col4>[arrival_time]:[int] <col5>[arrival_airline]:[text] <col6>[arrival_flight_number]:[int] <col7>[departure_time]:[int] <col8>[departure_airline]:[text] <col9>[departure_flight_number]:[int] <col10>[stop_time]:[int] } <table4>[date_day] { <col0>[month_number]:[int] <col1>[day_number]:[int] <col2>[year]:[int] <col3>[day_name]:[varchar] } <table5>[restriction] { <col0>[restriction_code]:[text] <col1>[advance_purchase]:[int] <col2>[stopovers]:[text] <col3>[saturday_stay_required]:[text] <col4>[minimum_stay]:[int] <col5>[maximum_stay]:[int] <col6>[application]:[text] <col7>[no_discounts]:[text] } <table6>[time_interval] { <col0>[period]:[text] <col1>[begin_time]:[int] <col2>[end_time]:[int] } <table7>[flight_fare] { <col0>[flight_id]:[int] <col1>[fare_id]:[int] } <table8>[month] { <col0>[month_number]:[int] <col1>[month_name]:[text] } <table9>[flight_leg] { <col0>[flight_id]:[int] <col1>[leg_number]:[int] <col2>[leg_flight]:[int] } <table10>[dual_carrier] { <col0>[main_airline]:[varchar] <col1>[low_flight_number]:[int] <col2>[high_flight_number]:[int] <col3>[dual_airline]:[varchar] <col4>[service_name]:[text] } <table11>[airline] { <col0>[airline_code]:[varchar] <col1>[airline_name]:[text] <col2>[note]:[text] } <table12>[fare_basis] { <col0>[fare_basis_code]:[text] <col1>[booking_class]:[text] <col2>[class_type]:[text] <col3>[premium]:[text] <col4>[economy]:[text] <col5>[discounted]:[text] <col6>[night]:[text] <col7>[season]:[text] <col8>[basis_days]:[text] } <table13>[state] { <col0>[state_code]:[text] <col1>[state_name]:[text] <col2>[country_name]:[text] } <table14>[food_service] { <col0>[meal_code]:[text] <col1>[meal_number]:[int] <col2>[compartment]:[text] <col3>[meal_description]:[varchar] } <table15>[time_zone] { <col0>[time_zone_code]:[text] <col1>[time_zone_name]:[text] <col2>[hours_from_gmt]:[int] } <table16>[flight] { <col0>[aircraft_code_sequence]:[text] <col1>[airline_code]:[varchar] } <table17>[compartment_class] { <col0>[compartment]:[varchar] <col1>[class_type]:[varchar] } <table18>[aircraft] { <col0>[aircraft_code]:[varchar] <col1>[aircraft_description]:[varchar] <col2>[manufacturer]:[varchar] <col3>[basic_type]:[varchar] <col4>[engines]:[int] <col5>[propulsion]:[varchar] <col6>[wide_body]:[varchar] <col7>[wing_span]:[int] <col8>[length]:[int] <col9>[weight]:[int] <col10>[capacity]:[int] <col11>[pay_load]:[int] <col12>[cruising_speed]:[int] <col13>[range_miles]:[int] <col14>[pressurized]:[varchar] } <table19>[days] { <col0>[days_code]:[varchar] <col1>[day_name]:[varchar] } <table20>[fare] { <col0>[fare_id]:[int] <col1>[from_airport]:[varchar] <col2>[to_airport]:[varchar] <col3>[fare_basis_code]:[text] <col4>[fare_airline]:[text] <col5>[restriction_code]:[text] <col6>[one_direction_cost]:[int] <col7>[round_trip_cost]:[int] <col8>[round_trip_required]:[varchar] } <table21>[equipment_sequence] { <col0>[aircraft_code_sequence]:[varchar] <col1>[aircraft_code]:[varchar] } <table22>[ground_service] { <col0>[city_code]:[text] <col1>[airport_code]:[text] <col2>[transport_type]:[text] <col3>[ground_fare]:[int] } <table23>[airport] { <col0>[airport_code]:[varchar] <col1>[airport_name]:[text] <col2>[airport_location]:[text] <col3>[state_code]:[varchar] <col4>[country_name]:[varchar] <col5>[time_zone_code]:[varchar] <col6>[minimum_connect_time]:[int] } <table24>[class_of_service] { <col0>[booking_class]:[varchar] <col1>[rank]:[int] <col2>[class_description]:[text] }
SELECT DISTINCT flight.flight_id FROM `<table1>` AS AIRPORT_SERVICE_0, `<table1>` AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ( CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MEMPHIS' AND date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code ) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'HOUSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
find flight from HOUSTON to MEMPHIS on friday
<table0>[table_42810] { <col0>[Date]:[text] <col1>[Visitor]:[text] <col2>[Score]:[text] <col3>[Home]:[text] <col4>[Leading]:[scorer] <col5>[text]:[Attendance] <col6>[text]:[Record] }
SELECT "Score" FROM `<table0>` WHERE "Home" = 'new jersey'
What is the score of the New Jersey home game?
<table0>[table_name_74] { <col0>[number]:[INTEGER] <col1>[opponent]:[VARCHAR] }
SELECT MAX( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "julio césar vásquez"
What is the highest number of the match with julio c sar v squez as the opponent?
<table0>[OrganicCottonClothing] { <col0>[INT]:[production_cost] <col1>[DECIMAL]:[INSERT] }
SELECT AVG( production_cost ) FROM OrganicCottonClothing;
What is the average production cost of clothing items made with organic cotton?
<table0>[MediaType] { <col0>[MediaTypeId]:[integer] <col1>[varchar]:[120] } <table1>[Genre] { <col0>[GenreId]:[integer] <col1>[varchar]:[120] } <table2>[Playlist] { <col0>[PlaylistId]:[integer] <col1>[varchar]:[120] } <table3>[Customer] { <col0>[CustomerId]:[integer] <col1>[FirstName]:[varchar] <col2>[LastName]:[varchar] <col3>[Company]:[varchar] <col4>[Address]:[varchar] <col5>[City]:[varchar] <col6>[State]:[varchar] <col7>[Country]:[varchar] <col8>[PostalCode]:[varchar] <col9>[Phone]:[varchar] <col10>[Fax]:[varchar] <col11>[Email]:[varchar] <col12>[SupportRepId]:[integer] } <table4>[Artist] { <col0>[ArtistId]:[integer] <col1>[varchar]:[120] } <table5>[Album] { <col0>[AlbumId]:[integer] <col1>[Title]:[varchar] <col2>[160]:[ArtistId] } <table6>[Track] { <col0>[TrackId]:[integer] <col1>[varchar]:[200] <col2>[AlbumId]:[integer] <col3>[MediaTypeId]:[integer] <col4>[GenreId]:[integer] <col5>[Composer]:[varchar] <col6>[220]:[Milliseconds] <col7>[integer]:[Bytes] <col8>[integer]:[UnitPrice] } <table7>[PlaylistTrack] { <col0>[PlaylistId]:[integer] <col1>[TrackId]:[integer] } <table8>[Employee] { <col0>[EmployeeId]:[integer] <col1>[LastName]:[varchar] <col2>[FirstName]:[varchar] <col3>[Title]:[varchar] <col4>[ReportsTo]:[integer] <col5>[BirthDate]:[datetime] <col6>[HireDate]:[datetime] <col7>[Address]:[varchar] <col8>[City]:[varchar] <col9>[State]:[varchar] <col10>[Country]:[varchar] <col11>[PostalCode]:[varchar] <col12>[Phone]:[varchar] <col13>[Fax]:[varchar] <col14>[Email]:[varchar] } <table9>[Invoice] { <col0>[InvoiceId]:[integer] <col1>[CustomerId]:[integer] <col2>[InvoiceDate]:[datetime] <col3>[BillingAddress]:[varchar] <col4>[BillingCity]:[varchar] <col5>[BillingState]:[varchar] <col6>[BillingCountry]:[varchar] <col7>[BillingPostalCode]:[varchar] <col8>[Total]:[decimal] } <table10>[InvoiceLine] { <col0>[InvoiceLineId]:[integer] <col1>[InvoiceId]:[integer] <col2>[TrackId]:[integer] <col3>[UnitPrice]:[decimal] <col4>[Quantity]:[integer] }
SELECT InvoiceDate, COUNT( InvoiceDate ) FROM `<table3>` AS T1 JOIN Invoice AS T2 ON T1.`<table3>`Id = T2.`<table3>`Id WHERE T1.FirstName = "Astrid" AND `<col2>` = "Gruber" ORDER BY COUNT( InvoiceDate ) DESC
What are the number of the invoice dates for customers with the first name Astrid and the last name Gruber?, and order from high to low by the Y-axis.
<table0>[african_garments] { <col0>[INT]:[PRIMARY] <col1>[KEY]:[garment] <col2>[VARCHAR]:[type] <col3>[VARCHAR]:[fair_trade_certified] <col4>[BOOLEAN]:[INSERT] }
SELECT type, 100.0 * SUM( fair_trade_certified ) / COUNT( * ) as percentage FROM `<table0>` GROUP BY type;
What is the percentage of fair trade certified garments, by type, in the African ethical fashion market?
<table0>[table_31010] { <col0>[Rnd]:[text] <col1>[Circuit]:[text] <col2>[Winning]:[Team] <col3>[text]:[Winning] <col4>[Team]:[text] <col5>[Winning]:[Team] <col6>[text]:[Winning] <col7>[Team]:[text] <col8>[Winning]:[Team] <col9>[text]:[Winning] <col10>[Team]:[text] <col11>[Winning]:[Team] <col12>[text]:[Winning] <col13>[Team]:[text] <col14>[Winning]:[Team] <col15>[text]:[Winning] <col16>[Team]:[text] <col17>[Winning]:[Team] <col18>[text]:[Winning] <col19>[Team]:[text] <col20>[Winning]:[Team] <col21>[text]:[Winning] <col22>[Team]:[text] <col23>[Results]:[text] }
SELECT "EP `<col2>` Team" FROM `<table0>` WHERE "CP `<col2>` Team" = 'Dave Clark' AND "GM `<col2>` Team" = 'Stuart Northrup'
Who was the EP winning team when the CP winning team was Dave Clark and the GM winning team was Stuart Northrup?
<table0>[table_name_89] { <col0>[catalog]:[VARCHAR] <col1>[date]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "december 19, 2001"
Which catalog was published on December 19, 2001?
<table0>[investments] { <col0>[INT]:[company_id] <col1>[INT]:[sector] <col2>[VARCHAR]:[255] <col3>[year]:[INT] <col4>[FLOAT]:[INSERT] }
SELECT MAX( amount ) FROM `<table0>` WHERE sector = 'Financial Services' AND `<col3>` = 2020;
What is the maximum investment in a single company in the 'Financial Services' sector in the year 2020?
<table0>[Claims] { <col0>[Claim_ID]:[INTEGER] <col1>[Policy_ID]:[INTEGER] <col2>[Date_Claim_Made]:[DATE] <col3>[Date_Claim_Settled]:[DATE] <col4>[Amount_Claimed]:[INTEGER] <col5>[Amount_Settled]:[INTEGER] } <table1>[Payments] { <col0>[Payment_ID]:[INTEGER] <col1>[Settlement_ID]:[INTEGER] <col2>[Payment_Method_Code]:[VARCHAR] <col3>[255]:[Date_Payment_Made] <col4>[DATE]:[Amount_Payment] } <table2>[Customers] { <col0>[Customer_ID]:[INTEGER] <col1>[Customer_Details]:[VARCHAR] } <table3>[Settlements] { <col0>[Settlement_ID]:[INTEGER] <col1>[Claim_ID]:[INTEGER] <col2>[Date_Claim_Made]:[DATE] <col3>[Date_Claim_Settled]:[DATE] <col4>[Amount_Claimed]:[INTEGER] <col5>[Amount_Settled]:[INTEGER] <col6>[Customer_Policy_ID]:[INTEGER] } <table4>[Customer_Policies] { <col0>[Policy_ID]:[INTEGER] <col1>[Customer_ID]:[INTEGER] <col2>[Policy_Type_Code]:[CHAR] <col3>[Start_Date]:[DATE] <col4>[End_Date]:[DATE] }
SELECT T1.Customer_Details, T1.Customer_ID FROM `<table2>` AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID ORDER BY T1.Customer_ID
Find the the customer details and id for the customers who had more than one policy, and rank by the Y in asc.
<table0>[teaches] { <col0>[text]:[course_id] <col1>[text]:[sec_id] <col2>[text]:[semester] <col3>[text]:[year] } <table1>[student] { <col0>[text]:[name] <col1>[text]:[dept_name] <col2>[text]:[tot_cred] } <table2>[course] { <col0>[course_id]:[text] <col1>[title]:[text] <col2>[dept_name]:[text] <col3>[credits]:[number] } <table3>[time_slot] { <col0>[time_slot_id]:[text] <col1>[day]:[text] <col2>[start_hr]:[number] <col3>[start_min]:[number] <col4>[end_hr]:[number] <col5>[end_min]:[number] } <table4>[department] { <col0>[dept_name]:[text] <col1>[building]:[text] <col2>[budget]:[number] } <table5>[advisor] { <col0>[s_id]:[text] <col1>[i_id]:[text] } <table6>[takes] { <col0>[text]:[course_id] <col1>[text]:[sec_id] <col2>[text]:[semester] <col3>[text]:[year] <col4>[number]:[grade] } <table7>[instructor] { <col0>[text]:[name] <col1>[text]:[dept_name] <col2>[text]:[salary] } <table8>[section] { <col0>[course_id]:[text] <col1>[sec_id]:[text] <col2>[semester]:[text] <col3>[year]:[number] <col4>[building]:[text] <col5>[room_number]:[text] <col6>[time_slot_id]:[text] } <table9>[prereq] { <col0>[course_id]:[text] <col1>[prereq_id]:[text] } <table10>[classroom] { <col0>[building]:[text] <col1>[room_number]:[text] <col2>[capacity]:[number] }
SELECT COUNT( * ) FROM `<table10>` WHERE `<col0>` = 'Lamberton'
Count the number of classrooms in Lamberton.
<table0>[table_name_42] { <col0>[building]:[VARCHAR] <col1>[storeys]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = 26
Which building has 26 storeys?
<table0>[table_203_664] { <col0>[number]:[club] <col1>[text]:[town] <col2>[text]:[founded] <col3>[number]:[nickname] <col4>[text]:[colours] <col5>[text]:[home] <col6>[ground]:[text] <col7>[titles]:[number] <col8>[website]:[text] }
SELECT COUNT( "club" ) FROM `<table0>` WHERE "colours" = 'red'
how many teams have the color red in their team colors ?
<table0>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table1>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table2>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table3>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table4>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] }
SELECT COUNT( DISTINCT `<table2>`.subject_id ) FROM `<table2>` INNER JOIN procedures ON `<table2>`.hadm_id = procedures.hadm_id WHERE `<table2>`.dob_year < "2114" AND procedures.icd9_code = "8968"
count the number of patients whose year of birth is less than 2114 and procedure icd9 code is 8968?
<table0>[requirement] { <col0>[requirement_id]:[int] } <table1>[comment_instructor] { <col0>[instructor_id]:[int] <col1>[student_id]:[int] <col2>[score]:[int] <col3>[comment_text]:[varchar] } <table2>[student_record] { <col0>[student_id]:[int] <col1>[course_id]:[int] <col2>[semester]:[int] <col3>[grade]:[varchar] <col4>[varchar]:[transfer_source] <col5>[varchar]:[earn_credit] <col6>[varchar]:[repeat_term] <col7>[varchar]:[test_id] } <table3>[campus_job_id] { <col0>[int]:[student_id] <col1>[int]:[location] } <table4>[instructor] { <col0>[instructor_id]:[int] <col1>[name]:[varchar] <col2>[uniqname]:[varchar] } <table5>[course_prerequisite] { <col0>[pre_course_id]:[int] <col1>[course_id]:[int] } <table6>[program] { <col0>[program_id]:[int] <col1>[name]:[varchar] <col2>[college]:[varchar] <col3>[introduction]:[varchar] } <table7>[semester] { <col0>[semester_id]:[int] } <table8>[area] { <col0>[course_id]:[int] } <table9>[jobs] { <col0>[job_id]:[int] <col1>[job_title]:[varchar] <col2>[description]:[varchar] <col3>[requirement]:[varchar] <col4>[city]:[varchar] <col5>[state]:[varchar] <col6>[country]:[varchar] <col7>[zip]:[int] } <table10>[program_course] { <col0>[program_id]:[int] <col1>[course_id]:[int] <col2>[workload]:[int] <col3>[category]:[varchar] } <table11>[student] { <col0>[student_id]:[int] <col1>[lastname]:[varchar] <col2>[firstname]:[varchar] <col3>[program_id]:[int] <col4>[declare_major]:[varchar] <col5>[total_credit]:[int] <col6>[total_gpa]:[float] <col7>[entered_as]:[varchar] <col8>[admit_term]:[int] <col9>[predicted_graduation_semester]:[int] <col10>[degree]:[varchar] <col11>[minor]:[varchar] <col12>[internship]:[varchar] } <table12>[gsi] { <col0>[course_offering_id]:[int] <col1>[student_id]:[int] } <table13>[offering_instructor] { <col0>[offering_instructor_id]:[int] <col1>[offering_id]:[int] <col2>[instructor_id]:[int] } <table14>[course] { <col0>[course_id]:[int] <col1>[name]:[varchar] <col2>[department]:[varchar] <col3>[number]:[varchar] <col4>[credits]:[varchar] <col5>[advisory_requirement]:[varchar] <col6>[enforced_requirement]:[varchar] <col7>[description]:[varchar] <col8>[num_semesters]:[int] <col9>[num_enrolled]:[int] <col10>[has_discussion]:[varchar] <col11>[has_lab]:[varchar] <col12>[has_projects]:[varchar] <col13>[has_exams]:[varchar] <col14>[num_reviews]:[int] <col15>[clarity_score]:[int] <col16>[easiness_score]:[int] <col17>[helpfulness_score]:[int] } <table15>[course_offering] { <col0>[offering_id]:[int] <col1>[course_id]:[int] <col2>[semester]:[int] <col3>[section_number]:[int] <col4>[start_time]:[time] <col5>[end_time]:[time] <col6>[monday]:[varchar] <col7>[tuesday]:[varchar] <col8>[wednesday]:[varchar] <col9>[thursday]:[varchar] <col10>[friday]:[varchar] <col11>[saturday]:[varchar] <col12>[sunday]:[varchar] <col13>[has_final_project]:[varchar] <col14>[has_final_exam]:[varchar] <col15>[textbook]:[varchar] <col16>[class_address]:[varchar] <col17>[allow_audit]:[varchar] } <table16>[program_requirement] { <col0>[program_id]:[int] <col1>[category]:[varchar] <col2>[min_credit]:[int] <col3>[additional_req]:[varchar] } <table17>[course_tags_count] { <col0>[course_id]:[int] <col1>[clear_grading]:[int] <col2>[pop_quiz]:[int] <col3>[group_projects]:[int] <col4>[inspirational]:[int] <col5>[long_lectures]:[int] <col6>[extra_credit]:[int] <col7>[few_tests]:[int] <col8>[good_feedback]:[int] <col9>[tough_tests]:[int] <col10>[heavy_papers]:[int] <col11>[cares_for_students]:[int] <col12>[heavy_assignments]:[int] <col13>[respected]:[int] <col14>[participation]:[int] <col15>[heavy_reading]:[int] <col16>[tough_grader]:[int] <col17>[hilarious]:[int] <col18>[would_take_again]:[int] <col19>[good_lecture]:[int] <col20>[no_skip]:[int] }
SELECT DISTINCT `<table7>`.`<table7>`, `<table7>`.year FROM course, course_offering, instructor, offering_instructor, `<table7>` WHERE course.course_id = course_offering.course_id AND course.number = 248 AND course_offering.`<table7>` = `<table7>`.`<table7>`_id AND instructor.name LIKE '%Ryan Kellogg%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND `<table7>`.`<table7>`_id > ( SELECT SEMESTERalias1.`<table7>`_id FROM `<table7>` AS SEMESTERalias1 WHERE SEMESTERalias1.`<table7>` = 'WN' AND SEMESTERalias1.year = 2016 ) ORDER BY `<table7>`.`<table7>`_id LIMIT 1
When is the next time 248 , taught by Ryan Kellogg be offered ?
<table0>[company] { <col0>[INT]:[name] <col1>[VARCHAR]:[255] <col2>[country]:[VARCHAR] } <table1>[extraction] { <col0>[company_id]:[INT] <col1>[mineral]:[VARCHAR] <col2>[255]:[INT] }
SELECT DISTINCT e.mineral FROM `<table1>` e JOIN company c ON e.company_id = c.id WHERE c.country LIKE '%South America%' AND e.amount > 1000;
Which minerals were extracted in quantities greater than 1000 tons by companies that have mining operations in South America?
<table0>[table_name_39] { <col0>[crowd]:[INTEGER] <col1>[away_team]:[VARCHAR] }
SELECT AVG( `<col0>` ) FROM `<table0>` WHERE `<col1>` = "south melbourne"
What is the size of the crowd for the game where the away team South Melbourne played?
<table0>[phone_market] { <col0>[Market_ID]:[int] <col1>[Phone_ID]:[text] <col2>[Num_of_stock]:[int] } <table1>[market] { <col0>[Market_ID]:[int] <col1>[District]:[text] <col2>[Num_of_employees]:[int] <col3>[Num_of_shops]:[real] <col4>[Ranking]:[int] } <table2>[phone] { <col0>[text]:[Phone_ID] <col1>[int]:[Memory_in_G] <col2>[int]:[Carrier] <col3>[text]:[Price] }
SELECT Name, COUNT( Name ) FROM `<table0>` AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID GROUP BY Name
I want to compare the number of the names of phones by a bar chart.
<table0>[patients] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[gender]:[text] <col3>[dob]:[time] <col4>[dod]:[time] } <table1>[procedures_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table2>[admissions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[admittime]:[time] <col4>[dischtime]:[time] <col5>[admission_type]:[text] <col6>[admission_location]:[text] <col7>[discharge_location]:[text] <col8>[insurance]:[text] <col9>[language]:[text] <col10>[marital_status]:[text] <col11>[ethnicity]:[text] <col12>[age]:[number] } <table3>[transfers] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[eventtype]:[text] <col5>[careunit]:[text] <col6>[wardid]:[number] <col7>[intime]:[time] <col8>[outtime]:[time] } <table4>[diagnoses_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table5>[microbiologyevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[charttime]:[time] <col4>[spec_type_desc]:[text] <col5>[org_name]:[text] } <table6>[chartevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[itemid]:[number] <col5>[charttime]:[time] <col6>[valuenum]:[number] <col7>[valueuom]:[text] } <table7>[d_labitems] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] } <table8>[labevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[itemid]:[number] <col4>[charttime]:[time] <col5>[valuenum]:[number] <col6>[valueuom]:[text] } <table9>[inputevents_cv] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] } <table10>[d_icd_diagnoses] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table11>[cost] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[event_type]:[text] <col4>[event_id]:[number] <col5>[chargetime]:[time] } <table12>[outputevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] <col6>[value]:[number] } <table13>[d_items] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] <col3>[linksto]:[text] } <table14>[d_icd_procedures] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table15>[icustays] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[first_careunit]:[text] <col5>[last_careunit]:[text] <col6>[first_wardid]:[number] <col7>[last_wardid]:[number] <col8>[intime]:[time] <col9>[outtime]:[time] } <table16>[prescriptions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[startdate]:[time] <col4>[enddate]:[time] <col5>[drug]:[text] <col6>[dose_val_rx]:[text] <col7>[dose_unit_rx]:[text] <col8>[route]:[text] }
SELECT AVG( `<table8>`.valuenum ) FROM `<table8>` WHERE `<table8>`.hadm_id IN ( SELECT `<table2>`.hadm_id FROM `<table2>` WHERE `<table2>`.subject_id = 15794 AND `<table2>`.dischtime IS NULL ) AND `<table8>`.itemid IN ( SELECT `<table7>`.itemid FROM `<table7>` WHERE `<table7>`.label = 'rbc, pleural' ) GROUP BY STRFTIME( '%y-%m-%d', `<table8>`.charttime )
what is the daily average amount of rbc, pleural patient 15794 has on the current hospital visit?
<table0>[chartevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[itemid]:[number] <col5>[charttime]:[time] <col6>[valuenum]:[number] <col7>[valueuom]:[text] } <table1>[diagnoses_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table2>[outputevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] <col6>[value]:[number] } <table3>[procedures_icd] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icd9_code]:[text] <col4>[charttime]:[time] } <table4>[d_icd_procedures] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table5>[d_items] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] <col3>[linksto]:[text] } <table6>[prescriptions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[startdate]:[time] <col4>[enddate]:[time] <col5>[drug]:[text] <col6>[dose_val_rx]:[text] <col7>[dose_unit_rx]:[text] <col8>[route]:[text] } <table7>[transfers] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[eventtype]:[text] <col5>[careunit]:[text] <col6>[wardid]:[number] <col7>[intime]:[time] <col8>[outtime]:[time] } <table8>[admissions] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[admittime]:[time] <col4>[dischtime]:[time] <col5>[admission_type]:[text] <col6>[admission_location]:[text] <col7>[discharge_location]:[text] <col8>[insurance]:[text] <col9>[language]:[text] <col10>[marital_status]:[text] <col11>[ethnicity]:[text] <col12>[age]:[number] } <table9>[inputevents_cv] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[charttime]:[time] <col5>[itemid]:[number] } <table10>[cost] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[event_type]:[text] <col4>[event_id]:[number] <col5>[chargetime]:[time] } <table11>[patients] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[gender]:[text] <col3>[dob]:[time] <col4>[dod]:[time] } <table12>[d_icd_diagnoses] { <col0>[row_id]:[number] <col1>[icd9_code]:[text] <col2>[short_title]:[text] <col3>[long_title]:[text] } <table13>[d_labitems] { <col0>[row_id]:[number] <col1>[itemid]:[number] <col2>[label]:[text] } <table14>[microbiologyevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[charttime]:[time] <col4>[spec_type_desc]:[text] <col5>[org_name]:[text] } <table15>[icustays] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[icustay_id]:[number] <col4>[first_careunit]:[text] <col5>[last_careunit]:[text] <col6>[first_wardid]:[number] <col7>[last_wardid]:[number] <col8>[intime]:[time] <col9>[outtime]:[time] } <table16>[labevents] { <col0>[row_id]:[number] <col1>[subject_id]:[number] <col2>[hadm_id]:[number] <col3>[itemid]:[number] <col4>[charttime]:[time] <col5>[valuenum]:[number] <col6>[valueuom]:[text] }
SELECT STRFTIME( '%j', `<table15>`.outtime ) - STRFTIME( '%j', `<table15>`.intime ) FROM `<table15>` WHERE `<table15>`.hadm_id IN ( SELECT `<table8>`.hadm_id FROM `<table8>` WHERE `<table8>`.subject_id = 18877 ) AND NOT `<table15>`.outtime IS NULL ORDER BY `<table15>`.intime LIMIT 1
show me the length of stay of patient 18877 from the first stay in the icu.
<table0>[table_15077] { <col0>[Episode]:[text] <col1>[aired]:[text] <col2>[Entrepreneur]:[text] <col3>[Company]:[product] <col4>[name]:[text] <col5>[Money]:[requested] <col6>[u00a3]:[real] <col7>[Investing]:[Dragon] }
SELECT SUM( "Money requested ( \u00a3 )" ) FROM `<table0>` WHERE "First aired" = '4 september 2011'
how much money was requested on the show which aired on 4 september 2011?
<table0>[table_53525] { <col0>[Position]:[real] <col1>[Club]:[text] <col2>[Played]:[real] <col3>[Points]:[text] <col4>[Wins]:[real] <col5>[Draws]:[real] <col6>[Losses]:[real] <col7>[Goals]:[real] <col8>[Goals]:[real] <col9>[Goal]:[Difference] }
SELECT MAX( "Goals against" ) FROM `<table0>` WHERE "Wins" = '19' AND "Goals for" > '53'
Which highest 'goals against' number had wins of 19 and a 'goals for' number that was bigger than 53?
<table0>[table_24856332_4] { <col0>[steals]:[INTEGER] <col1>[minutes]:[VARCHAR] }
SELECT MAX( `<col0>` ) FROM `<table0>` WHERE `<col1>` = 324
What is the highest number of steals for a player with 324 minutes?
<table0>[table_203_860] { <col0>[number]:[rank] <col1>[number]:[city] <col2>[text]:[population] <col3>[2011]:[number] <col4>[population]:[2001] <col5>[number]:[state] <col6>[territory]:[text] }
SELECT "population ( 2001 )" FROM `<table0>` WHERE "city" = 'thanjavur'
thanjavur has a population in 2001 of only how many ?
<table0>[Buildings] { <col0>[BuildingID]:[INT] <col1>[BuildingType]:[VARCHAR] <col2>[SquareFootage]:[FLOAT] }
SELECT BuildingType, SUM( `<col2>` ) AS TotalSquareFootage FROM `<table0>` GROUP BY BuildingType;
What is the total square footage of each building type?
<table0>[policy] { <col0>[policy_id]:[INT] <col1>[policy_type]:[VARCHAR] <col2>[effective_date]:[DATE] }
SELECT `<table0>`_id, effective_date, MAX( CASE WHEN `<table0>`_type = 'Personal Auto' THEN `<table0>`_type END ) AS Personal_Auto, MAX( CASE WHEN `<table0>`_type = 'Commercial Auto' THEN `<table0>`_type END ) AS Commercial_Auto FROM `<table0>` GROUP BY `<table0>`_id, effective_date;
Show all policy records for policy type 'Personal Auto' as separate columns for policy ID, effective date, and a column for each policy type value
<table0>[businesses] { <col0>[business_id]:[integer] <col1>[name]:[text] <col2>[address]:[text] <col3>[city]:[text] <col4>[postal_code]:[text] <col5>[latitude]:[real] <col6>[longitude]:[real] <col7>[phone_number]:[integer] <col8>[tax_code]:[text] <col9>[business_certificate]:[integer] <col10>[application_date]:[date] <col11>[owner_name]:[text] <col12>[owner_address]:[text] <col13>[owner_city]:[text] <col14>[owner_state]:[text] <col15>[owner_zip]:[text] } <table1>[inspections] { <col0>[business_id]:[integer] <col1>[score]:[integer] <col2>[date]:[date] <col3>[type]:[text] } <table2>[violations] { <col0>[business_id]:[integer] <col1>[date]:[date] <col2>[violation_type_id]:[text] <col3>[risk_category]:[text] <col4>[description]:[text] }
SELECT COUNT( T1.business_id ) FROM `<table2>` AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.business_certificate = '304977' AND T1.`date` = '2013-10-07'
For the business whose business certificate number is 304977, how many violations did it have on 2013/10/7?
<table0>[rural_infrastructure] { <col0>[project_name]:[VARCHAR] <col1>[country]:[VARCHAR] <col2>[project_start_date]:[DATE] <col3>[project_end_date]:[DATE] <col4>[budget]:[DECIMAL] }
SELECT project_name, country, `<col2>` FROM `<table0>` WHERE `<col4>` > 1000000 AND `<col3>` >= DATEADD( year, -5, GETDATE( ) );
Show the rural infrastructure projects that have a budget over $1 million and were completed in the last 5 years, including the project name, country, and start date.
<table0>[table_name_20] { <col0>[league]:[VARCHAR] <col1>[attendance_average]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "7,975"
Which League showed 7,975 for an average attendance?
<table0>[manufacturers] { <col0>[revenue]:[INTEGER] <col1>[headquarter]:[VARCHAR] }
SELECT SUM( `<col0>` ) FROM `<table0>` WHERE `<col0>` > ( SELECT MIN( `<col0>` ) FROM `<table0>` WHERE `<col1>` = 'Austin' )
Find the total revenue of companies whose revenue is larger than the revenue of some companies based in Austin.
<table0>[greatermanchestercrime] { <col0>[crimeid]:[text] <col1>[crimets]:[time] <col2>[location]:[text] <col3>[lsoa]:[text] <col4>[type]:[text] <col5>[outcome]:[text] }
SELECT `<col4>` FROM `<table0>` WHERE `<col5>` = "Investigation complete; no suspect identified" GROUP BY `<col4>` ORDER BY COUNT( * ) DESC LIMIT 1
Which type of crime has the most investigation complete cases?
<table0>[Exhibitions] { <col0>[INT]:[museum_id] <col1>[INT]:[name] <col2>[VARCHAR]:[255] <col3>[visitor_count]:[INT] } <table1>[Museums] { <col0>[INT]:[name] <col1>[VARCHAR]:[255] <col2>[region]:[VARCHAR] <col3>[255]:[INSERT] <col4>[Exhibitions]:[museum_id] <col5>[name]:[visitor_count] <col6>[VALUES]:[African] <col7>[Art]:[500] <col8>[Egyptian]:[Antiquities] <col9>[800]:[Modern] <col10>[Art]:[300] }
SELECT e.name, e.visitor_count FROM `<table0>` e JOIN Museums m ON e.museum_id = m.id WHERE m.region = 'Africa';
List all exhibitions with their visitor count for museums in Africa.
<table0>[table_78629] { <col0>[joule]:[text] <col1>[watt]:[hour] <col2>[text]:[kilowatt] <col3>[hour]:[text] <col4>[electronvolt]:[text] <col5>[calorie]:[text] }
SELECT "calorie" FROM `<table0>` WHERE "watt hour" = '1'
How many calories is 1 watt hour?
<table0>[soccer_teams] { <col0>[team_id]:[INT] <col1>[name]:[VARCHAR] } <table1>[soccer_games] { <col0>[game_id]:[INT] <col1>[home_team]:[INT] <col2>[away_team]:[INT] <col3>[home_team_score]:[INT] <col4>[away_team_score]:[INT] <col5>[INSERT]:[soccer_teams] <col6>[team_id]:[name] <col7>[VALUES]:[Manchester] <col8>[United]:[Liverpool] <col9>[Arsenal]:[INSERT] }
SELECT name AS team, SUM( `<col3>` ) AS total_home_points, SUM( `<col4>` ) AS total_away_points, SUM( `<col3>` + `<col4>` ) AS total_points FROM `<table1>` JOIN soccer_teams ON `<table1>`.home_team = soccer_teams.team_id OR `<table1>`.away_team = soccer_teams.team_id GROUP BY name;
What is the total number of points scored by each team in the 'soccer_games' table?
<table0>[PostsWithDeleted] { <col0>[number]:[PostTypeId] <col1>[number]:[AcceptedAnswerId] <col2>[number]:[ParentId] <col3>[number]:[CreationDate] <col4>[time]:[DeletionDate] <col5>[time]:[Score] <col6>[number]:[ViewCount] <col7>[number]:[Body] <col8>[text]:[OwnerUserId] <col9>[number]:[OwnerDisplayName] <col10>[text]:[LastEditorUserId] <col11>[number]:[LastEditorDisplayName] <col12>[text]:[LastEditDate] <col13>[time]:[LastActivityDate] <col14>[time]:[Title] <col15>[text]:[Tags] <col16>[text]:[AnswerCount] <col17>[number]:[CommentCount] <col18>[number]:[FavoriteCount] <col19>[number]:[ClosedDate] <col20>[time]:[CommunityOwnedDate] <col21>[time]:[ContentLicense] } <table1>[ReviewTaskResults] { <col0>[number]:[ReviewTaskId] <col1>[number]:[ReviewTaskResultTypeId] <col2>[number]:[CreationDate] <col3>[time]:[RejectionReasonId] <col4>[number]:[Comment] } <table2>[SuggestedEditVotes] { <col0>[number]:[SuggestedEditId] <col1>[number]:[UserId] <col2>[number]:[VoteTypeId] <col3>[number]:[CreationDate] <col4>[time]:[TargetUserId] <col5>[number]:[TargetRepChange] } <table3>[Votes] { <col0>[number]:[PostId] <col1>[number]:[VoteTypeId] <col2>[number]:[UserId] <col3>[number]:[CreationDate] <col4>[time]:[BountyAmount] } <table4>[CloseAsOffTopicReasonTypes] { <col0>[number]:[IsUniversal] <col1>[boolean]:[InputTitle] <col2>[text]:[MarkdownInputGuidance] <col3>[text]:[MarkdownPostOwnerGuidance] <col4>[text]:[MarkdownPrivilegedUserGuidance] <col5>[text]:[MarkdownConcensusDescription] <col6>[text]:[CreationDate] <col7>[time]:[CreationModeratorId] <col8>[number]:[ApprovalDate] <col9>[time]:[ApprovalModeratorId] <col10>[number]:[DeactivationDate] <col11>[time]:[DeactivationModeratorId] } <table5>[SuggestedEdits] { <col0>[number]:[PostId] <col1>[number]:[CreationDate] <col2>[time]:[ApprovalDate] <col3>[time]:[RejectionDate] <col4>[time]:[OwnerUserId] <col5>[number]:[Comment] <col6>[text]:[Text] <col7>[text]:[Title] <col8>[text]:[Tags] <col9>[text]:[RevisionGUID] } <table6>[FlagTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table7>[PostHistoryTypes] { <col0>[number]:[text] } <table8>[PostFeedback] { <col0>[number]:[PostId] <col1>[number]:[IsAnonymous] <col2>[boolean]:[VoteTypeId] <col3>[number]:[CreationDate] } <table9>[PostHistory] { <col0>[number]:[PostHistoryTypeId] <col1>[number]:[PostId] <col2>[number]:[RevisionGUID] <col3>[CreationDate]:[time] <col4>[UserId]:[number] <col5>[UserDisplayName]:[text] <col6>[Comment]:[text] <col7>[Text]:[text] <col8>[ContentLicense]:[text] } <table10>[Users] { <col0>[number]:[Reputation] <col1>[number]:[CreationDate] <col2>[time]:[DisplayName] <col3>[text]:[LastAccessDate] <col4>[time]:[WebsiteUrl] <col5>[text]:[Location] <col6>[text]:[AboutMe] <col7>[text]:[Views] <col8>[number]:[UpVotes] <col9>[number]:[DownVotes] <col10>[number]:[ProfileImageUrl] <col11>[text]:[EmailHash] <col12>[text]:[AccountId] } <table11>[PendingFlags] { <col0>[number]:[FlagTypeId] <col1>[number]:[PostId] <col2>[number]:[CreationDate] <col3>[time]:[CloseReasonTypeId] <col4>[number]:[CloseAsOffTopicReasonTypeId] <col5>[number]:[DuplicateOfQuestionId] <col6>[number]:[BelongsOnBaseHostAddress] } <table12>[PostNoticeTypes] { <col0>[number]:[ClassId] <col1>[number]:[text] <col2>[Body]:[text] <col3>[IsHidden]:[boolean] <col4>[Predefined]:[boolean] <col5>[PostNoticeDurationId]:[number] } <table13>[ReviewTaskResultTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table14>[Badges] { <col0>[number]:[UserId] <col1>[number]:[text] <col2>[Date]:[time] <col3>[Class]:[number] <col4>[TagBased]:[boolean] } <table15>[PostNotices] { <col0>[number]:[PostId] <col1>[number]:[PostNoticeTypeId] <col2>[number]:[CreationDate] <col3>[time]:[DeletionDate] <col4>[time]:[ExpiryDate] <col5>[time]:[Body] <col6>[text]:[OwnerUserId] <col7>[number]:[DeletionUserId] } <table16>[Posts] { <col0>[number]:[PostTypeId] <col1>[number]:[AcceptedAnswerId] <col2>[number]:[ParentId] <col3>[number]:[CreationDate] <col4>[time]:[DeletionDate] <col5>[time]:[Score] <col6>[number]:[ViewCount] <col7>[number]:[Body] <col8>[text]:[OwnerUserId] <col9>[number]:[OwnerDisplayName] <col10>[text]:[LastEditorUserId] <col11>[number]:[LastEditorDisplayName] <col12>[text]:[LastEditDate] <col13>[time]:[LastActivityDate] <col14>[time]:[Title] <col15>[text]:[Tags] <col16>[text]:[AnswerCount] <col17>[number]:[CommentCount] <col18>[number]:[FavoriteCount] <col19>[number]:[ClosedDate] <col20>[time]:[CommunityOwnedDate] <col21>[time]:[ContentLicense] } <table17>[PostLinks] { <col0>[number]:[CreationDate] <col1>[time]:[PostId] <col2>[number]:[RelatedPostId] <col3>[number]:[LinkTypeId] } <table18>[Comments] { <col0>[number]:[PostId] <col1>[number]:[Score] <col2>[number]:[Text] <col3>[text]:[CreationDate] <col4>[time]:[UserDisplayName] <col5>[text]:[UserId] <col6>[number]:[ContentLicense] } <table19>[ReviewTasks] { <col0>[number]:[ReviewTaskTypeId] <col1>[number]:[CreationDate] <col2>[time]:[DeletionDate] <col3>[time]:[ReviewTaskStateId] <col4>[number]:[PostId] <col5>[number]:[SuggestedEditId] <col6>[number]:[CompletedByReviewTaskId] } <table20>[PostTypes] { <col0>[number]:[text] } <table21>[CloseReasonTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table22>[ReviewTaskTypes] { <col0>[number]:[text] <col1>[Description]:[text] } <table23>[VoteTypes] { <col0>[number]:[text] } <table24>[Tags] { <col0>[number]:[TagName] <col1>[text]:[Count] <col2>[number]:[ExcerptPostId] <col3>[number]:[WikiPostId] } <table25>[PostTags] { <col0>[PostId]:[number] <col1>[TagId]:[number] } <table26>[ReviewTaskStates] { <col0>[number]:[text] <col1>[Description]:[text] } <table27>[ReviewRejectionReasons] { <col0>[number]:[text] <col1>[Description]:[text] <col2>[PostTypeId]:[number] } <table28>[TagSynonyms] { <col0>[number]:[SourceTagName] <col1>[text]:[TargetTagName] <col2>[text]:[CreationDate] <col3>[time]:[OwnerUserId] <col4>[number]:[AutoRenameCount] <col5>[number]:[LastAutoRename] <col6>[time]:[Score] <col7>[number]:[ApprovedByUserId] <col8>[number]:[ApprovalDate] }
SELECT Id AS "post_link", Body, CreationDate AS "date" FROM `<table16>` WHERE Body LIKE '%$%' AND NOT Body LIKE '%$%$%'
Find posts with broken MathJax (single dollar sign).
<table0>[CommunityHealthWorkers] { <col0>[WorkerID]:[INT] <col1>[Age]:[INT] <col2>[Gender]:[VARCHAR] <col3>[255]:[INSERT] }
SELECT Gender, AVG( `<col1>` ) as AvgAge FROM `<table0>` GROUP BY Gender;
What is the average age of community health workers by their gender?
<table0>[Events] { <col0>[Event_ID]:[INTEGER] <col1>[Service_ID]:[INTEGER] <col2>[Event_Details]:[VARCHAR] } <table1>[Participants_in_Events] { <col0>[Event_ID]:[INTEGER] <col1>[Participant_ID]:[INTEGER] } <table2>[Participants] { <col0>[Participant_ID]:[INTEGER] <col1>[Participant_Type_Code]:[CHAR] <col2>[Participant_Details]:[VARCHAR] } <table3>[Services] { <col0>[Service_ID]:[INTEGER] <col1>[Service_Type_Code]:[CHAR] }
SELECT Event_Details, COUNT( `<col2>` ) FROM `<table0>` GROUP BY `<col2>`
Group and count details for the events using a pie chart.
<table0>[table_name_47] { <col0>[date]:[VARCHAR] <col1>[visiting_team]:[VARCHAR] }
SELECT `<col0>` FROM `<table0>` WHERE `<col1>` = "philadelphia eagles"
Name the date with visiting team of philadelphia eagles
<table0>[table_36988] { <col0>[Round]:[real] <col1>[Player]:[text] <col2>[Position]:[text] <col3>[Nationality]:[text] <col4>[College]:[Junior] <col5>[Club]:[Team] <col6>[League]:[text] }
SELECT "Player" FROM `<table0>` WHERE "Round" > '1' AND "Nationality" = 'austria'
What player has a round larger than 1 in Austria?
<table0>[procedures] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] } <table1>[lab] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[itemid]:[text] <col3>[charttime]:[text] <col4>[flag]:[text] <col5>[value_unit]:[text] <col6>[label]:[text] <col7>[fluid]:[text] } <table2>[demographic] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[name]:[text] <col3>[marital_status]:[text] <col4>[age]:[text] <col5>[dob]:[text] <col6>[gender]:[text] <col7>[language]:[text] <col8>[religion]:[text] <col9>[admission_type]:[text] <col10>[days_stay]:[text] <col11>[insurance]:[text] <col12>[ethnicity]:[text] <col13>[expire_flag]:[text] <col14>[admission_location]:[text] <col15>[discharge_location]:[text] <col16>[diagnosis]:[text] <col17>[dod]:[text] <col18>[dob_year]:[text] <col19>[dod_year]:[text] <col20>[admittime]:[text] <col21>[dischtime]:[text] <col22>[admityear]:[text] } <table3>[prescriptions] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icustay_id]:[text] <col3>[drug_type]:[text] <col4>[drug]:[text] <col5>[formulary_drug_cd]:[text] <col6>[route]:[text] <col7>[drug_dose]:[text] } <table4>[diagnoses] { <col0>[subject_id]:[text] <col1>[hadm_id]:[text] <col2>[icd9_code]:[text] <col3>[short_title]:[text] <col4>[long_title]:[text] }
SELECT `<table2>`.diagnosis FROM `<table2>` WHERE `<table2>`.name = "Robert Clayton"
find the primary disease of robert clayton.
<table0>[products] { <col0>[product_id]:[int] <col1>[name]:[varchar] <col2>[255]:[category] <col3>[varchar]:[255] <col4>[price]:[decimal] }
SELECT MAX( `<col4>` ) FROM `<table0>` WHERE category = 'Electronics';
What is the maximum price of products in the 'Electronics' category?
<table0>[citizen_feedback_records] { <col0>[state]:[VARCHAR] <col1>[response_time]:[INT] }
SELECT AVG( `<col1>` ) FROM `<table0>` WHERE `<col0>` = 'Florida';
What is the average response time for citizen feedback records in the state of Florida?
<table0>[COURSE] { <col0>[CRS_CODE]:[varchar] <col1>[DEPT_CODE]:[varchar] <col2>[CRS_DESCRIPTION]:[varchar] <col3>[CRS_CREDIT]:[float] } <table1>[PROFESSOR] { <col0>[EMP_NUM]:[int] <col1>[DEPT_CODE]:[varchar] <col2>[PROF_OFFICE]:[varchar] <col3>[PROF_EXTENSION]:[varchar] <col4>[PROF_HIGH_DEGREE]:[varchar] } <table2>[STUDENT] { <col0>[STU_NUM]:[int] <col1>[STU_LNAME]:[varchar] <col2>[STU_FNAME]:[varchar] <col3>[STU_INIT]:[varchar] <col4>[STU_DOB]:[datetime] <col5>[STU_HRS]:[int] <col6>[STU_CLASS]:[varchar] <col7>[STU_GPA]:[float] <col8>[STU_TRANSFER]:[numeric] <col9>[DEPT_CODE]:[varchar] <col10>[STU_PHONE]:[varchar] <col11>[PROF_NUM]:[int] } <table3>[CLASS] { <col0>[CLASS_CODE]:[varchar] <col1>[CRS_CODE]:[varchar] <col2>[CLASS_SECTION]:[varchar] <col3>[CLASS_TIME]:[varchar] <col4>[CLASS_ROOM]:[varchar] <col5>[PROF_NUM]:[int] } <table4>[EMPLOYEE] { <col0>[EMP_NUM]:[int] <col1>[EMP_LNAME]:[varchar] <col2>[EMP_FNAME]:[varchar] <col3>[EMP_INITIAL]:[varchar] <col4>[EMP_JOBCODE]:[varchar] <col5>[EMP_HIREDATE]:[datetime] <col6>[EMP_DOB]:[datetime] } <table5>[ENROLL] { <col0>[CLASS_CODE]:[varchar] <col1>[STU_NUM]:[int] <col2>[ENROLL_GRADE]:[varchar] } <table6>[DEPARTMENT] { <col0>[DEPT_CODE]:[varchar] <col1>[DEPT_NAME]:[varchar] <col2>[SCHOOL_CODE]:[varchar] <col3>[EMP_NUM]:[int] <col4>[DEPT_ADDRESS]:[varchar] <col5>[DEPT_EXTENSION]:[varchar] }
SELECT EMP_FNAME, COUNT( EMP_FNAME ) FROM `<table3>` AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM GROUP BY CRS_CODE, EMP_FNAME ORDER BY COUNT( EMP_FNAME )
Show the number of courses each instructor taught in a stacked bar chart The x-axis is the instructor's first name and group by course code, could you rank total number from low to high order please?