Instruction: What is the Right ascension of the Object type spiral galaxy that has an Apparent magnitude larger that 12.2

Input:
CREATE TABLE table_name_15 (
    right_ascension___j2000__ VARCHAR,
    object_type VARCHAR,
    apparent_magnitude VARCHAR
)

Response: SELECT right_ascension___j2000__ FROM table_name_15 WHERE object_type = "spiral galaxy" AND apparent_magnitude > 12.2

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the Right ascension of the Object type spiral galaxy that has an Apparent magnitude larger that 12.2 ### Input: CREATE TABLE table_name_15 (
    right_ascension___j2000__ VARCHAR,
    object_type VARCHAR,
    apparent_magnitude VARCHAR
) ### Response: SELECT right_ascension___j2000__ FROM table_name_15 WHERE object_type = "spiral galaxy" AND apparent_magnitude > 12.2


Instruction: Who was the young rider classification when Alessandro Petacchi won?

Input:
CREATE TABLE table_30586 (
    "Stage" real,
    "Winner" text,
    "General classification" text,
    "Points classification" text,
    "Mountains classification" text,
    "Young rider classification" text
)

Response: SELECT "Young rider classification" FROM table_30586 WHERE "Winner" = 'Alessandro Petacchi'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who was the young rider classification when Alessandro Petacchi won? ### Input: CREATE TABLE table_30586 (
    "Stage" real,
    "Winner" text,
    "General classification" text,
    "Points classification" text,
    "Mountains classification" text,
    "Young rider classification" text
) ### Response: SELECT "Young rider classification" FROM table_30586 WHERE "Winner" = 'Alessandro Petacchi'


Instruction: Total number of posts by months.

Input:
CREATE TABLE ReviewTaskResultTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE CloseAsOffTopicReasonTypes (
    Id number,
    IsUniversal boolean,
    InputTitle text,
    MarkdownInputGuidance text,
    MarkdownPostOwnerGuidance text,
    MarkdownPrivilegedUserGuidance text,
    MarkdownConcensusDescription text,
    CreationDate time,
    CreationModeratorId number,
    ApprovalDate time,
    ApprovalModeratorId number,
    DeactivationDate time,
    DeactivationModeratorId number
)

CREATE TABLE PostLinks (
    Id number,
    CreationDate time,
    PostId number,
    RelatedPostId number,
    LinkTypeId number
)

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE ReviewRejectionReasons (
    Id number,
    Name text,
    Description text,
    PostTypeId number
)

CREATE TABLE CloseReasonTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostTypes (
    Id number,
    Name text
)

CREATE TABLE PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

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 SuggestedEditVotes (
    Id number,
    SuggestedEditId number,
    UserId number,
    VoteTypeId number,
    CreationDate time,
    TargetUserId number,
    TargetRepChange number
)

CREATE TABLE ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

CREATE TABLE ReviewTaskStates (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PendingFlags (
    Id number,
    FlagTypeId number,
    PostId number,
    CreationDate time,
    CloseReasonTypeId number,
    CloseAsOffTopicReasonTypeId number,
    DuplicateOfQuestionId number,
    BelongsOnBaseHostAddress text
)

CREATE TABLE Votes (
    Id number,
    PostId number,
    VoteTypeId number,
    UserId number,
    CreationDate time,
    BountyAmount number
)

CREATE TABLE PostsWithDeleted (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE Comments (
    Id number,
    PostId number,
    Score number,
    Text text,
    CreationDate time,
    UserDisplayName text,
    UserId number,
    ContentLicense text
)

CREATE TABLE Tags (
    Id number,
    TagName text,
    Count number,
    ExcerptPostId number,
    WikiPostId number
)

CREATE TABLE ReviewTaskTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE Badges (
    Id number,
    UserId number,
    Name text,
    Date time,
    Class number,
    TagBased boolean
)

CREATE TABLE PostTags (
    PostId number,
    TagId number
)

CREATE TABLE PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

CREATE TABLE Users (
    Id number,
    Reputation number,
    CreationDate time,
    DisplayName text,
    LastAccessDate time,
    WebsiteUrl text,
    Location text,
    AboutMe text,
    Views number,
    UpVotes number,
    DownVotes number,
    ProfileImageUrl text,
    EmailHash text,
    AccountId number
)

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

CREATE TABLE Posts (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE SuggestedEdits (
    Id number,
    PostId number,
    CreationDate time,
    ApprovalDate time,
    RejectionDate time,
    OwnerUserId number,
    Comment text,
    Text text,
    Title text,
    Tags text,
    RevisionGUID other
)

CREATE TABLE PostNoticeTypes (
    Id number,
    ClassId number,
    Name text,
    Body text,
    IsHidden boolean,
    Predefined boolean,
    PostNoticeDurationId number
)

CREATE TABLE ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

CREATE TABLE PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
)

Response: SELECT COUNT(*) FROM Posts

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Total number of posts by months. ### Input: CREATE TABLE ReviewTaskResultTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE CloseAsOffTopicReasonTypes (
    Id number,
    IsUniversal boolean,
    InputTitle text,
    MarkdownInputGuidance text,
    MarkdownPostOwnerGuidance text,
    MarkdownPrivilegedUserGuidance text,
    MarkdownConcensusDescription text,
    CreationDate time,
    CreationModeratorId number,
    ApprovalDate time,
    ApprovalModeratorId number,
    DeactivationDate time,
    DeactivationModeratorId number
)

CREATE TABLE PostLinks (
    Id number,
    CreationDate time,
    PostId number,
    RelatedPostId number,
    LinkTypeId number
)

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE ReviewRejectionReasons (
    Id number,
    Name text,
    Description text,
    PostTypeId number
)

CREATE TABLE CloseReasonTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostTypes (
    Id number,
    Name text
)

CREATE TABLE PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

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 SuggestedEditVotes (
    Id number,
    SuggestedEditId number,
    UserId number,
    VoteTypeId number,
    CreationDate time,
    TargetUserId number,
    TargetRepChange number
)

CREATE TABLE ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

CREATE TABLE ReviewTaskStates (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PendingFlags (
    Id number,
    FlagTypeId number,
    PostId number,
    CreationDate time,
    CloseReasonTypeId number,
    CloseAsOffTopicReasonTypeId number,
    DuplicateOfQuestionId number,
    BelongsOnBaseHostAddress text
)

CREATE TABLE Votes (
    Id number,
    PostId number,
    VoteTypeId number,
    UserId number,
    CreationDate time,
    BountyAmount number
)

CREATE TABLE PostsWithDeleted (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE Comments (
    Id number,
    PostId number,
    Score number,
    Text text,
    CreationDate time,
    UserDisplayName text,
    UserId number,
    ContentLicense text
)

CREATE TABLE Tags (
    Id number,
    TagName text,
    Count number,
    ExcerptPostId number,
    WikiPostId number
)

CREATE TABLE ReviewTaskTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE Badges (
    Id number,
    UserId number,
    Name text,
    Date time,
    Class number,
    TagBased boolean
)

CREATE TABLE PostTags (
    PostId number,
    TagId number
)

CREATE TABLE PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

CREATE TABLE Users (
    Id number,
    Reputation number,
    CreationDate time,
    DisplayName text,
    LastAccessDate time,
    WebsiteUrl text,
    Location text,
    AboutMe text,
    Views number,
    UpVotes number,
    DownVotes number,
    ProfileImageUrl text,
    EmailHash text,
    AccountId number
)

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

CREATE TABLE Posts (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE SuggestedEdits (
    Id number,
    PostId number,
    CreationDate time,
    ApprovalDate time,
    RejectionDate time,
    OwnerUserId number,
    Comment text,
    Text text,
    Title text,
    Tags text,
    RevisionGUID other
)

CREATE TABLE PostNoticeTypes (
    Id number,
    ClassId number,
    Name text,
    Body text,
    IsHidden boolean,
    Predefined boolean,
    PostNoticeDurationId number
)

CREATE TABLE ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

CREATE TABLE PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
) ### Response: SELECT COUNT(*) FROM Posts


Instruction: what are the four most frequently ordered lab tests for patients who had previously received ven cath renal dialysis within the same month, in 2104?

Input:
CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto 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 labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE 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 diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime 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 cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name 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 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
)

Response: SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'ven cath renal dialysis') AND STRFTIME('%y', procedures_icd.charttime) = '2104') AS t1 JOIN (SELECT admissions.subject_id, labevents.itemid, labevents.charttime FROM labevents JOIN admissions ON labevents.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', labevents.charttime) = '2104') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t1.charttime, 'start of month') = DATETIME(t2.charttime, 'start of month') GROUP BY t2.itemid) AS t3 WHERE t3.c1 <= 4)

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what are the four most frequently ordered lab tests for patients who had previously received ven cath renal dialysis within the same month, in 2104? ### Input: CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto 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 labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE 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 diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime 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 cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name 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 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
) ### Response: SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'ven cath renal dialysis') AND STRFTIME('%y', procedures_icd.charttime) = '2104') AS t1 JOIN (SELECT admissions.subject_id, labevents.itemid, labevents.charttime FROM labevents JOIN admissions ON labevents.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', labevents.charttime) = '2104') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t1.charttime, 'start of month') = DATETIME(t2.charttime, 'start of month') GROUP BY t2.itemid) AS t3 WHERE t3.c1 <= 4)


