create table P_
(
 PARTKEY    CHAR(10) PRIMARY KEY,
 NAME       CHAR(10),
 MFGR       CHAR(10),
 BRAND      CHAR(10),
 TYPE       CHAR(10),
 SIZE       CHAR(10),
 CONTAINER  CHAR(10),
 RETALPRICE CHAR(10),
 COMMENT    CHAR(10)
);

CREATE TABLE S_
(
 SUPPKEY    CHAR(10) PRIMARY KEY,
 NAME       CHAR(10),
 ADDRESS    CHAR(10),
 NATIONKEY  CHAR(10),
 FOREIGN KEY (NATIONKEY) REFERENCES N_ (NATIONKEY),
 PHONE      CHAR(10),
 ACCTBAL    CHAR(10),
 COMMENT    CHAR(10),
);

CREATE TABLE PS_
(

PARTKEY      CHAR(10),
SUPPKEY      CHAR(10),
AVAILQTY     CHAR(10),
SUPPLYCOST   CHAR(10),
COMMENT      CHAR(10),
PRIMARY  KEY(PARTKEY,SUPPKEY),
  
FOREIGN  KEY(PARTKEY) REFERENCES P_(PARTKEY),
FOREIGN  KEY(SUPPKEY) REFERENCES S_(SUPPKEY)
);

CREATE TABLE C_
(
 CUSTKEY       CHAR(10) PRIMARY KEY,
 NAME          CHAR(10),
 ADDRESS       CHAR(10),
 NATIONKEY     CHAR(10),
 PHONE         CHAR(10),
 ACCTBAL       CHAR(10),
 MKTSEGMENT    CHAR(10),
 COMMENT       CHAR(10),
 FOREIGN   KEY(NATIONKEY) REFERENCES N_(NATIONKEY)

);

CREATE TABLE  N_
(
 NATIONKEY       CHAR(10)  PRIMARY KEY,
 NAME            CHAR(10),
 REGIONKEY       CHAR(10),
 COMMENT         CHAR(10)
);

CREATE TABLE L_
(
 ORDERKEY        CHAR(10),
 PARTKEY         CHAR(10),
 SUPPKEY         CHAR(10),
 LINENU          CHAR(10),
 QUA             CHAR(10),
 EXR             CHAR(10),
 DIS             CHAR(10),
 TAX             CHAR(10),
 RET             CHAR(10),
 LINES           CHAR(10),
 SHIP            CHAR(10),
 COM             CHAR(10),
 REC             CHAR(10),
 SHIPRUCT        CHAR(10),
 SHIPMOD         CHAR(10),
 COMMENT         CHAR(10),
 
 PRIMARY KEY(ORDERKEY,PARTKEY,SUPPKEY),
 FOREIGN KEY(ORDERKEY) REFERENCES  O_(ORDERKEY),
 FOREIGN KEY(PARTKEY) REFERENCES  P_(PARTKEY),
 FOREIGN KEY(SUPPKEY) REFERENCES S_(SUPPKEY)
);

CREATE TABLE R_
(
REGIONKEY        CHAR(10) PRIMARY KEY,
NAMES            CHAR(10),
COMMENT          CHAR(10)
);

CREATE TABLE O_
(
ORDERKEY         CHAR(10) PRIMARY KEY,
CUSTKEY          CHAR(10),
ORDERSTATUS      CHAR(10),
TOTALPRICE       CHAR(10),
ORDERDATE        CHAR(10),
ORDERPR          CHAR(10),
CLERK            CHAR(10),
SHIPPR          CHAR(10),
COMMENT          CHAR(10),
FOREIGN KEY (CUSTKEY) REFERENCES C_(CUSTKEY)
);

