text: -- https://sites.google.com/site/halitsch88/Implementation-TPC-H-schema-into-MySQL-DBMS
  -- Modified by Petr Haloun 18.11.2011
  -- Sccsid:     @(#)dss.ri 2.1.8.1
  -- TPCD Benchmark Version 8.0
  SET autocommit = 1;
  SET FOREIGN_KEY_CHECKS=0;
  -- For table REGION
  ALTER TABLE REGION
  ADD PRIMARY KEY (R_REGIONKEY);
  
  -- For table NATION
  ALTER TABLE NATION
  ADD PRIMARY KEY (N_NATIONKEY);
  
  ALTER TABLE NATION
  ADD FOREIGN KEY NATION_FK1 (N_REGIONKEY) references REGION(R_REGIONKEY);
  
  
  
  -- For table PART
  ALTER TABLE PART
  ADD PRIMARY KEY (P_PARTKEY);
  
  
  
  -- For table SUPPLIER
  ALTER TABLE SUPPLIER
  ADD PRIMARY KEY (S_SUPPKEY);
  
  ALTER TABLE SUPPLIER
  ADD FOREIGN KEY SUPPLIER_FK1 (S_NATIONKEY) references NATION(N_NATIONKEY);
  
  
  
  -- For table PARTSUPP
  ALTER TABLE PARTSUPP
  ADD PRIMARY KEY (PS_PARTKEY,PS_SUPPKEY);
  
  
  
  -- For table CUSTOMER
  ALTER TABLE CUSTOMER
  ADD PRIMARY KEY (C_CUSTKEY);
  
  ALTER TABLE CUSTOMER
  ADD FOREIGN KEY CUSTOMER_FK1 (C_NATIONKEY) references NATION(N_NATIONKEY);
  
  
  
  -- For table LINEITEM
  ALTER TABLE LINEITEM
  ADD PRIMARY KEY (L_ORDERKEY,L_LINENUMBER);
  
  
  
  -- For table ORDERS
  ALTER TABLE ORDERS
  ADD PRIMARY KEY (O_ORDERKEY);
  
  
  
  -- For table PARTSUPP
  ALTER TABLE PARTSUPP
  ADD FOREIGN KEY PARTSUPP_FK1 (PS_SUPPKEY) references SUPPLIER(S_SUPPKEY);
  
  
  
  ALTER TABLE PARTSUPP
  ADD FOREIGN KEY PARTSUPP_FK2 (PS_PARTKEY) references PART(P_PARTKEY);
  
  
  
  -- For table ORDERS
  ALTER TABLE ORDERS
  ADD FOREIGN KEY ORDERS_FK1 (O_CUSTKEY) references CUSTOMER(C_CUSTKEY);
  
  
  
  -- For table LINEITEM
  ALTER TABLE LINEITEM
  ADD FOREIGN KEY LINEITEM_FK1 (L_ORDERKEY)  references ORDERS(O_ORDERKEY);
  
  
  
  ALTER TABLE LINEITEM
  ADD FOREIGN KEY LINEITEM_FK2 (L_PARTKEY,L_SUPPKEY) references PARTSUPP(PS_PARTKEY, PS_SUPPKEY);
  