USE Homework250313;

CREATE TABLE S
(
    SNO    CHAR(2) PRIMARY KEY,
    SNAME  VARCHAR(20),
    STATUS INT,
    CITY   VARCHAR(20)
);

CREATE TABLE P
(
    PNO    CHAR(2) PRIMARY KEY,
    PNAME  VARCHAR(20),
    COLOR  VARCHAR(10),
    WEIGHT INT
);

CREATE TABLE J
(
    JNO   CHAR(2) PRIMARY KEY,
    JNAME VARCHAR(20),
    CITY  VARCHAR(20)
);

CREATE TABLE SPJ
(
    SNO CHAR(2),
    PNO CHAR(2),
    JNO CHAR(2),
    QTY INT,
    PRIMARY KEY (SNO, PNO, JNO),
    FOREIGN KEY (SNO) REFERENCES S (SNO),
    FOREIGN KEY (PNO) REFERENCES P (PNO),
    FOREIGN KEY (JNO) REFERENCES J (JNO)
);