Instruction: What is Status, when Newspaper/Magazine is Al-Thawra?

Input:
CREATE TABLE table_name_24 (
    status VARCHAR,
    newspaper_magazine VARCHAR
)

Response: SELECT status FROM table_name_24 WHERE newspaper_magazine = "al-thawra"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is Status, when Newspaper/Magazine is Al-Thawra? ### Input: CREATE TABLE table_name_24 (
    status VARCHAR,
    newspaper_magazine VARCHAR
) ### Response: SELECT status FROM table_name_24 WHERE newspaper_magazine = "al-thawra"


Instruction: Where Date is september 13, 1998 what is result?

Input:
CREATE TABLE table_name_89 (
    result VARCHAR,
    date VARCHAR
)

Response: SELECT result FROM table_name_89 WHERE date = "september 13, 1998"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Where Date is september 13, 1998 what is result? ### Input: CREATE TABLE table_name_89 (
    result VARCHAR,
    date VARCHAR
) ### Response: SELECT result FROM table_name_89 WHERE date = "september 13, 1998"


Instruction: If the Country of Origin is Denmark and the year of introduction is 1962, what is the primary cartridge?

Input:
CREATE TABLE table_28657 (
    "Name / designation" text,
    "Year of introduction" text,
    "Country of origin" text,
    "Primary cartridge" text,
    "primary user" text
)

Response: SELECT "Primary cartridge" FROM table_28657 WHERE "Year of introduction" = '1962' AND "Country of origin" = 'Denmark'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: If the Country of Origin is Denmark and the year of introduction is 1962, what is the primary cartridge? ### Input: CREATE TABLE table_28657 (
    "Name / designation" text,
    "Year of introduction" text,
    "Country of origin" text,
    "Primary cartridge" text,
    "primary user" text
) ### Response: SELECT "Primary cartridge" FROM table_28657 WHERE "Year of introduction" = '1962' AND "Country of origin" = 'Denmark'


Instruction: Which 3rd run has rank of 8?

Input:
CREATE TABLE table_79697 (
    "Rank" real,
    "Name" text,
    "1st run" text,
    "2nd run" text,
    "3rd run" text,
    "Total" real
)

Response: SELECT "3rd run" FROM table_79697 WHERE "Rank" = '8'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which 3rd run has rank of 8? ### Input: CREATE TABLE table_79697 (
    "Rank" real,
    "Name" text,
    "1st run" text,
    "2nd run" text,
    "3rd run" text,
    "Total" real
) ### Response: SELECT "3rd run" FROM table_79697 WHERE "Rank" = '8'


Instruction: For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the amount of hire_date bin hire_date by time.

Input:
CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

CREATE TABLE jobs (
    JOB_ID varchar(10),
    JOB_TITLE varchar(35),
    MIN_SALARY decimal(6,0),
    MAX_SALARY decimal(6,0)
)

CREATE TABLE departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_ID decimal(4,0)
)

CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

CREATE TABLE job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE employees (
    EMPLOYEE_ID decimal(6,0),
    FIRST_NAME varchar(20),
    LAST_NAME varchar(25),
    EMAIL varchar(25),
    PHONE_NUMBER varchar(20),
    HIRE_DATE date,
    JOB_ID varchar(10),
    SALARY decimal(8,2),
    COMMISSION_PCT decimal(2,2),
    MANAGER_ID decimal(6,0),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
)

Response: SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the amount of hire_date bin hire_date by time. ### Input: CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

CREATE TABLE jobs (
    JOB_ID varchar(10),
    JOB_TITLE varchar(35),
    MIN_SALARY decimal(6,0),
    MAX_SALARY decimal(6,0)
)

CREATE TABLE departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_ID decimal(4,0)
)

CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

CREATE TABLE job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE employees (
    EMPLOYEE_ID decimal(6,0),
    FIRST_NAME varchar(20),
    LAST_NAME varchar(25),
    EMAIL varchar(25),
    PHONE_NUMBER varchar(20),
    HIRE_DATE date,
    JOB_ID varchar(10),
    SALARY decimal(8,2),
    COMMISSION_PCT decimal(2,2),
    MANAGER_ID decimal(6,0),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
) ### Response: SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'


Instruction: What is the type of allergy Cat?

Input:
CREATE TABLE allergy_type (
    allergy text,
    allergytype text
)

CREATE TABLE has_allergy (
    stuid number,
    allergy text
)

CREATE TABLE student (
    stuid number,
    lname text,
    fname text,
    age number,
    sex text,
    major number,
    advisor number,
    city_code text
)

Response: SELECT allergytype FROM allergy_type WHERE allergy = "Cat"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the type of allergy Cat? ### Input: CREATE TABLE allergy_type (
    allergy text,
    allergytype text
)

CREATE TABLE has_allergy (
    stuid number,
    allergy text
)

CREATE TABLE student (
    stuid number,
    lname text,
    fname text,
    age number,
    sex text,
    major number,
    advisor number,
    city_code text
) ### Response: SELECT allergytype FROM allergy_type WHERE allergy = "Cat"


Instruction: Which venue did Luke Blackwell serve as captain?

Input:
CREATE TABLE table_18796 (
    "Season" real,
    "Premiers" text,
    "Runners Up" text,
    "Score" text,
    "Captain" text,
    "Coach" text,
    "Simpson Medal" text,
    "Venue" text,
    "Attendance" real,
    "Umpires" text
)

