answer
stringlengths
6
3.91k
question
stringlengths
7
766
context
stringlengths
27
7.14k
SELECT SUM("Rank") FROM table_13632 WHERE "Player" = 'matt ruth'
Which Rank has a Player of matt ruth?
CREATE TABLE table_13632 ( "Rank" real, "Player" text, "County" text, "Tally" text, "Total" real, "Opposition" text )
SELECT 2002 FROM table_27146868_1 WHERE 2009 = "54.0"
What is 2002 when 2009 is 54.0?
CREATE TABLE table_27146868_1 (Id VARCHAR)
SELECT opponent FROM table_name_2 WHERE date = "september 4"
What team did the home team play on September 4?
CREATE TABLE table_name_2 (opponent VARCHAR, date VARCHAR)
SELECT "Venue" FROM table_16703 WHERE "Scores" = '15.13 (103) – 8.4 (52)'
what is the venue where the scores are 15.13 (103) 8.4 (52)?
CREATE TABLE table_16703 ( "Year" real, "Winners" text, "Grand Finalist" text, "Scores" text, "Venue" text, "Crowd" real, "Margin" real, "Season Result" text )
SELECT pro_team FROM table_27132791_3 WHERE position = "DT" AND nfl_team = "Houston Oilers"
If the NFL team is the Houston Oilers and the position is DT, who is the Pro team?
CREATE TABLE table_27132791_3 (pro_team VARCHAR, position VARCHAR, nfl_team VARCHAR)
SELECT known_for FROM table_name_34 WHERE entered = "day 1" AND celebrity = "freddie starr"
What was Freddie Starr, who entered on Day 1, known for?
CREATE TABLE table_name_34 (known_for VARCHAR, entered VARCHAR, celebrity VARCHAR)
SELECT lot_details, COUNT(lot_details) FROM Investors AS T1 JOIN Lots AS T2 ON T1.investor_id = T2.investor_id WHERE T1.Investor_details = "l" GROUP BY lot_details ORDER BY COUNT(lot_details) DESC
A bar chart for returning the number of the lot details of lots that belong to investors with details 'l'?, I want to rank by the how many lot details in descending.
CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Sales ( sales_transaction_id INTEGER, sales_details VARCHAR(255) ) CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40), other_details VARCHAR(255) ) CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) )
SELECT COUNT(player) FROM table_27132791_3 WHERE nfl_team = "Washington Redskins"
How many different players does the Washington Redskins have?
CREATE TABLE table_27132791_3 (player VARCHAR, nfl_team VARCHAR)
SELECT celebrity FROM table_name_64 WHERE exited = "day 12"
Who exited on Day 12?
CREATE TABLE table_name_64 (celebrity VARCHAR, exited VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Medicaid"
how many patients have medicaid health insurance?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
SELECT position FROM table_27132791_3 WHERE college = "Vanderbilt"
If the college is Vanderbilt, what is the position?
CREATE TABLE table_27132791_3 (position VARCHAR, college VARCHAR)
SELECT exited FROM table_name_53 WHERE finished = "12th"
What day did the person who finished in 12th place leave on?
CREATE TABLE table_name_53 (exited VARCHAR, finished VARCHAR)
SELECT COUNT(DISTINCT crs_code) FROM class
What are the number of different course codes?
CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) CREATE TABLE class ( class_code text, crs_code text, class_section text, class_time text, class_room text, prof_num number ) CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number, stu_transfer number, dept_code text, stu_phone text, prof_num number ) CREATE TABLE enroll ( class_code text, stu_num number, enroll_grade text ) CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) CREATE TABLE course ( crs_code text, dept_code text, crs_description text, crs_credit number ) CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text )
SELECT position FROM table_27132791_3 WHERE pro_team = "Jacksonville Bulls"
If the proteam is Jacksonville bulls, what is the position?
CREATE TABLE table_27132791_3 (position VARCHAR, pro_team VARCHAR)
SELECT finished FROM table_name_54 WHERE exited = "day 3"
What place did the person who left on day 3 finish in?
CREATE TABLE table_name_54 (finished VARCHAR, exited VARCHAR)
SELECT u.Reputation FROM Badges AS b LEFT JOIN Users AS u ON u.Id = b.UserId WHERE b.Name = 'Constituent' AND CAST((JULIANDAY(Date) - JULIANDAY('2018-08-06')) * 1440.0 AS INT) > 0
The Reputation of Voters in This Election.
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
SELECT position FROM table_27132791_3 WHERE college = "SMU"
If the college is SMU, what is the position?
CREATE TABLE table_27132791_3 (position VARCHAR, college VARCHAR)
SELECT entered FROM table_name_42 WHERE known_for = "the only way is essex star"
On which day did the person who is known for the only way is essex star enter?
CREATE TABLE table_name_42 (entered VARCHAR, known_for VARCHAR)
SELECT county_name, population FROM county
What are the name and population of each county?
CREATE TABLE county ( county_id number, county_name text, population number, zip_code text ) CREATE TABLE election ( election_id number, counties_represented text, district number, delegate text, party number, first_elected number, committee text ) CREATE TABLE party ( party_id number, year number, party text, governor text, lieutenant_governor text, comptroller text, attorney_general text, us_senate text )
SELECT written_by FROM table_27116696_1 WHERE production_code = "3T7255"
Who wrote the episode with the production code of 3t7255?
CREATE TABLE table_27116696_1 (written_by VARCHAR, production_code VARCHAR)
SELECT known_for FROM table_name_67 WHERE entered = "day 1" AND celebrity = "freddie starr"
What was Freddie Starr, who entered on Day 1, known for?
CREATE TABLE table_name_67 (known_for VARCHAR, entered VARCHAR, celebrity VARCHAR)
SELECT COUNT(week) FROM table_name_36 WHERE venue = "memorial stadium" AND attendance < 41 OFFSET 252
What is the number of weeks where the venue was memorial stadium and the attendance was less than 41,252?
CREATE TABLE table_name_36 ( week VARCHAR, venue VARCHAR, attendance VARCHAR )
SELECT us_viewers__million_ FROM table_27116696_1 WHERE directed_by = "Allison Liddi-Brown"
How many U.S. viewers (million) watched the episode directed by Allison Liddi-Brown?
CREATE TABLE table_27116696_1 (us_viewers__million_ VARCHAR, directed_by VARCHAR)
SELECT date FROM table_name_99 WHERE game_site = "bye" AND week > 1
Name the date for week more than 1 and game site of bye
CREATE TABLE table_name_99 (date VARCHAR, game_site VARCHAR, week VARCHAR)
SELECT (SELECT "attendance" FROM table_204_123 WHERE "date" = 'saturday, april 13') > (SELECT "attendance" FROM table_204_123 WHERE "date" = 'saturday, may 11')
was the attendance more or less in the saturday , april 13th game compared to the saturday , may 11th
CREATE TABLE table_204_123 ( id number, "week" number, "date" text, "kickoff" text, "opponent" text, "results\nfinal score" text, "results\nteam record" text, "game site" text, "attendance" number )
SELECT COUNT(production_code) FROM table_27116696_1 WHERE written_by = "Matthew Lau"
What is the total number of production code listings of episodes written by Matthew Lau?
CREATE TABLE table_27116696_1 (production_code VARCHAR, written_by VARCHAR)
SELECT opponent FROM table_name_39 WHERE date = "bye" AND week = 1
Name the opponent for date of bye and week of 1
CREATE TABLE table_name_39 (opponent VARCHAR, date VARCHAR, week VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "70" AND demographic.admityear < "2203"
among patients admitted in the year less than 2203, how many of them were aged below 70?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
SELECT total_prize_pool FROM table_2715355_1 WHERE location = "New Orleans"
What was the prize pool in New Orleans?
CREATE TABLE table_2715355_1 (total_prize_pool VARCHAR, location VARCHAR)
SELECT opponent FROM table_name_6 WHERE week = 2
Name the opponent for week of 2
CREATE TABLE table_name_6 (opponent VARCHAR, week VARCHAR)
SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'
What are the first name and last name of the players who were paid salary by team Washington Nationals in both 2005 and 2007?
CREATE TABLE salary ( year number, team_id text, league_id text, player_id text, salary number ) CREATE TABLE manager_award_vote ( award_id text, year number, league_id text, player_id text, points_won number, points_max number, votes_first number ) CREATE TABLE manager_award ( player_id text, award_id text, year number, league_id text, tie text, notes number ) CREATE TABLE batting ( player_id text, year number, stint number, team_id text, league_id text, g number, ab number, r number, h number, double number, triple number, hr number, rbi number, sb number, cs number, bb number, so number, ibb number, hbp number, sh number, sf number, g_idp number ) CREATE TABLE fielding_outfield ( player_id text, year number, stint number, glf number, gcf number, grf number ) CREATE TABLE postseason ( year number, round text, team_id_winner text, league_id_winner text, team_id_loser text, league_id_loser text, wins number, losses number, ties number ) CREATE TABLE park ( park_id text, park_name text, park_alias text, city text, state text, country text ) CREATE TABLE manager ( player_id text, year number, team_id text, league_id text, inseason number, g number, w number, l number, rank number, plyr_mgr text ) CREATE TABLE college ( college_id text, name_full text, city text, state text, country text ) CREATE TABLE team_half ( year number, league_id text, team_id text, half number, div_id text, div_win text, rank number, g number, w number, l number ) CREATE TABLE manager_half ( player_id text, year number, team_id text, league_id text, inseason number, half number, g number, w number, l number, rank number ) CREATE TABLE fielding ( player_id text, year number, stint number, team_id text, league_id text, pos text, g number, gs number, inn_outs number, po number, a number, e number, dp number, pb number, wp number, sb number, cs number, zr number ) CREATE TABLE player ( player_id text, birth_year number, birth_month number, birth_day number, birth_country text, birth_state text, birth_city text, death_year number, death_month number, death_day number, death_country text, death_state text, death_city text, name_first text, name_last text, name_given text, weight number, height number, bats text, throws text, debut text, final_game text, retro_id text, bbref_id text ) CREATE TABLE player_college ( player_id text, college_id text, year number ) CREATE TABLE team ( year number, league_id text, team_id text, franchise_id text, div_id text, rank number, g number, ghome number, w number, l number, div_win text, wc_win text, lg_win text, ws_win text, r number, ab number, h number, double number, triple number, hr number, bb number, so number, sb number, cs number, hbp number, sf number, ra number, er number, era number, cg number, sho number, sv number, ipouts number, ha number, hra number, bba number, soa number, e number, dp number, fp number, name text, park text, attendance number, bpf number, ppf number, team_id_br text, team_id_lahman45 text, team_id_retro text ) CREATE TABLE team_franchise ( franchise_id text, franchise_name text, active text, na_assoc text ) CREATE TABLE appearances ( year number, team_id text, league_id text, player_id text, g_all number, gs number, g_batting number, g_defense number, g_p number, g_c number, g_1b number, g_2b number, g_3b number, g_ss number, g_lf number, g_cf number, g_rf number, g_of number, g_dh number, g_ph number, g_pr number ) CREATE TABLE hall_of_fame ( player_id text, yearid number, votedby text, ballots number, needed number, votes number, inducted text, category text, needed_note text ) CREATE TABLE fielding_postseason ( player_id text, year number, team_id text, league_id text, round text, pos text, g number, gs number, inn_outs number, po number, a number, e number, dp number, tp number, pb number, sb number, cs number ) CREATE TABLE player_award ( player_id text, award_id text, year number, league_id text, tie text, notes text ) CREATE TABLE pitching ( player_id text, year number, stint number, team_id text, league_id text, w number, l number, g number, gs number, cg number, sho number, sv number, ipouts number, h number, er number, hr number, bb number, so number, baopp number, era number, ibb number, wp number, hbp number, bk number, bfp number, gf number, r number, sh number, sf number, g_idp number ) CREATE TABLE pitching_postseason ( player_id text, year number, round text, team_id text, league_id text, w number, l number, g number, gs number, cg number, sho number, sv number, ipouts number, h number, er number, hr number, bb number, so number, baopp text, era number, ibb number, wp number, hbp number, bk number, bfp number, gf number, r number, sh number, sf number, g_idp number ) CREATE TABLE home_game ( year number, league_id text, team_id text, park_id text, span_first text, span_last text, games number, openings number, attendance number ) CREATE TABLE batting_postseason ( year number, round text, player_id text, team_id text, league_id text, g number, ab number, r number, h number, double number, triple number, hr number, rbi number, sb number, cs number, bb number, so number, ibb number, hbp number, sh number, sf number, g_idp number ) CREATE TABLE all_star ( player_id text, year number, game_num number, game_id text, team_id text, league_id text, gp number, starting_pos number ) CREATE TABLE player_award_vote ( award_id text, year number, league_id text, player_id text, points_won number, points_max number, votes_first number )
SELECT COUNT(winners) AS Prize FROM table_2715355_1 WHERE entrants = 696
How many prizes were available in the competition where 696 people entered?
CREATE TABLE table_2715355_1 (winners VARCHAR, entrants VARCHAR)
SELECT team_classification FROM table_name_13 WHERE points_classification = "josé maría jiménez" AND winner = "beat zberg"
What is the team classification with a winner of Beat Zberg, and a points classification of José María Jiménez.
CREATE TABLE table_name_13 (team_classification VARCHAR, points_classification VARCHAR, winner VARCHAR)
SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN"
find out the average age of patients whose marital status is single and ethnicity is hispanic/latino - puerto rican.
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
SELECT accession_number FROM table_27155678_2 WHERE genus_species = "Rhodopseudomonas palustris"
Name the accession number for rhodopseudomonas palustris
CREATE TABLE table_27155678_2 (accession_number VARCHAR, genus_species VARCHAR)
SELECT birth FROM table_name_3 WHERE death = "16 july 1946"
When was the person who died on 16 July 1946 born?
CREATE TABLE table_name_3 (birth VARCHAR, death VARCHAR)
SELECT SUM("Year") FROM table_66233 WHERE "Finish" = 'toulouse' AND "Stage" > '12'
What year was finish Toulouse, and stage was larger than 12?
CREATE TABLE table_66233 ( "Year" real, "Stage" real, "Start" text, "Finish" text, "Leader at the summit" text )
SELECT genus_species FROM table_27155678_2 WHERE accession_number = "BX897699.1"
Name the genus/species of accession number bx897699.1
CREATE TABLE table_27155678_2 (genus_species VARCHAR, accession_number VARCHAR)
SELECT spouse FROM table_name_82 WHERE birth = "29 september 1766"
Who is the spouse of the person born on 29 September 1766?
CREATE TABLE table_name_82 (spouse VARCHAR, birth VARCHAR)
SELECT "Outcome" FROM table_36288 WHERE "Date" = '18 july 1993'
WHICH Outcome IS ON 18 july 1993?
CREATE TABLE table_36288 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
SELECT accession_number FROM table_27155678_2 WHERE sequence_similarity = 54
Name the accession number for sequence similarity being 54
CREATE TABLE table_27155678_2 (accession_number VARCHAR, sequence_similarity VARCHAR)
SELECT name FROM table_name_20 WHERE birth = "29 september 1766"
Who is born on 29 September 1766?
CREATE TABLE table_name_20 (name VARCHAR, birth VARCHAR)
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'ventricular tachycardia - sustained' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', diagnosis.diagnosistime) >= '2105') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.diagnosistime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 4
since 2105, what are the top four most frequent diagnoses that patients were given during the same hospital encounter after being diagnosed with ventricular tachycardia - sustained?
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
SELECT gene_name FROM table_27155678_2 WHERE genus_species = "Methylobacterium nodulans"
Name the gene name for methylobacterium nodulans
CREATE TABLE table_27155678_2 (gene_name VARCHAR, genus_species VARCHAR)
SELECT ceased_to_be_queen FROM table_name_3 WHERE birth = "10 may 1788"
Who was born on 10 May 1788 that ceased to be queen?
CREATE TABLE table_name_3 (ceased_to_be_queen VARCHAR, birth VARCHAR)
SELECT COUNT(wins) FROM table_name_48 WHERE draws < 2
What is the total number of Wins, when Draws is less than 2?
CREATE TABLE table_name_48 ( wins VARCHAR, draws INTEGER )
SELECT gene_name FROM table_27155678_2 WHERE accession_number = "BX897700.1"
Name the gene name for accession number bx897700.1
CREATE TABLE table_27155678_2 (gene_name VARCHAR, accession_number VARCHAR)
SELECT marriage FROM table_name_84 WHERE became_queen = "30 october 1816 husband's accession"
How is the marriage of who became queen on 30 October 1816 husband's accession?
CREATE TABLE table_name_84 (marriage VARCHAR, became_queen VARCHAR)
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 3939 ORDER BY admissions.admittime LIMIT 1
what was the first type of hospital admission type of patient 3939?
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
SELECT MIN(_percentage_funded) FROM table_27155990_1 WHERE closing_date = "2012-05-18"
What was the minimum % funded of the project that was closed on 2012-05-18?
CREATE TABLE table_27155990_1 (_percentage_funded INTEGER, closing_date VARCHAR)
SELECT birth FROM table_name_79 WHERE became_queen = "15 april 1820"
When was the person who became queen on 15 April 1820 born?
CREATE TABLE table_name_79 (birth VARCHAR, became_queen VARCHAR)
SELECT "Laid down" FROM table_66047 WHERE "Name" = 'uss cambridge'
What year was the USS Cambridge laid down?
CREATE TABLE table_66047 ( "Hull Number" text, "Name" text, "Builder" text, "Laid down" text, "Launched" text, "Completed" text )
SELECT MAX(total_usd) FROM table_27155990_1 WHERE creator = "Pebble Technology"
What was the maximum total USD collected by Pebble Technology?
CREATE TABLE table_27155990_1 (total_usd INTEGER, creator VARCHAR)
SELECT record FROM table_name_59 WHERE date = "april 2"
What is their record on April 2?
CREATE TABLE table_name_59 (record VARCHAR, date VARCHAR)
SELECT SUM(rank) FROM table_name_89 WHERE player = "lee trevino" AND wins < 27
What is the rank of Lee Trevino, who had less than 27 wins?
CREATE TABLE table_name_89 ( rank INTEGER, player VARCHAR, wins VARCHAR )
SELECT category FROM table_27155990_1 WHERE project_name = "Mighty No. 9"
What was the category of the project name Mighty No. 9?
CREATE TABLE table_27155990_1 (category VARCHAR, project_name VARCHAR)
SELECT loss FROM table_name_8 WHERE record = "11-6"
Which team has the record of 11-6?
CREATE TABLE table_name_8 (loss VARCHAR, record VARCHAR)
SELECT PROF_OFFICE, COUNT(PROF_OFFICE) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY PROF_OFFICE ORDER BY PROF_OFFICE DESC
How many courses for each office? Show me a bar chart, could you show by the x-axis in desc please?
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int )
SELECT COUNT(rank) FROM table_27155990_1 WHERE project_name = "Pebble: E-Paper Watch for iPhone and Android"
Project Name Pebble: E-Paper Watch for Iphone and Android was ranked how many times?
CREATE TABLE table_27155990_1 (rank VARCHAR, project_name VARCHAR)
SELECT record FROM table_name_81 WHERE round > 1
What was his record when he went over 1 round?
CREATE TABLE table_name_81 (record VARCHAR, round INTEGER)
SELECT cancelable FROM table_1507852_5 WHERE bubbles = "Yes"
what's the cancelable with bubbles being yes
CREATE TABLE table_1507852_5 ( cancelable VARCHAR, bubbles VARCHAR )
SELECT league_apps FROM table_27170987_5 WHERE total_goals = 11
How many league apps did the player with 11 team goals have?
CREATE TABLE table_27170987_5 (league_apps VARCHAR, total_goals VARCHAR)
SELECT event FROM table_name_51 WHERE record = "2-0"
What event did he have a 2-0 record?
CREATE TABLE table_name_51 (event VARCHAR, record VARCHAR)
SELECT demographic.religion FROM demographic WHERE demographic.subject_id = "6983"
to which religious background does the patient with patient id 6983 belong to?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
SELECT MIN(total_goals) FROM table_27170987_5 WHERE league_goals = 6
What is the lowest number of total goals for a player with 6 league goals?
CREATE TABLE table_27170987_5 (total_goals INTEGER, league_goals VARCHAR)
SELECT res FROM table_name_80 WHERE opponent = "dan bobish"
What was his result against dan bobish?
CREATE TABLE table_name_80 (res VARCHAR, opponent VARCHAR)
SELECT MAX("Pick") FROM table_37107 WHERE "Round" = '7'
What is the highest numbered pick from round 7?
CREATE TABLE table_37107 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "School/Club Team" text )
SELECT MIN(fa_cup_goals) FROM table_27170987_5
What is the lowest number of fa cup goals by a player?
CREATE TABLE table_27170987_5 (fa_cup_goals INTEGER)
SELECT voltage_center__v_ FROM table_name_76 WHERE s_spec_number = "sk096"
Which Voltage Center (V) has an S-Spec Number of sk096?
CREATE TABLE table_name_76 (voltage_center__v_ VARCHAR, s_spec_number VARCHAR)
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'ac/chr syst/dia hrt fail') AND DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-2 year'))
list patient identifications of patients who were diagnosed with ac/chr syst/dia hrt fail since 2 years ago.
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text )
SELECT written_by FROM table_27169029_1 WHERE original_air_date = "September 26, 2010"
Who wrote the episode that aired on September 26, 2010?
CREATE TABLE table_27169029_1 (written_by VARCHAR, original_air_date VARCHAR)
SELECT voltage_center__v_ FROM table_name_71 WHERE input_clock__mhz_ = "25 x 3" AND part_number = "a80486dx4-75"
Which Voltage Center (V) has an Input Clock (MHz) of 25 x 3, and a Part Number of a80486dx4-75?
CREATE TABLE table_name_71 (voltage_center__v_ VARCHAR, input_clock__mhz_ VARCHAR, part_number VARCHAR)
SELECT premiere FROM table_name_38 WHERE rating = "20.9"
What was the date of the premiere that had a 20.9 rating?
CREATE TABLE table_name_38 ( premiere VARCHAR, rating VARCHAR )
SELECT asia FROM table_27184837_1 WHERE programs = "Radio Stations"
How many radio stations were built in Asia?
CREATE TABLE table_27184837_1 (asia VARCHAR, programs VARCHAR)
SELECT MIN(gold) FROM table_name_57 WHERE total < 2 AND silver > 0
What is the low gold total for under 2 total and over 0 silvers?
CREATE TABLE table_name_57 (gold INTEGER, total VARCHAR, silver VARCHAR)
SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31
What are the number of the dates in which the mean sea level pressure was between 30.3 and 31?
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, max_wind_Speed_mph INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER ) CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT )
SELECT COUNT(asia) FROM table_27184837_1 WHERE americas = 14
How many program data on Asia was written if the organization launched 14 programs iin the Americas?
CREATE TABLE table_27184837_1 (asia VARCHAR, americas VARCHAR)
SELECT COUNT(silver) FROM table_name_62 WHERE total < 6 AND bronze < 0
How many silvers for the nation with under 6 total and under 0 bronze?
CREATE TABLE table_name_62 (silver VARCHAR, total VARCHAR, bronze VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age < "31"
count the number of patients whose marital status is married and age is less than 31?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
SELECT COUNT(australasia) FROM table_27184837_1 WHERE americas = 115
How many times did Australasia received a program if the Americas received 115 program?
CREATE TABLE table_27184837_1 (australasia VARCHAR, americas VARCHAR)
SELECT born___died FROM table_name_1 WHERE notable_for = "professional wrestling"
The person that was notable for professional wrestling had a Born-Died of what year?
CREATE TABLE table_name_1 (born___died VARCHAR, notable_for VARCHAR)
SELECT COUNT("Field goals") FROM table_28062 WHERE "Player" = 'Donald Green'
How many field goals did Donald Green score?
CREATE TABLE table_28062 ( "Player" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
SELECT episode_no_episode_no_refers_to_the_episodes_number_in_the_overall_series, _whereas_series_no_refers_to_the_episodes_number_in_this_particular_series FROM table_27208311_1 WHERE series_no = 3
What is every episode number for the series number 3?
CREATE TABLE table_27208311_1 (episode_no_episode_no_refers_to_the_episodes_number_in_the_overall_series VARCHAR, _whereas_series_no_refers_to_the_episodes_number_in_this_particular_series VARCHAR, series_no VARCHAR)
SELECT born___died FROM table_name_47 WHERE connection_with_australia = "born in sydney"
The person that was born in Sydney died in what year?
CREATE TABLE table_name_47 (born___died VARCHAR, connection_with_australia VARCHAR)
SELECT T2.Location, T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft
Please list the location and the winning aircraft name.
CREATE TABLE aircraft ( Aircraft VARCHAR, Aircraft_ID VARCHAR ) CREATE TABLE MATCH ( Location VARCHAR, Winning_Aircraft VARCHAR )
SELECT episode FROM table_27208311_1 WHERE writer = "Barry Purchese"
What is every episode with Barry Purchese as the writer?
CREATE TABLE table_27208311_1 (episode VARCHAR, writer VARCHAR)
SELECT born___died FROM table_name_1 WHERE notable_for = "tennis"
The person notable for tennis died in what year?
CREATE TABLE table_name_1 (born___died VARCHAR, notable_for VARCHAR)
SELECT lms_spr FROM table_name_60 WHERE car_no = "15"
Which is the LMS SPR when the car number was 15?
CREATE TABLE table_name_60 ( lms_spr VARCHAR, car_no VARCHAR )
SELECT COUNT(episode) FROM table_27208817_1 WHERE writer = "Sam Snape"
Name the number of episodes for sam snape
CREATE TABLE table_27208817_1 (episode VARCHAR, writer VARCHAR)
SELECT record FROM table_name_36 WHERE home = "oakland seals"
What was the record when the team played at Oakland Seals?
CREATE TABLE table_name_36 (record VARCHAR, home VARCHAR)
SELECT "Run 4" FROM table_77470 WHERE "Run 3" = '1:26.63'
Which Run 4 has a Run 3 of 1:26.63?
CREATE TABLE table_77470 ( "Team" text, "Athletes" text, "Run 1" text, "Run 2" text, "Run 3" text, "Run 4" text, "Final" text )
SELECT aspect_ratio FROM table_272313_1 WHERE vertical = 480 AND pixel_aspect_ratio = "1:1"
What was the aspect ratio if the vertical pixel is 480 and pixel aspect ratio is 1:1?
CREATE TABLE table_272313_1 (aspect_ratio VARCHAR, vertical VARCHAR, pixel_aspect_ratio VARCHAR)
SELECT purse FROM table_name_21 WHERE trainer = "aidan o'brien"
What was the purse when the trainer was Aidan O'Brien?
CREATE TABLE table_name_21 (purse VARCHAR, trainer VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.dod_year <= "2115.0"
how many patients died in or before 2115?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
SELECT MIN(vertical) FROM table_272313_1 WHERE aspect_ratio = "16:9" AND scanning = "interlaced"
What was the minimum vertical measurement if the aspect ratio is 16:9 and scanning is interlaced?
CREATE TABLE table_272313_1 (vertical INTEGER, aspect_ratio VARCHAR, scanning VARCHAR)
SELECT time FROM table_name_12 WHERE jockey = "cornelio velasquez"
What is the time for when cornelio velasquez was the jockey?
CREATE TABLE table_name_12 (time VARCHAR, jockey VARCHAR)
SELECT "Chassis" FROM table_80101 WHERE "Year" < '1956' AND "Engine" = 'gordini straight-4' AND "Points" = '3'
Before 1956, what Chassis has Gordini Straight-4 engine with 3 points?
CREATE TABLE table_80101 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
SELECT MAX(vertical) FROM table_272313_1 WHERE horizontal = 640
What was the maximum vertical measurement if the horizon measurement is 640?
CREATE TABLE table_272313_1 (vertical INTEGER, horizontal VARCHAR)
SELECT jockey FROM table_name_75 WHERE owner = "richard pegum"
Who was the jockey when the owner was Richard Pegum?
CREATE TABLE table_name_75 (jockey VARCHAR, owner VARCHAR)
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15666')) AND lab.labname = 'anion gap' AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-157 month')
count the number of times that patient 031-15666 has received a anion gap test in the lab since 157 months ago.
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )