{"device": {"columns": [[0, "Device_ID", "INT", 0, null, 1], [1, "Device", "TEXT", 0, null, 0], [2, "Carrier", "TEXT", 0, null, 0], [3, "Package_Version", "TEXT", 0, null, 0], [4, "Applications", "TEXT", 0, null, 0], [5, "Software_Platform", "TEXT", 0, null, 0]], "primary_keys": ["Device_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Device_ID"]]], "check_constraints": []}, "shop": {"columns": [[0, "Shop_ID", "INT", 0, null, 1], [1, "Shop_Name", "TEXT", 0, null, 0], [2, "Location", "TEXT", 0, null, 0], [3, "Open_Date", "TEXT", 0, null, 0], [4, "Open_Year", "INT", 0, null, 0]], "primary_keys": ["Shop_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Shop_ID"]]], "check_constraints": []}, "stock": {"columns": [[0, "Shop_ID", "INT", 0, null, 1], [1, "Device_ID", "INT", 0, null, 2], [2, "Quantity", "INT", 0, null, 0]], "primary_keys": ["Shop_ID", "Device_ID"], "foreign_keys": [[0, 0, "device", "Device_ID", "Device_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "shop", "Shop_ID", "Shop_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Shop_ID"], [1, 1, "Device_ID"]]], "check_constraints": []}}
CREATE TABLE device (
    Device_ID INT   PRIMARY KEY,
    Device TEXT,
    Carrier TEXT,
    Package_Version TEXT,
    Applications TEXT,
    Software_Platform TEXT,
    UNIQUE (Device_ID)
);

CREATE TABLE shop (
    Shop_ID INT   PRIMARY KEY,
    Shop_Name TEXT,
    Location TEXT,
    Open_Date TEXT,
    Open_Year INT,
    UNIQUE (Shop_ID)
);

CREATE TABLE stock (
    Shop_ID INT   PRIMARY KEY,
    Device_ID INT   PRIMARY KEY,
    Quantity INT,
    PRIMARY KEY (Shop_ID, Device_ID),
    UNIQUE (Shop_ID, Device_ID),
    FOREIGN KEY (Device_ID) REFERENCES device(Device_ID),
    FOREIGN KEY (Shop_ID) REFERENCES shop(Shop_ID)
);