Response: SELECT "Venue" FROM table_18796 WHERE "Captain" = 'Luke Blackwell'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which venue did Luke Blackwell serve as captain? ### Input: CREATE TABLE table_18796 (
    "Season" real,
    "Premiers" text,
    "Runners Up" text,
    "Score" text,
    "Captain" text,
    "Coach" text,
    "Simpson Medal" text,
    "Venue" text,
    "Attendance" real,
    "Umpires" text
) ### Response: SELECT "Venue" FROM table_18796 WHERE "Captain" = 'Luke Blackwell'


Instruction: When the driver peter gethin has a grid less than 25, what is the average number of laps?

Input:
CREATE TABLE table_55351 (
    "Driver" text,
    "Constructor" text,
    "Laps" real,
    "Time/Retired" text,
    "Grid" real
)

Response: SELECT AVG("Laps") FROM table_55351 WHERE "Driver" = 'peter gethin' AND "Grid" < '25'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When the driver peter gethin has a grid less than 25, what is the average number of laps? ### Input: CREATE TABLE table_55351 (
    "Driver" text,
    "Constructor" text,
    "Laps" real,
    "Time/Retired" text,
    "Grid" real
) ### Response: SELECT AVG("Laps") FROM table_55351 WHERE "Driver" = 'peter gethin' AND "Grid" < '25'


Instruction: How many people attended the game when Larry Hughes(33) was the leading scorer and cleveland was visiting?

Input:
CREATE TABLE table_35910 (
    "Date" text,
    "Visitor" text,
    "Score" text,
    "Home" text,
    "Leading scorer" text,
    "Attendance" real,
    "Record" text
)

Response: SELECT SUM("Attendance") FROM table_35910 WHERE "Visitor" = 'cleveland' AND "Leading scorer" = 'larry hughes(33)'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many people attended the game when Larry Hughes(33) was the leading scorer and cleveland was visiting? ### Input: CREATE TABLE table_35910 (
    "Date" text,
    "Visitor" text,
    "Score" text,
    "Home" text,
    "Leading scorer" text,
    "Attendance" real,
    "Record" text
) ### Response: SELECT SUM("Attendance") FROM table_35910 WHERE "Visitor" = 'cleveland' AND "Leading scorer" = 'larry hughes(33)'


Instruction: What is the original team of the celebrity who had the result 08 fired in week 10 (2008-03-06)

Input:
CREATE TABLE table_489 (
    "Celebrity" text,
    "Background" text,
    "Original Team" text,
    "Age" real,
    "Hometown" text,
    "Charity" text,
    "Result" text,
    "Raised" text
)

Response: SELECT "Original Team" FROM table_489 WHERE "Result" = '08 Fired in week 10 (2008-03-06)'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the original team of the celebrity who had the result 08 fired in week 10 (2008-03-06) ### Input: CREATE TABLE table_489 (
    "Celebrity" text,
    "Background" text,
    "Original Team" text,
    "Age" real,
    "Hometown" text,
    "Charity" text,
    "Result" text,
    "Raised" text
) ### Response: SELECT "Original Team" FROM table_489 WHERE "Result" = '08 Fired in week 10 (2008-03-06)'


Instruction: what is the total number of title ?

Input:
CREATE TABLE table_204_265 (
    id number,
    "no." number,
    "title (latin)" text,
    "title (english translation)" text,
    "subject" text,
    "date" text
)

Response: SELECT COUNT("subject") FROM table_204_265

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the total number of title ? ### Input: CREATE TABLE table_204_265 (
    id number,
    "no." number,
    "title (latin)" text,
    "title (english translation)" text,
    "subject" text,
    "date" text
) ### Response: SELECT COUNT("subject") FROM table_204_265


Instruction: who won the south after esc geretsried did during the 2006-07 season ?

Input:
CREATE TABLE table_204_1 (
    id number,
    "season" text,
    "north" text,
    "south" text,
    "east" text,
    "west" text
)

Response: SELECT "south" FROM table_204_1 WHERE id = (SELECT id FROM table_204_1 WHERE "south" = 'esc geretsried') + 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: who won the south after esc geretsried did during the 2006-07 season ? ### Input: CREATE TABLE table_204_1 (
    id number,
    "season" text,
    "north" text,
    "south" text,
    "east" text,
    "west" text
) ### Response: SELECT "south" FROM table_204_1 WHERE id = (SELECT id FROM table_204_1 WHERE "south" = 'esc geretsried') + 1


Instruction: Where is the home ground for the club coached by nick pantsaras and founded before 1946?

Input:
CREATE TABLE table_44900 (
    "Team" text,
    "Coach" text,
    "Home Ground" text,
    "Location" text,
    "Founded" real
)

Response: SELECT "Home Ground" FROM table_44900 WHERE "Founded" < '1946' AND "Coach" = 'nick pantsaras'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Where is the home ground for the club coached by nick pantsaras and founded before 1946? ### Input: CREATE TABLE table_44900 (
    "Team" text,
    "Coach" text,
    "Home Ground" text,
    "Location" text,
    "Founded" real
) ### Response: SELECT "Home Ground" FROM table_44900 WHERE "Founded" < '1946' AND "Coach" = 'nick pantsaras'


Instruction: How many years were g Tyres and Minardi m187 used?

Input:
CREATE TABLE table_name_82 (
    year INTEGER,
    tyres VARCHAR,
    chassis VARCHAR
)

Response: SELECT AVG(year) FROM table_name_82 WHERE tyres = "g" AND chassis = "minardi m187"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many years were g Tyres and Minardi m187 used? ### Input: CREATE TABLE table_name_82 (
    year INTEGER,
    tyres VARCHAR,
    chassis VARCHAR
) ### Response: SELECT AVG(year) FROM table_name_82 WHERE tyres = "g" AND chassis = "minardi m187"


Instruction: What was the result of the game against the Miami Dolphins held at the Riverfront Stadium?

Input:
CREATE TABLE table_78664 (
    "Week" text,
    "Date" text,
    "Opponent" text,
    "Result" text,
    "Location" text
)

Response: SELECT "Result" FROM table_78664 WHERE "Location" = 'riverfront stadium' AND "Opponent" = 'miami dolphins'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the result of the game against the Miami Dolphins held at the Riverfront Stadium? ### Input: CREATE TABLE table_78664 (
    "Week" text,
    "Date" text,
    "Opponent" text,
    "Result" text,
    "Location" text
) ### Response: SELECT "Result" FROM table_78664 WHERE "Location" = 'riverfront stadium' AND "Opponent" = 'miami dolphins'


Instruction: Who directed the totle 'tjockare n vatten'?

Input:
CREATE TABLE table_20709 (
    "Number in series" real,
    "Broadcast Order" text,
    "Title" text,
    "Directed by" text,
    "Written by" text,
    "Original airdate" text,
    "Production Code" real
)

Response: SELECT "Directed by" FROM table_20709 WHERE "Title" = 'Tjockare än vatten'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who directed the totle 'tjockare n vatten'? ### Input: CREATE TABLE table_20709 (
    "Number in series" real,
    "Broadcast Order" text,
    "Title" text,
    "Directed by" text,
    "Written by" text,
    "Original airdate" text,
    "Production Code" real
) ### Response: SELECT "Directed by" FROM table_20709 WHERE "Title" = 'Tjockare än vatten'


Instruction: When did the archbishop that was ordained a bishop on July 25, 1902 die?

