{"phone": {"columns": [[0, "Name", "TEXT", 0, null, 0], [1, "Phone_ID", "INT", 0, null, 1], [2, "Memory_in_G", "INT", 0, null, 0], [3, "Carrier", "TEXT", 0, null, 0], [4, "Price", "REAL", 0, null, 0]], "primary_keys": ["Phone_ID"], "foreign_keys": [], "unique_constraints": [[[0, 1, "Phone_ID"]]], "check_constraints": []}, "market": {"columns": [[0, "Market_ID", "INT", 0, null, 1], [1, "District", "TEXT", 0, null, 0], [2, "Num_of_employees", "INT", 0, null, 0], [3, "Num_of_shops", "REAL", 0, null, 0], [4, "Ranking", "INT", 0, null, 0]], "primary_keys": ["Market_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Market_ID"]]], "check_constraints": []}, "phone_market": {"columns": [[0, "Market_ID", "INT", 0, null, 1], [1, "Phone_ID", "TEXT", 0, null, 2], [2, "Num_of_stock", "INT", 0, null, 0]], "primary_keys": ["Market_ID", "Phone_ID"], "foreign_keys": [[0, 0, "phone", "Phone_ID", "Phone_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "market", "Market_ID", "Market_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Market_ID"], [1, 1, "Phone_ID"]]], "check_constraints": []}}
CREATE TABLE phone (
    Name TEXT,
    Phone_ID INT   PRIMARY KEY,
    Memory_in_G INT,
    Carrier TEXT,
    Price REAL,
    UNIQUE (Phone_ID)
);

CREATE TABLE market (
    Market_ID INT   PRIMARY KEY,
    District TEXT,
    Num_of_employees INT,
    Num_of_shops REAL,
    Ranking INT,
    UNIQUE (Market_ID)
);

CREATE TABLE phone_market (
    Market_ID INT   PRIMARY KEY,
    Phone_ID TEXT   PRIMARY KEY,
    Num_of_stock INT,
    PRIMARY KEY (Market_ID, Phone_ID),
    UNIQUE (Market_ID, Phone_ID),
    FOREIGN KEY (Phone_ID) REFERENCES phone(Phone_ID),
    FOREIGN KEY (Market_ID) REFERENCES market(Market_ID)
);