Dludora/DAIL-BIRD huggingface dataset:
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What is the total value of Argentum coined traded in the past 24 hours on 2016/10/11. total value in the past 24 hours refers to volume_24h; on 11/10/16 refers to date = '2016-11-10' */
SELECT 
SELECT T2.volume_24h FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Argentum' AND T2.date = '2016-10-11'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: List the price for Zetacoin on 13/11/1 and the next 7 consecutive days. What is the average price for these 7 days? on 1/11/13 and the next 7 consecutive days refers to DATE BETWEEN '2013-11-01' AND '2013-11-07'; average price refers to AVG(price); Zetacoin refers to name = 'Zetacoin' */
SELECT 
SELECT T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AND '2013-11-07' UNION ALL SELECT AVG(T2.PRICE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AND '2013-11-07'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: For all transactions for WRAP in August 2016, list the time to achieve highest price and the time to achieve the lowest price. in May 2013 refers to month(date) = 5 AND year(date) = 2013; time to achieve the highest price refers to time_high; time to achieve the lowest price refers to time_low; WRAP refers to name = 'WARP' */
SELECT 
SELECT T2.time_high, T2.time_low, T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'WARP' AND STRFTIME('%Y-%m', T2.date) = '2016-08'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: State the transaction date whereby DigixDAO was transacted at the hightest price. the highest price refers to max(price); DigixDAO refers to name = 'DigixDAO' */
SELECT 
SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'DigixDAO' ORDER BY T2.price DESC LIMIT 1
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Name the coin with the highest percentage price changed in 24 hours. State the transaction date and price. the highest percentage price changed in 24 hours refers to max(percent_change_24h) */
SELECT 
SELECT T1.name, T2.DATE, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.percent_change_24h = ( SELECT MAX(percent_change_24h) FROM historical )
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What is the average monthly circulating supply for Frozen in 2014. average monthly circulating supply = AVG(circulating_supply); in 2017 refers to date BETWEEN '2017-01-01' AND '2017-12-31' */
SELECT 
SELECT CAST(SUM(T2.circulating_supply) AS REAL) / 12 FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Frozen' AND STRFTIME('%Y', T2.date) = '2014'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: List all the inactive coins and state the last date of its transaction? the last date refers to max(date); inactive coins refers to status = 'inactive' */
SELECT 
SELECT T1.NAME, MAX(T2.DATE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T1.status = 'inactive' ORDER BY T2.DATE DESC LIMIT 1
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What was the price of 1 Bitcoin in 2016? 2016 refers to historical date where year(date) = 2016 */
SELECT 
SELECT AVG(T2.price) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' AND STRFTIME('%Y', T2.date) = '2016'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: State the transaction date and the price when Bitcoin was bottomed? was bottomed refers to min(price) */
SELECT 
SELECT T2.date, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' ORDER BY T2.price LIMIT 1
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: For all coins with average price more than $1000. State the current status of the coin. average price more than $1000 refers to AVG(price)>1000 */
SELECT 
SELECT T1.status FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id GROUP BY T1.name HAVING AVG(T2.price) > 1000
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Name the coin and date of transactions with the greatest decline in percent change in 1 hour. the greatest decline in percent change in 1 hour refers to max(percent_change_1h) */
SELECT 
SELECT T1.name, T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.percent_change_1h = ( SELECT MIN(percent_change_1h) FROM historical )
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Name the coin under the token category that gives the highest max profit. the highest max profit refers to max(subtract(high, low)) */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.category = 'token' ORDER BY T2.high - T2.low DESC LIMIT 1
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Name the coin that have higher than average percentage price changed from the previous 24 hours for transaction on 2013/6/22. average percentage price changed from the previous 24 hours refers to AVG(percent_change_24h); on 15/5/2013 refers to DATE = '2013-04-15' */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2020-06-22' GROUP BY T1.name HAVING AVG(T2.percent_change_24h) > T2.PRICE
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Which crytocurrency was ranked the first by CoinMarketCap on 2013/4/28? ranked the first refers to cmc_rank = 1; on 2013/4/28 refers to date = '2013-04-28' */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T2.cmc_rank = 1
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: How much dollars was a Bitcoin worth on 2013/4/28 according to the coin market? worth refers to price; on 2013/4/28 refers to date = '2013-04-28' */
SELECT 
SELECT T2.market_cap FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Which crytocurrency was not opened on 2013/5/3? not opened refers to open IS NULL; on 2013/5/3 refers to date = '2013-05-03' */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-03' AND T2.open IS NULL
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What was the price of Bitcoin when it closed at the end of the day on 2013/4/29? price when it closed refers to close; on 2013/4/29 refers to date = '2013-04-29' */
SELECT 
SELECT T2.close FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-29' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: When did Bitcoin reach its highest price on 2013/4/29? time that a coin reaches its highest price refers to time_high; on 2013/4/29 refers to date = '2013-04-29' */
SELECT 
SELECT T2.time_high FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-29' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What was the max profit a user can make on Bitcoin on 2013/4/28? the max profit = subtract(high, low); on 2013/4/28 refers to date = '2013-04-28' */
SELECT 
SELECT T2.high - T2.low FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What was the number of Bitcoins verifiably burned until 2013/4/28? the number of Bitcoins verifiably burned = max_supply - total_supply; 2013/4/28 refers to date = '2013-04-28' */
SELECT 
SELECT T2.max_supply - T2.total_supply FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Which crytocurrency was traded in the highest value on 2016/1/8? traded in the highest value refers to max(volume_24h); on 2016/1/8 refers to date = '2016-01-08' */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2016-01-08' AND T2.volume_24h = ( SELECT MAX(volume_24h) FROM historical WHERE date = '2016-01-08' )
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Please list the names of the crytocurrencies that have a total amount of existence of over 10000000 on 2013/4/28. a total amount of existence of over 10000000 refers to total_supply>10000000; on 2013/4/28 refers to date = '2013-04-28' */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T2.total_supply > 10000000
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Had Bitcoin's price increased or decreased on 2013/5/5 compared with the price 7 days before? price increased refers to percent_change_7d>0; decreased refers percent_change_7d<0; on 2013/5/5 refers to date = '2013-05-05' */
SELECT 
SELECT (CASE WHEN T2.percent_change_7d > 0 THEN 'INCREASED' ELSE 'DECREASED' END) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-05' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Which crytocurrency had a bigger number of coins circulating in the market and in the general public's hands on 2013/4/28, Bitcoin or Litecoin? a bigger number of coins circulating in the market refers to max(circulating_supply); on 2013/4/28 refers to date = '2013-04-28' */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name IN ('Bitcoin', 'Litecoin') ORDER BY T2.circulating_supply DESC LIMIT 1
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: How much was a Bitcoin on 2013/4/28? how much refers to price; on 2013/4/28 refers to date = '2013-04-28' */
SELECT 
SELECT T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What was the average price of a Bitcoin in the year 2013? average price refers SUM(price)/COUNT(named = 'Bitcoin'); in the year 2013 refers to year(date) = 2013 */
SELECT 
SELECT AVG(T2.price) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE STRFTIME('%Y', T2.date) = '2013' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What was the percentage of the Bitcoins verifiably burned until 2018/4/28? the percentage of the Bitcoins verifiably burned = divide(subtract(SUM(max_supply), SUM(total_supply)),SUM(total_supply))*100%; until 2013/4/28 refers to date<'2013-04-08' */
SELECT 
SELECT CAST((SUM(T2.max_supply) - SUM(T2.total_supply)) AS REAL) / SUM(T2.total_supply) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date < '2018-04-28' AND T1.name = 'Bitcoin'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Please list the names of coins that has been disappeared. has disappeared refers to status = 'extinct' */
SELECT 
SELECT name FROM coins WHERE status = 'extinct'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What's the descripition of BitBar? */
SELECT 
SELECT description FROM coins WHERE name = 'BitBar'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: How many coins were added in May 2013? Please list the names of coins. in May 2013 refers to year(date_added) = 2013 and month(date_added) = 5 */
SELECT 
SELECT COUNT(id) num FROM coins WHERE STRFTIME('%Y-%m', date_added) = '2013-05' UNION ALL SELECT name FROM coins WHERE STRFTIME('%Y-%m', date_added) = '2013-05'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: List the names and symbols of the coins that were added on June 14, 2013. added on June 14, 2013 refers to date_added like '2013-06-14%' */
SELECT 
SELECT name, symbol FROM coins WHERE date_added LIKE '2013-06-14%'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: List the names of coins that cannot be traded in 2014. cannot be tracked refers to status = 'untracked'; in 2014 refers to year(date_added) = '2014' */
SELECT 
SELECT name FROM coins WHERE date_added LIKE '2014%' AND status = 'untracked'
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: Name the coins that have three tags. have three tags refers to length(tag_names)-length(replace(tag_names,',','')) = 2 */
SELECT 
SELECT name FROM coins WHERE LENGTH(tag_names) - LENGTH(replace(tag_names, ',', '')) = 2
/* Given the following database schema: */
CREATE TABLE coins
(
    id            INTEGER not null
        primary key,
    name          TEXT,
    slug          TEXT,
    symbol        TEXT,
    status        TEXT,
    category      TEXT,
    description   TEXT,
    subreddit     TEXT,
    notice        TEXT,
    tags          TEXT,
    tag_names     TEXT,
    website       TEXT,
    platform_id   INTEGER,
    date_added    TEXT,
    date_launched TEXT
)

CREATE TABLE "historical"
(
    date               DATE,
    coin_id            INTEGER,
    cmc_rank           INTEGER,
    market_cap         REAL,
    price              REAL,
    open               REAL,
    high               REAL,
    low                REAL,
    close              REAL,
    time_high          TEXT,
    time_low           TEXT,
    volume_24h         REAL,
    percent_change_1h  REAL,
    percent_change_24h REAL,
    percent_change_7d  REAL,
    circulating_supply REAL,
    total_supply       REAL,
    max_supply         REAL,
    num_market_pairs   INTEGER
)

/* Answer the following: What is the name of the coin with the highest price? the highest price refers to max(price) */
SELECT 
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.price = ( SELECT MAX(price) FROM historical )