Input:
CREATE TABLE table_44491 (
    "Archbishop" text,
    "Born" text,
    "Ordained Priest" text,
    "Ordained Bishop" text,
    "Appointed Archbishop" text,
    "Vacated throne" text,
    "Died" text
)

Response: SELECT "Died" FROM table_44491 WHERE "Ordained Bishop" = 'july 25, 1902'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When did the archbishop that was ordained a bishop on July 25, 1902 die? ### Input: CREATE TABLE table_44491 (
    "Archbishop" text,
    "Born" text,
    "Ordained Priest" text,
    "Ordained Bishop" text,
    "Appointed Archbishop" text,
    "Vacated throne" text,
    "Died" text
) ### Response: SELECT "Died" FROM table_44491 WHERE "Ordained Bishop" = 'july 25, 1902'


Instruction: How many rain figures are provided for sunlight hours in 1966?

Input:
CREATE TABLE table_17829 (
    "City/Town" text,
    "July av. T" text,
    "Rain" text,
    "Days with rain (year/summer)" text,
    "Days with frost" real,
    "Sunlight hours" real
)

Response: SELECT COUNT("Rain") FROM table_17829 WHERE "Sunlight hours" = '1966'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many rain figures are provided for sunlight hours in 1966? ### Input: CREATE TABLE table_17829 (
    "City/Town" text,
    "July av. T" text,
    "Rain" text,
    "Days with rain (year/summer)" text,
    "Days with frost" real,
    "Sunlight hours" real
) ### Response: SELECT COUNT("Rain") FROM table_17829 WHERE "Sunlight hours" = '1966'


Instruction: Show the different countries and the number of members from each with a bar chart, rank by the bar in ascending.

Input:
CREATE TABLE round (
    Round_ID int,
    Member_ID int,
    Decoration_Theme text,
    Rank_in_Round int
)

CREATE TABLE member (
    Member_ID int,
    Name text,
    Country text,
    College_ID int
)

CREATE TABLE college (
    College_ID int,
    Name text,
    Leader_Name text,
    College_Location text
)

Response: SELECT Country, COUNT(*) FROM member GROUP BY Country ORDER BY Country

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show the different countries and the number of members from each with a bar chart, rank by the bar in ascending. ### Input: CREATE TABLE round (
    Round_ID int,
    Member_ID int,
    Decoration_Theme text,
    Rank_in_Round int
)

CREATE TABLE member (
    Member_ID int,
    Name text,
    Country text,
    College_ID int
)

CREATE TABLE college (
    College_ID int,
    Name text,
    Leader_Name text,
    College_Location text
) ### Response: SELECT Country, COUNT(*) FROM member GROUP BY Country ORDER BY Country


Instruction: Bar chart of total number of height from each sex

Input:
CREATE TABLE candidate (
    Candidate_ID int,
    People_ID int,
    Poll_Source text,
    Date text,
    Support_rate real,
    Consider_rate real,
    Oppose_rate real,
    Unsure_rate real
)

CREATE TABLE people (
    People_ID int,
    Sex text,
    Name text,
    Date_of_Birth text,
    Height real,
    Weight real
)

Response: SELECT Sex, SUM(Height) FROM people GROUP BY Sex

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Bar chart of total number of height from each sex ### Input: CREATE TABLE candidate (
    Candidate_ID int,
    People_ID int,
    Poll_Source text,
    Date text,
    Support_rate real,
    Consider_rate real,
    Oppose_rate real,
    Unsure_rate real
)

CREATE TABLE people (
    People_ID int,
    Sex text,
    Name text,
    Date_of_Birth text,
    Height real,
    Weight real
) ### Response: SELECT Sex, SUM(Height) FROM people GROUP BY Sex


Instruction: what was the first time until 05/2100 patient 002-52932 was prescribed a medication via a misc route?

Input:
CREATE TABLE diagnosis (
    diagnosisid number,
    patientunitstayid number,
    diagnosisname text,
    diagnosistime time,
    icd9code text
)

CREATE TABLE microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime time
)

CREATE TABLE lab (
    labid number,
    patientunitstayid number,
    labname text,
    labresult number,
    labresulttime time
)

CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

CREATE TABLE allergy (
    allergyid number,
    patientunitstayid number,
    drugname text,
    allergyname text,
    allergytime time
)

CREATE TABLE medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime time
)

CREATE TABLE treatment (
    treatmentid number,
    patientunitstayid number,
    treatmentname text,
    treatmenttime time
)

CREATE TABLE patient (
    uniquepid text,
    patienthealthsystemstayid number,
    patientunitstayid number,
    gender text,
    age text,
    ethnicity text,
    hospitalid number,
    wardid number,
    admissionheight number,
    admissionweight number,
    dischargeweight number,
    hospitaladmittime time,
    hospitaladmitsource text,
    unitadmittime time,
    unitdischargetime time,
    hospitaldischargetime time,
    hospitaldischargestatus text
)

CREATE TABLE cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

CREATE TABLE vitalperiodic (
    vitalperiodicid number,
    patientunitstayid number,
    temperature number,
    sao2 number,
    heartrate number,
    respiration number,
    systemicsystolic number,
    systemicdiastolic number,
    systemicmean number,
    observationtime time
)

Response: SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-52932')) AND medication.routeadmin = 'misc' AND STRFTIME('%y-%m', medication.drugstarttime) <= '2100-05' ORDER BY medication.drugstarttime LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the first time until 05/2100 patient 002-52932 was prescribed a medication via a misc route? ### Input: CREATE TABLE diagnosis (
    diagnosisid number,
    patientunitstayid number,
    diagnosisname text,
    diagnosistime time,
    icd9code text
)

CREATE TABLE microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime time
)

CREATE TABLE lab (
    labid number,
    patientunitstayid number,
    labname text,
    labresult number,
    labresulttime time
)

CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

CREATE TABLE allergy (
    allergyid number,
    patientunitstayid number,
    drugname text,
    allergyname text,
    allergytime time
)

CREATE TABLE medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime time
)

CREATE TABLE treatment (
    treatmentid number,
    patientunitstayid number,
    treatmentname text,
    treatmenttime time
)

CREATE TABLE patient (
    uniquepid text,
    patienthealthsystemstayid number,
    patientunitstayid number,
    gender text,
    age text,
    ethnicity text,
    hospitalid number,
    wardid number,
    admissionheight number,
    admissionweight number,
    dischargeweight number,
    hospitaladmittime time,
    hospitaladmitsource text,
    unitadmittime time,
    unitdischargetime time,
    hospitaldischargetime time,
    hospitaldischargestatus text
)

CREATE TABLE cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

CREATE TABLE vitalperiodic (
    vitalperiodicid number,
    patientunitstayid number,
    temperature number,
    sao2 number,
    heartrate number,
    respiration number,
    systemicsystolic number,
    systemicdiastolic number,
    systemicmean number,
    observationtime time
) ### Response: SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-52932')) AND medication.routeadmin = 'misc' AND STRFTIME('%y-%m', medication.drugstarttime) <= '2100-05' ORDER BY medication.drugstarttime LIMIT 1


Instruction: how many times have there been helps by damon stoudamire (13)

Input:
CREATE TABLE table_802 (
    "Game" real,
    "Date" text,
    "Team" text,
    "Score" text,
    "High points" text,
    "High rebounds" text,
    "High assists" text,
    "Location Attendance" text,
    "Record" text
)

