{"shop": {"columns": [[0, "Shop_ID", "INT", 0, null, 1], [1, "Address", "TEXT", 0, null, 0], [2, "Num_of_staff", "TEXT", 0, null, 0], [3, "Score", "REAL", 0, null, 0], [4, "Open_Year", "TEXT", 0, null, 0]], "primary_keys": ["Shop_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Shop_ID"]]], "check_constraints": []}, "member": {"columns": [[0, "Member_ID", "INT", 0, null, 1], [1, "Name", "TEXT", 0, null, 0], [2, "Membership_card", "TEXT", 0, null, 0], [3, "Age", "INT", 0, null, 0], [4, "Time_of_purchase", "INT", 0, null, 0], [5, "Level_of_membership", "INT", 0, null, 0], [6, "Address", "TEXT", 0, null, 0]], "primary_keys": ["Member_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Member_ID"]]], "check_constraints": []}, "happy_hour": {"columns": [[0, "HH_ID", "INT", 0, null, 1], [1, "Shop_ID", "INT", 0, null, 2], [2, "Month", "TEXT", 0, null, 3], [3, "Num_of_shaff_in_charge", "INT", 0, null, 0]], "primary_keys": ["HH_ID", "Shop_ID", "Month"], "foreign_keys": [[0, 0, "shop", "Shop_ID", "Shop_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "HH_ID"], [1, 1, "Shop_ID"], [2, 2, "Month"]]], "check_constraints": []}, "happy_hour_member": {"columns": [[0, "HH_ID", "INT", 0, null, 1], [1, "Member_ID", "INT", 0, null, 2], [2, "Total_amount", "REAL", 0, null, 0]], "primary_keys": ["HH_ID", "Member_ID"], "foreign_keys": [[0, 0, "member", "Member_ID", "Member_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "HH_ID"], [1, 1, "Member_ID"]]], "check_constraints": []}}
CREATE TABLE shop (
    Shop_ID INT   PRIMARY KEY,
    Address TEXT,
    Num_of_staff TEXT,
    Score REAL,
    Open_Year TEXT,
    UNIQUE (Shop_ID)
);

CREATE TABLE member (
    Member_ID INT   PRIMARY KEY,
    Name TEXT,
    Membership_card TEXT,
    Age INT,
    Time_of_purchase INT,
    Level_of_membership INT,
    Address TEXT,
    UNIQUE (Member_ID)
);

CREATE TABLE happy_hour (
    HH_ID INT   PRIMARY KEY,
    Shop_ID INT   PRIMARY KEY,
    Month TEXT   PRIMARY KEY,
    Num_of_shaff_in_charge INT,
    PRIMARY KEY (HH_ID, Shop_ID, Month),
    UNIQUE (HH_ID, Shop_ID, Month),
    FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)
);

CREATE TABLE happy_hour_member (
    HH_ID INT   PRIMARY KEY,
    Member_ID INT   PRIMARY KEY,
    Total_amount REAL,
    PRIMARY KEY (HH_ID, Member_ID),
    UNIQUE (HH_ID, Member_ID),
    FOREIGN KEY (Member_ID) REFERENCES member(Member_ID)
);