Skip to content
代码片段 群组 项目
init_mysql.sql 5.14 KiB
CREATE DATABASE addatabase;
use addatabase;

CREATE TABLE aditems(
    item_name VARCHAR(40) NOT NULL,
    redirect_url VARCHAR(100) NOT NULL,
    text VARCHAR(100) NOT NULL,
    PRIMARY KEY ( item_name )
    )ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO aditems
    (item_name, redirect_url, text)
    VALUES
    ("camera", "/product/2ZYFJ3GM2N", "Film camera for sale. 50% off.");

INSERT INTO aditems
    (item_name, redirect_url, text)
    VALUES
    ("lens", "/product/66VCHSJNUP", "Vintage camera lens for sale. 20% off.");

INSERT INTO aditems
    (item_name, redirect_url, text)
    VALUES
    ("recordPlayer", "/product/0PUK6V6EV0", "Vintage record player for sale. 30% off.");
    
INSERT INTO aditems
    (item_name, redirect_url, text)
    VALUES
    ("bike", "/product/9SIQT8TOJO", "City Bike for sale. 10% off.");

INSERT INTO aditems
    (item_name, redirect_url, text)
    VALUES
    ("baristaKit", "/product/1YMWWN1N4O", "Home Barista kitchen kit for sale. Buy one, get second kit for free");

INSERT INTO aditems
    (item_name, redirect_url, text)
    VALUES
    ("airPlant", "/product/6E92ZMYYFZ", "Air plants for sale. Buy two, get third one for free");

INSERT INTO aditems
    (item_name, redirect_url, text)
    VALUES
    ("terrarium", "/product/L9ECAV7KIM", "Terrarium for sale. Buy one, get second one for free");

# product db
CREATE DATABASE Productdb;
use Productdb;


CREATE TABLE products(
    product_id VARCHAR(40) NOT NULL,
    item_name VARCHAR(40) NOT NULL,
    description VARCHAR(100) NOT NULL,
    picture_path VARCHAR(100) NOT NULL,
    categorise_list VARCHAR(100) NOT NULL,
    PRIMARY KEY ( product_id )
    )ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE price(
    product_id VARCHAR(40) NOT NULL,
    currencyCode VARCHAR(10) NOT NULL,
    units INT NOT NULL,
    nanos INT,
    PRIMARY KEY (product_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO products
    (product_id, item_name, description, picture_path, categorise_list)