Response: SELECT COUNT("Record") FROM table_802 WHERE "High assists" = 'Damon Stoudamire (13)'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many times have there been helps by damon stoudamire (13) ### Input: CREATE TABLE table_802 (
    "Game" real,
    "Date" text,
    "Team" text,
    "Score" text,
    "High points" text,
    "High rebounds" text,
    "High assists" text,
    "Location Attendance" text,
    "Record" text
) ### Response: SELECT COUNT("Record") FROM table_802 WHERE "High assists" = 'Damon Stoudamire (13)'


Instruction: Show all payment method codes and the number of orders for each code. Visualize by pie chart.

Input:
CREATE TABLE Products (
    Product_ID VARCHAR(100),
    Product_Name VARCHAR(255),
    Product_Price DECIMAL(20,4),
    Product_Description VARCHAR(255),
    Other_Product_Service_Details VARCHAR(255)
)

CREATE TABLE Customer_Orders (
    Order_ID INTEGER,
    Customer_ID INTEGER,
    Store_ID INTEGER,
    Order_Date DATETIME,
    Planned_Delivery_Date DATETIME,
    Actual_Delivery_Date DATETIME,
    Other_Order_Details VARCHAR(255)
)

CREATE TABLE Bookings_Services (
    Order_ID INTEGER,
    Product_ID INTEGER
)

