lianghsun/bird-text2sql-bench huggingface dataset:
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
List down the name of dishes that were positioned on the left upper corner.

### Hint
positioned on the left upper corner refers to xpos < 0.25 AND ypos < 0.25;

### SQL
SELECT T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.xpos < 0.25 AND T2.ypos < 0.25
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
Calculate the total dish count for menu with uuid of "510d47e4-2958-a3d9-e040-e00a18064a99" & "510d47e4-295a-a3d9-e040-e00a18064a99".

### Hint
total dish count for uuid of '510d47e4-2958-a3d9-e040-e00a18064a99' = SUM(dish_count WHERE uuid = '510d47e4-2958-a3d9-e040-e00a18064a99'); total dish count for uuid of '510d47e4-295a-a3d9-e040-e00a18064a99 = SUM(dish_count WHERE uuid = '510d47e4-295a-a3d9-e040-e00a18064a99');

### SQL
SELECT SUM(CASE WHEN T2.uuid = '510d47e4-2958-a3d9-e040-e00a18064a99' THEN T1.dish_count ELSE 0 END) - SUM(CASE WHEN T2.uuid = '510d47e4-295a-a3d9-e040-e00a18064a99' THEN T1.dish_count ELSE 0 END) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
Calculate the total price of items for menu with ID 12882.

### Hint
total price = SUM(price);

### SQL
SELECT SUM(T2.price) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id WHERE T1.menu_id = 12882
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
List the top five dishes, by descending order, in terms of highest price.

### Hint
highest price refers to MAX(highest_price);

### SQL
SELECT name FROM Dish ORDER BY highest_price DESC LIMIT 5
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
Among the dishes, how many of them are for free?

### Hint
free refers to lowest_price = 0;

### SQL
SELECT COUNT(*) FROM Dish WHERE lowest_price = 0
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
What dishes made their first and last appearances in 1855 and 1900, respectively?

### Hint
first appearance in 1855 refers to first_appeared = 1855; last appearance in 1900 refers to last_appeared = 1900;

### SQL
SELECT name FROM Dish WHERE first_appeared = 1855 AND last_appeared = 1900
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
Write down the top ten menus with the highest dish count.

### Hint
highest dish count refers to MAX(dish_count);

### SQL
SELECT name FROM Menu GROUP BY name ORDER BY dish_count DESC LIMIT 10
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
How many dishes appear in the right upper corner of the menu page?

### Hint
appear in the right upper corner of the menu page refers to xpos > 0.75 and ypos < 0.25;

### SQL
SELECT COUNT(*) FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T1.dish_id = T2.id WHERE T1.xpos > 0.75 AND T1.ypos < 0.25
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
How long has the "Clear Green Turtle" dish appeared on the menu, and tell me when its latest update was?

### Hint
Clear Green Turtle is a name of dish; how long a dish appeared on the menu = SUBTRACT(last_appeared, first_appeared); latest update refers to latest updated_at;

### SQL
SELECT T1.last_appeared - T1.first_appeared, T2.updated_at FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Clear green turtle'
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
Tally the dishes that have appeared on the menu for more than 100 years.

### Hint
appeared on the menu for more than 100 years = SUBTRACT(last_appeared, first_appeared) > 100;

### SQL
SELECT T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.last_appeared - T1.first_appeared > 100
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
How many dishes have appeared on the menu in less than 5 years?

### Hint
appeared on the menu in less than 5 years = SUBTRACT(last_appeared, first_appeared) < 5;

### SQL
SELECT COUNT(*) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.last_appeared - T1.first_appeared < 5
### Database Schema
CREATE TABLE Dish
(
    id             INTEGER
            primary key,
    name           TEXT,
    description    TEXT,
    menus_appeared INTEGER,
    times_appeared INTEGER,
    first_appeared INTEGER,
    last_appeared  INTEGER,
    lowest_price   REAL,
    highest_price  REAL
)

CREATE TABLE Menu
(
    id                   INTEGER
            primary key,
    name                 TEXT,
    sponsor              TEXT,
    event                TEXT,
    venue                TEXT,
    place                TEXT,
    physical_description TEXT,
    occasion             TEXT,
    notes                TEXT,
    call_number          TEXT,
    keywords             TEXT,
    language             TEXT,
    date                 DATE,
    location             TEXT,
    location_type        TEXT,
    currency             TEXT,
    currency_symbol      TEXT,
    status               TEXT,
    page_count           INTEGER,
    dish_count           INTEGER
)

CREATE TABLE MenuPage
(
    id          INTEGER
            primary key,
    menu_id     INTEGER,
    page_number INTEGER,
    image_id    REAL,
    full_height INTEGER,
    full_width  INTEGER,
    uuid        TEXT,
    foreign key (menu_id) references Menu(id)
)

CREATE TABLE MenuItem
(
    id           INTEGER
            primary key,
    menu_page_id INTEGER,
    price        REAL,
    high_price   REAL,
    dish_id      INTEGER,
    created_at   TEXT,
    updated_at   TEXT,
    xpos         REAL,
    ypos         REAL,
    foreign key (dish_id) references Dish(id),
    foreign key (menu_page_id) references MenuPage(id)
)

### Question
Give me the name and menu price of dishes that were free.

### Hint
dishes that were free refers to lowest_price = 0;

### SQL
SELECT T2.name, T1.price FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T2.lowest_price = 0