CREATE TABLE `customer` (
  `c_custkey` INTEGER NOT NULL,
  `c_mktsegment` TEXT DEFAULT NULL,
  `c_nationkey` INTEGER DEFAULT NULL,
  `c_name` TEXT DEFAULT NULL,
  `c_address` TEXT DEFAULT NULL,
  `c_phone` TEXT DEFAULT NULL,
  `c_acctbal` REAL DEFAULT NULL,
  `c_comment` TEXT DEFAULT NULL,
  PRIMARY KEY (`c_custkey`),
  FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE
);
customer
CREATE TABLE lineitem
(
    l_shipdate      DATE           null,
    l_orderkey      INTEGER         not null,
    l_discount      REAL not null,
    l_extendedprice REAL not null,
    l_suppkey       INTEGER            not null,
    l_quantity      INTEGER         not null,
    l_returnflag    TEXT           null,
    l_partkey       INTEGER         not null,
    l_linestatus    TEXT           null,
    l_tax           REAL not null,
    l_commitdate    DATE           null,
    l_receiptdate   DATE           null,
    l_shipmode      TEXT       null,
    l_linenumber    INTEGER         not null,
    l_shipinstruct  TEXT       null,
    l_comment       TEXT    null,
    primary key (l_orderkey, l_linenumber),
    foreign key (l_orderkey) references orders (o_orderkey)
            on update cascade on delete cascade,
    foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey)
            on update cascade on delete cascade
);
lineitem
CREATE TABLE nation
(
    n_nationkey INTEGER          not null
        primary key,
    n_name      TEXT     null,
    n_regionkey INTEGER          null,
    n_comment   TEXT null,
    foreign key (n_regionkey) references region (r_regionkey)
            on update cascade on delete cascade
);
nation
CREATE TABLE orders
(
    o_orderdate     DATE           null,
    o_orderkey      INTEGER         not null
        primary key,
    o_custkey       INTEGER         not null,
    o_orderpriority TEXT       null,
    o_shippriority  INTEGER            null,
    o_clerk         TEXT       null,
    o_orderstatus   TEXT           null,
    o_totalprice    REAL null,
    o_comment       TEXT    null,
    foreign key (o_custkey) references customer (c_custkey)
            on update cascade on delete cascade
);
orders
CREATE TABLE part
(
    p_partkey     INTEGER         not null
        primary key,
    p_type        TEXT    null,
    p_size        INTEGER            null,
    p_brand       TEXT       null,
    p_name        TEXT    null,
    p_container   TEXT       null,
    p_mfgr        TEXT       null,
    p_retailprice REAL null,
    p_comment     TEXT    null
);
part
CREATE TABLE partsupp
(
    ps_partkey    INTEGER         not null,
    ps_suppkey    INTEGER            not null,
    ps_supplycost REAL not null,
    ps_availqty   INTEGER            null,
    ps_comment    TEXT   null,
    primary key (ps_partkey, ps_suppkey),
    foreign key (ps_partkey) references part (p_partkey)
            on update cascade on delete cascade,
    foreign key (ps_suppkey) references supplier (s_suppkey)
            on update cascade on delete cascade
);
partsupp
CREATE TABLE region
(
    r_regionkey INTEGER          not null
        primary key,
    r_name      TEXT     null,
    r_comment   TEXT null
);
region
CREATE TABLE supplier
(
    s_suppkey   INTEGER            not null
        primary key,
    s_nationkey INTEGER            null,
    s_comment   TEXT   null,
    s_name      TEXT       null,
    s_address   TEXT    null,
    s_phone     TEXT       null,
    s_acctbal   REAL null,
    foreign key (s_nationkey) references nation (n_nationkey)
);
supplier
original_column_name,column_name,column_description,data_format,value_description
c_custkey,customer key,unique id number identifying the customer,integer,
c_mktsegment,customer market segment,the segment of the customer,text,
c_nationkey,customer nation key,the nation key number of the customer,integer,
c_name,customer name,name of the customer,text,
c_address,customer address,address of the customer,text,
c_phone,customer phone,phone of the customer,text,
c_acctbal,customer account balance,account balance,real,if c_acctbal < 0: this account is in debt
c_comment,customer comment,comment of the customer,text,
customer
original_column_name,column_name,column_description,data_format,value_description
o_orderdate,order date,date of the order,date,"commonsense evidence:
earlier order date --> higher priority in delivery"
o_orderkey,order key,unique id number identifying the order,integer,
o_custkey,order customer key,customer key of order,integer,
o_orderpriority,order priority,priority rate of order,text,A smaller number means a higher priority: 0-Urgent
o_shippriority,order ship priority,ship priority of order,integer,NOT USEFUL
o_clerk,order clerk,clerk of order,text,
o_orderstatus,order status,status of order,text,NOT USEFUL
o_totalprice,order total price,total price of the order,real,
o_comment,order comment,comment description of order,text,
orders
original_column_name,column_name,column_description,data_format,value_description
p_partkey,part key,unique id number identifying the part,integer,
p_type,part type,type of part,text,
p_size,part size,size number of part,integer,larger number --> larger part
p_brand,part brand,brand of part,text,
p_name,part name,name of part,text,
p_container,part container,container of part,text,
p_mfgr,part manufacturer,manufacturer of part,text,
p_retailprice,part retail price,retail price of part,real,
p_comment,part comment,comment description text of part,text,
part
original_column_name,column_name,column_description,data_format,value_description
ps_partkey,part supply part key,unique id number identifying the part key,integer,
ps_suppkey,part supply supply key,unique id number identifying the supply key,integer,
ps_supplycost,part supply cost,cost number of the part supply,real,"commonsense evidence:
profit = (l_extendedprice*(1-l_discount)) - (ps_supplycost * l_quantity)] l_quantity comes from table lineitem!"
ps_availqty,part supply available quantity,available quantity of the part supply,integer,if ps_availqty < 10 --> closer to OOS (out of stock)
ps_comment,part supply comment,comment description of the part supply.,text,
partsupp
original_column_name,column_name,column_description,data_format,value_description
s_suppkey,supply key,unique id number identifying the supply,integer,
s_nationkey,supplier nation key,nation key of the supply,integer,
s_comment,supplier comment,comment description of the comment,text,
s_name,supplier name,name of the supplier,text,
s_address,supplier address,address of the supplier,text,
s_phone,supplier phone,phone number of the supplier,text,
s_acctbal,supplier account balance,account balance of the supplier,real,"commonsense evidence:
if c_acctbal < 0: this account is in debt"
supplier
original_column_name,column_name,column_description,data_format,value_description
n_nationkey,nation key,unique id number identifying the nation,integer,
n_name,nation name,name of the nation,text,
n_regionkey,nation region key,region key number of the nation,integer,
n_comment,nation comment,comment description of nation,text,
nation
original_column_name,column_name,column_description,data_format,value_description
l_shipdate,line item ship date,ship date of line item ,date,
l_orderkey,line item order key,order key number of line item ,integer,
l_discount,line item discount,discount of line item ,real,0.1: 10% off
l_extendedprice,line item extended price,extended price of line item ,real,"commonsense evidence:
full price before discount
discounted price = (l_extendedprice*(1-l_discount))"
l_suppkey,line item suppkey,suppkey of line item ,integer,
l_quantity,line item quantity,quantity of line item ,integer,
l_returnflag,line item return flag,return flag of line item ,text,"commonsense evidence:
 R ? returned item
 A and ""N"": not returned item."
l_partkey,line item part key,part key of line item ,integer,
l_linestatus,line item line status,line status of line item ,text,NOT USEFUL
l_tax,line item tax,tax of line item ,real,"commonsense evidence:
charge = l_extendedprice * (1- l_discount) * (1+ l_tax)"
l_commitdate,line item commit date,commit date of line item ,date,
l_receiptdate,line item receipt date,receipt date of line item ,date,"commonsense evidence:
freight / shipping / delivery time = l_receiptdate - l_commitdate;
less shipping / delivery time --> faster shipping speed."
l_shipmode,line item ship mode,ship mode of line item ,text,
l_linenumber,line item line number,unique id number identifying the line item,integer,
l_shipinstruct,line item ship instruct,ship instruct of line item ,text,
l_comment,line item comment,comment of line item ,text,
lineitem
original_column_name,column_name,column_description,data_format,value_description
r_regionkey,region key,unique id number identifying the region,integer,
r_name,region name,name of the region,text,
r_comment,region comment,comment description of the region,text,
region