CREATE TABLE Addresses (
    Address_ID VARCHAR(100),
    Line_1 VARCHAR(255),
    Line_2 VARCHAR(255),
    City_Town VARCHAR(255),
    State_County VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Stores (
    Store_ID VARCHAR(100),
    Address_ID INTEGER,
    Marketing_Region_Code CHAR(15),
    Store_Name VARCHAR(255),
    Store_Phone VARCHAR(255),
    Store_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Customers (
    Customer_ID VARCHAR(100),
    Address_ID INTEGER,
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Customer_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Drama_Workshop_Groups (
    Workshop_Group_ID INTEGER,
    Address_ID INTEGER,
    Currency_Code CHAR(15),
    Marketing_Region_Code CHAR(15),
    Store_Name VARCHAR(255),
    Store_Phone VARCHAR(255),
    Store_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Performers (
    Performer_ID INTEGER,
    Address_ID INTEGER,
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Customer_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Order_Items (
    Order_Item_ID INTEGER,
    Order_ID INTEGER,
    Product_ID INTEGER,
    Order_Quantity VARCHAR(288),
    Other_Item_Details VARCHAR(255)
)

CREATE TABLE Marketing_Regions (
    Marketing_Region_Code CHAR(15),
    Marketing_Region_Name VARCHAR(255),
    Marketing_Region_Descriptrion VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Ref_Payment_Methods (
    payment_method_code CHAR(10),
    payment_method_description VARCHAR(80)
)

CREATE TABLE Invoices (
    Invoice_ID INTEGER,
    Order_ID INTEGER,
    payment_method_code CHAR(15),
    Product_ID INTEGER,
    Order_Quantity VARCHAR(288),
    Other_Item_Details VARCHAR(255),
    Order_Item_ID INTEGER
)

CREATE TABLE Ref_Service_Types (
    Service_Type_Code CHAR(15),
    Parent_Service_Type_Code CHAR(15),
    Service_Type_Description VARCHAR(255)
)

CREATE TABLE Bookings (
    Booking_ID INTEGER,
    Customer_ID INTEGER,
    Workshop_Group_ID VARCHAR(100),
    Status_Code CHAR(15),
    Store_ID INTEGER,
    Order_Date DATETIME,
    Planned_Delivery_Date DATETIME,
    Actual_Delivery_Date DATETIME,
    Other_Order_Details VARCHAR(255)
)

CREATE TABLE Invoice_Items (
    Invoice_Item_ID INTEGER,
    Invoice_ID INTEGER,
    Order_ID INTEGER,
    Order_Item_ID INTEGER,
    Product_ID INTEGER,
    Order_Quantity INTEGER,
    Other_Item_Details VARCHAR(255)
)

CREATE TABLE Services (
    Service_ID INTEGER,
    Service_Type_Code CHAR(15),
    Workshop_Group_ID INTEGER,
    Product_Description VARCHAR(255),
    Product_Name VARCHAR(255),
    Product_Price DECIMAL(20,4),
    Other_Product_Service_Details VARCHAR(255)
)

CREATE TABLE Performers_in_Bookings (
    Order_ID INTEGER,
    Performer_ID INTEGER
)

CREATE TABLE Clients (
    Client_ID INTEGER,
    Address_ID INTEGER,
    Customer_Email_Address VARCHAR(255),
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Other_Details VARCHAR(255)
)

Response: SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show all payment method codes and the number of orders for each code. Visualize by pie chart. ### Input: CREATE TABLE Products (
    Product_ID VARCHAR(100),
    Product_Name VARCHAR(255),
    Product_Price DECIMAL(20,4),
    Product_Description VARCHAR(255),
    Other_Product_Service_Details VARCHAR(255)
)

CREATE TABLE Customer_Orders (
    Order_ID INTEGER,
    Customer_ID INTEGER,
    Store_ID INTEGER,
    Order_Date DATETIME,
    Planned_Delivery_Date DATETIME,
    Actual_Delivery_Date DATETIME,
    Other_Order_Details VARCHAR(255)
)

CREATE TABLE Bookings_Services (
    Order_ID INTEGER,
    Product_ID INTEGER
)

CREATE TABLE Addresses (
    Address_ID VARCHAR(100),
    Line_1 VARCHAR(255),
    Line_2 VARCHAR(255),
    City_Town VARCHAR(255),
    State_County VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Stores (
    Store_ID VARCHAR(100),
    Address_ID INTEGER,
    Marketing_Region_Code CHAR(15),
    Store_Name VARCHAR(255),
    Store_Phone VARCHAR(255),
    Store_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Customers (
    Customer_ID VARCHAR(100),
    Address_ID INTEGER,
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Customer_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Drama_Workshop_Groups (
    Workshop_Group_ID INTEGER,
    Address_ID INTEGER,
    Currency_Code CHAR(15),
    Marketing_Region_Code CHAR(15),
    Store_Name VARCHAR(255),
    Store_Phone VARCHAR(255),
    Store_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Performers (
    Performer_ID INTEGER,
    Address_ID INTEGER,
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Customer_Email_Address VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Order_Items (
    Order_Item_ID INTEGER,
    Order_ID INTEGER,
    Product_ID INTEGER,
    Order_Quantity VARCHAR(288),
    Other_Item_Details VARCHAR(255)
)

CREATE TABLE Marketing_Regions (
    Marketing_Region_Code CHAR(15),
    Marketing_Region_Name VARCHAR(255),
    Marketing_Region_Descriptrion VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Ref_Payment_Methods (
    payment_method_code CHAR(10),
    payment_method_description VARCHAR(80)
)

CREATE TABLE Invoices (
    Invoice_ID INTEGER,
    Order_ID INTEGER,
    payment_method_code CHAR(15),
    Product_ID INTEGER,
    Order_Quantity VARCHAR(288),
    Other_Item_Details VARCHAR(255),
    Order_Item_ID INTEGER
)

CREATE TABLE Ref_Service_Types (
    Service_Type_Code CHAR(15),
    Parent_Service_Type_Code CHAR(15),
    Service_Type_Description VARCHAR(255)
)

CREATE TABLE Bookings (
    Booking_ID INTEGER,
    Customer_ID INTEGER,
    Workshop_Group_ID VARCHAR(100),
    Status_Code CHAR(15),
    Store_ID INTEGER,
    Order_Date DATETIME,
    Planned_Delivery_Date DATETIME,
    Actual_Delivery_Date DATETIME,
    Other_Order_Details VARCHAR(255)
)

CREATE TABLE Invoice_Items (
    Invoice_Item_ID INTEGER,
    Invoice_ID INTEGER,
    Order_ID INTEGER,
    Order_Item_ID INTEGER,
    Product_ID INTEGER,
    Order_Quantity INTEGER,
    Other_Item_Details VARCHAR(255)
)

CREATE TABLE Services (
    Service_ID INTEGER,
    Service_Type_Code CHAR(15),
    Workshop_Group_ID INTEGER,
    Product_Description VARCHAR(255),
    Product_Name VARCHAR(255),
    Product_Price DECIMAL(20,4),
    Other_Product_Service_Details VARCHAR(255)
)

CREATE TABLE Performers_in_Bookings (
    Order_ID INTEGER,
    Performer_ID INTEGER
)

CREATE TABLE Clients (
    Client_ID INTEGER,
    Address_ID INTEGER,
    Customer_Email_Address VARCHAR(255),
    Customer_Name VARCHAR(255),
    Customer_Phone VARCHAR(255),
    Other_Details VARCHAR(255)
) ### Response: SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code


Instruction: For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and sort y axis in ascending order.

Input:
CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

CREATE TABLE jobs (
    JOB_ID varchar(10),
    JOB_TITLE varchar(35),
    MIN_SALARY decimal(6,0),
    MAX_SALARY decimal(6,0)
)

CREATE TABLE employees (
    EMPLOYEE_ID decimal(6,0),
    FIRST_NAME varchar(20),
    LAST_NAME varchar(25),
    EMAIL varchar(25),
    PHONE_NUMBER varchar(20),
    HIRE_DATE date,
    JOB_ID varchar(10),
    SALARY decimal(8,2),
    COMMISSION_PCT decimal(2,2),
    MANAGER_ID decimal(6,0),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_ID decimal(4,0)
)

CREATE TABLE regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
)

CREATE TABLE job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_ID decimal(4,0)
)

Response: SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID)

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and sort y axis in ascending order. ### Input: CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

CREATE TABLE jobs (
    JOB_ID varchar(10),
    JOB_TITLE varchar(35),
    MIN_SALARY decimal(6,0),
    MAX_SALARY decimal(6,0)
)

CREATE TABLE employees (
    EMPLOYEE_ID decimal(6,0),
    FIRST_NAME varchar(20),
    LAST_NAME varchar(25),
    EMAIL varchar(25),
    PHONE_NUMBER varchar(20),
    HIRE_DATE date,
    JOB_ID varchar(10),
    SALARY decimal(8,2),
    COMMISSION_PCT decimal(2,2),
    MANAGER_ID decimal(6,0),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_ID decimal(4,0)
)

CREATE TABLE regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
)

CREATE TABLE job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_ID decimal(4,0)
) ### Response: SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID)


Instruction: When was the film directed by Pen-Ek Ratanaruang released?

Input:
CREATE TABLE table_name_13 (
    date VARCHAR,
    director VARCHAR
)

Response: SELECT date FROM table_name_13 WHERE director = "pen-ek ratanaruang"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When was the film directed by Pen-Ek Ratanaruang released? ### Input: CREATE TABLE table_name_13 (
    date VARCHAR,
    director VARCHAR
) ### Response: SELECT date FROM table_name_13 WHERE director = "pen-ek ratanaruang"


Instruction: Which rider had a speed of 104.630mph?

Input:
CREATE TABLE table_52741 (
    "Rank" real,
    "Rider" text,
    "Team" text,
    "Speed" text,
    "Time" text
)

Response: SELECT "Rider" FROM table_52741 WHERE "Speed" = '104.630mph'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which rider had a speed of 104.630mph? ### Input: CREATE TABLE table_52741 (
    "Rank" real,
    "Rider" text,
    "Team" text,
    "Speed" text,
    "Time" text
) ### Response: SELECT "Rider" FROM table_52741 WHERE "Speed" = '104.630mph'


Instruction: what is the total number of apps and goals for luther blissett ?

Input:
CREATE TABLE table_204_340 (
    id number,
    "name" text,
    "year inducted" number,
    "position" text,
    "apps" number,
    "goals" number
)

Response: SELECT "apps" + "goals" FROM table_204_340 WHERE "name" = 'luther blissett'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the total number of apps and goals for luther blissett ? ### Input: CREATE TABLE table_204_340 (
    id number,
    "name" text,
    "year inducted" number,
    "position" text,
    "apps" number,
    "goals" number
) ### Response: SELECT "apps" + "goals" FROM table_204_340 WHERE "name" = 'luther blissett'


Instruction: Parts Plus sponsors what driver?

Input:
CREATE TABLE table_name_21 (
    driver_s_ VARCHAR,
    primary_sponsor_s_ VARCHAR
)

Response: SELECT driver_s_ FROM table_name_21 WHERE primary_sponsor_s_ = "parts plus"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Parts Plus sponsors what driver? ### Input: CREATE TABLE table_name_21 (
    driver_s_ VARCHAR,
    primary_sponsor_s_ VARCHAR
) ### Response: SELECT driver_s_ FROM table_name_21 WHERE primary_sponsor_s_ = "parts plus"


Instruction: What is the place when the performance is 60.73m?

Input:
CREATE TABLE table_name_65 (
    place VARCHAR,
    performance VARCHAR
)

Response: SELECT place FROM table_name_65 WHERE performance = "60.73m"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the place when the performance is 60.73m? ### Input: CREATE TABLE table_name_65 (
    place VARCHAR,
    performance VARCHAR
) ### Response: SELECT place FROM table_name_65 WHERE performance = "60.73m"


Instruction: What year was Sam Kazman a producer?

Input:
CREATE TABLE table_name_35 (
    year VARCHAR,
    producer VARCHAR
)

Response: SELECT year FROM table_name_35 WHERE producer = "sam kazman"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What year was Sam Kazman a producer? ### Input: CREATE TABLE table_name_35 (
    year VARCHAR,
    producer VARCHAR
) ### Response: SELECT year FROM table_name_35 WHERE producer = "sam kazman"


Instruction: which team had the largest goal difference ?

Input:
CREATE TABLE table_203_254 (
    id number,
    "position" number,
    "team" text,
    "points" number,
    "played" number,
    "won" number,
    "drawn" number,
    "lost" number,
    "for" number,
    "against" number,
    "difference" number
)

Response: SELECT "team" FROM table_203_254 ORDER BY ABS("difference") DESC LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: which team had the largest goal difference ? ### Input: CREATE TABLE table_203_254 (
    id number,
    "position" number,
    "team" text,
    "points" number,
    "played" number,
    "won" number,
    "drawn" number,
    "lost" number,
    "for" number,
    "against" number,
    "difference" number
) ### Response: SELECT "team" FROM table_203_254 ORDER BY ABS("difference") DESC LIMIT 1


Instruction: how many days have elapsed since the first time patient 30826 stayed in the ward 12 during this hospital encounter?

Input:
CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name text
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title 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 diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto text
)

CREATE TABLE labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value 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 procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE inputevents_cv (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    amount number
)

CREATE TABLE cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE icustays (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    first_careunit text,
    last_careunit text,
    first_wardid number,
    last_wardid number,
    intime time,
    outtime time
)

CREATE TABLE admissions (
    row_id number,
    subject_id number,
    hadm_id number,
    admittime time,
    dischtime time,
    admission_type text,
    admission_location text,
    discharge_location text,
    insurance text,
    language text,
    marital_status text,
    ethnicity text,
    age number
)

CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

Response: SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30826 AND admissions.dischtime IS NULL)) AND transfers.wardid = 12 ORDER BY transfers.intime LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many days have elapsed since the first time patient 30826 stayed in the ward 12 during this hospital encounter? ### Input: CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name text
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title 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 diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto text
)

CREATE TABLE labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value 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 procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE inputevents_cv (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    amount number
)

CREATE TABLE cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE icustays (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    first_careunit text,
    last_careunit text,
    first_wardid number,
    last_wardid number,
    intime time,
    outtime time
)

CREATE TABLE admissions (
    row_id number,
    subject_id number,
    hadm_id number,
    admittime time,
    dischtime time,
    admission_type text,
    admission_location text,
    discharge_location text,
    insurance text,
    language text,
    marital_status text,
    ethnicity text,
    age number
)

CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
) ### Response: SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30826 AND admissions.dischtime IS NULL)) AND transfers.wardid = 12 ORDER BY transfers.intime LIMIT 1


Instruction: What loan expires date has a Date of 29 december 2003?

Input:
CREATE TABLE table_13239 (
    "Position" text,
    "Player" text,
    "Loaned to" text,
    "Date" text,
    "Loan expires" text
)

Response: SELECT "Loan expires" FROM table_13239 WHERE "Date" = '29 december 2003'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What loan expires date has a Date of 29 december 2003? ### Input: CREATE TABLE table_13239 (
    "Position" text,
    "Player" text,
    "Loaned to" text,
    "Date" text,
    "Loan expires" text
) ### Response: SELECT "Loan expires" FROM table_13239 WHERE "Date" = '29 december 2003'


Instruction: Who was the partner that played against Serena Williams Venus Williams?

Input:
CREATE TABLE table_9885 (
    "Outcome" text,
    "Year" real,
    "Championship" text,
    "Surface" text,
    "Partner" text,
    "Opponents in the final" text,
    "Score in the final" text
)

Response: SELECT "Partner" FROM table_9885 WHERE "Opponents in the final" = 'serena williams venus williams'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who was the partner that played against Serena Williams Venus Williams? ### Input: CREATE TABLE table_9885 (
    "Outcome" text,
    "Year" real,
    "Championship" text,
    "Surface" text,
    "Partner" text,
    "Opponents in the final" text,
    "Score in the final" text
) ### Response: SELECT "Partner" FROM table_9885 WHERE "Opponents in the final" = 'serena williams venus williams'


Instruction: What is the name of party with most number of members?

Input:
CREATE TABLE party (
    party_name VARCHAR,
    party_id VARCHAR
)

CREATE TABLE Member (
    party_id VARCHAR
)

Response: SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the name of party with most number of members? ### Input: CREATE TABLE party (
    party_name VARCHAR,
    party_id VARCHAR
)

CREATE TABLE Member (
    party_id VARCHAR
) ### Response: SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1


Instruction: What is the call sign for channel 6?

Input:
CREATE TABLE table_28631 (
    "Channel" real,
    "Channel name" text,
    "Callsign" text,
    "Signal power" text,
    "Broadcast area" text
)

Response: SELECT "Callsign" FROM table_28631 WHERE "Channel" = '6'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the call sign for channel 6? ### Input: CREATE TABLE table_28631 (
    "Channel" real,
    "Channel name" text,
    "Callsign" text,
    "Signal power" text,
    "Broadcast area" text
) ### Response: SELECT "Callsign" FROM table_28631 WHERE "Channel" = '6'


Instruction: What date has a set 4 of 25-19?

Input:
CREATE TABLE table_42037 (
    "Date" text,
    "Score" text,
    "Set 1" text,
    "Set 2" text,
    "Set 3" text,
    "Set 4" text,
    "Set 5" text,
    "Total" text
)

Response: SELECT "Date" FROM table_42037 WHERE "Set 4" = '25-19'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What date has a set 4 of 25-19? ### Input: CREATE TABLE table_42037 (
    "Date" text,
    "Score" text,
    "Set 1" text,
    "Set 2" text,
    "Set 3" text,
    "Set 4" text,
    "Set 5" text,
    "Total" text
) ### Response: SELECT "Date" FROM table_42037 WHERE "Set 4" = '25-19'


Instruction: how many patients were admitted before the year 2135 under procedure icd9 code 3893?

Input:
CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

CREATE TABLE diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2135" AND procedures.icd9_code = "3893"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients were admitted before the year 2135 under procedure icd9 code 3893? ### Input: CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

CREATE TABLE diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
) ### Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2135" AND procedures.icd9_code = "3893"


Instruction: What was the total effic for the quarterbacks?

Input:
CREATE TABLE table_9027 (
    "Name" text,
    "GP-GS" text,
    "Effic" real,
    "Att-Cmp-Int" text,
    "Avg/G" real
)

Response: SELECT MIN("Effic") FROM table_9027 WHERE "Name" = 'total'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the total effic for the quarterbacks? ### Input: CREATE TABLE table_9027 (
    "Name" text,
    "GP-GS" text,
    "Effic" real,
    "Att-Cmp-Int" text,
    "Avg/G" real
) ### Response: SELECT MIN("Effic") FROM table_9027 WHERE "Name" = 'total'


Instruction: When the president was Yoweri Museveni, and the year was 1993, with rank of 6 under political rights, what was the total of civil liberties?

Input:
CREATE TABLE table_name_78 (
    civil_liberties INTEGER,
    year VARCHAR,
    political_rights VARCHAR,
    president VARCHAR
)

Response: SELECT SUM(civil_liberties) FROM table_name_78 WHERE political_rights = 6 AND president = "yoweri museveni" AND year = 1993

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When the president was Yoweri Museveni, and the year was 1993, with rank of 6 under political rights, what was the total of civil liberties? ### Input: CREATE TABLE table_name_78 (
    civil_liberties INTEGER,
    year VARCHAR,
    political_rights VARCHAR,
    president VARCHAR
) ### Response: SELECT SUM(civil_liberties) FROM table_name_78 WHERE political_rights = 6 AND president = "yoweri museveni" AND year = 1993


Instruction: ST. PETERSBURG to DETROIT

Input:
CREATE TABLE equipment_sequence (
    aircraft_code_sequence varchar,
    aircraft_code varchar
)

CREATE TABLE fare (
    fare_id int,
    from_airport varchar,
    to_airport varchar,
    fare_basis_code text,
    fare_airline text,
    restriction_code text,
    one_direction_cost int,
    round_trip_cost int,
    round_trip_required varchar
)

CREATE TABLE time_zone (
    time_zone_code text,
    time_zone_name text,
    hours_from_gmt int
)

CREATE TABLE airport_service (
    city_code varchar,
    airport_code varchar,
    miles_distant int,
    direction varchar,
    minutes_distant int
)

CREATE TABLE restriction (
    restriction_code text,
    advance_purchase int,
    stopovers text,
    saturday_stay_required text,
    minimum_stay int,
    maximum_stay int,
    application text,
    no_discounts text
)

CREATE TABLE month (
    month_number int,
    month_name text
)

CREATE TABLE flight_leg (
    flight_id int,
    leg_number int,
    leg_flight int
)

CREATE TABLE days (
    days_code varchar,
    day_name varchar
)

CREATE TABLE flight (
    aircraft_code_sequence text,
    airline_code varchar,
    airline_flight text,
    arrival_time int,
    connections int,
    departure_time int,
    dual_carrier text,
    flight_days text,
    flight_id int,
    flight_number int,
    from_airport varchar,
    meal_code text,
    stops int,
    time_elapsed int,
    to_airport varchar
)

CREATE TABLE ground_service (
    city_code text,
    airport_code text,
    transport_type text,
    ground_fare int
)

CREATE TABLE aircraft (
    aircraft_code varchar,
    aircraft_description varchar,
    manufacturer varchar,
    basic_type varchar,
    engines int,
    propulsion varchar,
    wide_body varchar,
    wing_span int,
    length int,
    weight int,
    capacity int,
    pay_load int,
    cruising_speed int,
    range_miles int,
    pressurized varchar
)

CREATE TABLE city (
    city_code varchar,
    city_name varchar,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar
)

CREATE TABLE fare_basis (
    fare_basis_code text,
    booking_class text,
    class_type text,
    premium text,
    economy text,
    discounted text,
    night text,
    season text,
    basis_days text
)

CREATE TABLE class_of_service (
    booking_class varchar,
    rank int,
    class_description text
)

CREATE TABLE food_service (
    meal_code text,
    meal_number int,
    compartment text,
    meal_description varchar
)

CREATE TABLE airport (
    airport_code varchar,
    airport_name text,
    airport_location text,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar,
    minimum_connect_time int
)

CREATE TABLE flight_stop (
    flight_id int,
    stop_number int,
    stop_days text,
    stop_airport text,
    arrival_time int,
    arrival_airline text,
    arrival_flight_number int,
    departure_time int,
    departure_airline text,
    departure_flight_number int,
    stop_time int
)

CREATE TABLE date_day (
    month_number int,
    day_number int,
    year int,
    day_name varchar
)

CREATE TABLE code_description (
    code varchar,
    description text
)

CREATE TABLE flight_fare (
    flight_id int,
    fare_id int
)

CREATE TABLE compartment_class (
    compartment varchar,
    class_type varchar
)

CREATE TABLE airline (
    airline_code varchar,
    airline_name text,
    note text
)

CREATE TABLE state (
    state_code text,
    state_name text,
    country_name text
)

CREATE TABLE time_interval (
    period text,
    begin_time int,
    end_time int
)

CREATE TABLE dual_carrier (
    main_airline varchar,
    low_flight_number int,
    high_flight_number int,
    dual_airline varchar,
    service_name text
)

Response: SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ST. PETERSBURG' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DETROIT' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: ST. PETERSBURG to DETROIT ### Input: CREATE TABLE equipment_sequence (
    aircraft_code_sequence varchar,
    aircraft_code varchar
)

CREATE TABLE fare (
    fare_id int,
    from_airport varchar,
    to_airport varchar,
    fare_basis_code text,
    fare_airline text,
    restriction_code text,
    one_direction_cost int,
    round_trip_cost int,
    round_trip_required varchar
)

CREATE TABLE time_zone (
    time_zone_code text,
    time_zone_name text,
    hours_from_gmt int
)

CREATE TABLE airport_service (
    city_code varchar,
    airport_code varchar,
    miles_distant int,
    direction varchar,
    minutes_distant int
)

CREATE TABLE restriction (
    restriction_code text,
    advance_purchase int,
    stopovers text,
    saturday_stay_required text,
    minimum_stay int,
    maximum_stay int,
    application text,
    no_discounts text
)

CREATE TABLE month (
    month_number int,
    month_name text
)

CREATE TABLE flight_leg (
    flight_id int,
    leg_number int,
    leg_flight int
)

CREATE TABLE days (
    days_code varchar,
    day_name varchar
)

CREATE TABLE flight (
    aircraft_code_sequence text,
    airline_code varchar,
    airline_flight text,
    arrival_time int,
    connections int,
    departure_time int,
    dual_carrier text,
    flight_days text,
    flight_id int,
    flight_number int,
    from_airport varchar,
    meal_code text,
    stops int,
    time_elapsed int,
    to_airport varchar
)

CREATE TABLE ground_service (
    city_code text,
    airport_code text,
    transport_type text,
    ground_fare int
)

CREATE TABLE aircraft (
    aircraft_code varchar,
    aircraft_description varchar,
    manufacturer varchar,
    basic_type varchar,
    engines int,
    propulsion varchar,
    wide_body varchar,
    wing_span int,
    length int,
    weight int,
    capacity int,
    pay_load int,
    cruising_speed int,
    range_miles int,
    pressurized varchar
)

CREATE TABLE city (
    city_code varchar,
    city_name varchar,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar
)

CREATE TABLE fare_basis (
    fare_basis_code text,
    booking_class text,
    class_type text,
    premium text,
    economy text,
    discounted text,
    night text,
    season text,
    basis_days text
)

CREATE TABLE class_of_service (
    booking_class varchar,
    rank int,
    class_description text
)

CREATE TABLE food_service (
    meal_code text,
    meal_number int,
    compartment text,
    meal_description varchar
)

CREATE TABLE airport (
    airport_code varchar,
    airport_name text,
    airport_location text,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar,
    minimum_connect_time int
)

CREATE TABLE flight_stop (
    flight_id int,
    stop_number int,
    stop_days text,
    stop_airport text,
    arrival_time int,
    arrival_airline text,
    arrival_flight_number int,
    departure_time int,
    departure_airline text,
    departure_flight_number int,
    stop_time int
)

CREATE TABLE date_day (
    month_number int,
    day_number int,
    year int,
    day_name varchar
)

CREATE TABLE code_description (
    code varchar,
    description text
)

CREATE TABLE flight_fare (
    flight_id int,
    fare_id int
)

CREATE TABLE compartment_class (
    compartment varchar,
    class_type varchar
)

CREATE TABLE airline (
    airline_code varchar,
    airline_name text,
    note text
)

CREATE TABLE state (
    state_code text,
    state_name text,
    country_name text
)

CREATE TABLE time_interval (
    period text,
    begin_time int,
    end_time int
)

CREATE TABLE dual_carrier (
    main_airline varchar,
    low_flight_number int,
    high_flight_number int,
    dual_airline varchar,
    service_name text
) ### Response: SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ST. PETERSBURG' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DETROIT' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code


Instruction: Name the fewest tries for leicester tigers with points less than 207

Input:
CREATE TABLE table_31955 (
    "Points" real,
    "Name" text,
    "Club" text,
    "Tries" real,
    "Drop" real
)

Response: SELECT MIN("Tries") FROM table_31955 WHERE "Club" = 'leicester tigers' AND "Points" < '207'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Name the fewest tries for leicester tigers with points less than 207 ### Input: CREATE TABLE table_31955 (
    "Points" real,
    "Name" text,
    "Club" text,
    "Tries" real,
    "Drop" real
) ### Response: SELECT MIN("Tries") FROM table_31955 WHERE "Club" = 'leicester tigers' AND "Points" < '207'