SHARE
TWEET

Untitled

a guest Dec 8th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE CUSTOMER(
  2.     CID varchar(10) PRIMARY KEY,
  3.     isCompany BIT,
  4.     "name" varchar(30) NOT NULL,
  5.     surname varchar(30) NOT NULL,
  6.     country varchar(30),
  7.     City varchar(30),
  8.     Street varchar(30),
  9.     BNR int,
  10.     postalcode CHAR(5),
  11.     email varchar(30),
  12.     phone varchar(15),
  13.     );
  14.  
  15.  
  16. CREATE TABLE EMPLOYEE(
  17.     EID varchar(10) PRIMARY KEY,
  18.     "name" varchar(30) NOT NULL,
  19.     surname varchar(30) NOT NULL,
  20.     hireDate date,
  21.     position varchar(30 )NOT NULL,
  22.     salary float,
  23.     bankacc numeric(26),
  24.     phone char(10),
  25.     email varchar(50)
  26.     );
  27.  
  28. CREATE TABLE "ORDER"(
  29.     OrderID varchar(10) PRIMARY KEY,
  30.     "date" DATETIME,
  31.     totalprice float,
  32.     CID varchar(10),
  33.     FOREIGN KEY (CID) REFERENCES CUSTOMER,
  34.     EID varchar(10),
  35.     FOREIGN KEY (EID) REFERENCES EMPLOYEE,
  36.     );
  37.  
  38. CREATE TABLE SHIPMENT(
  39.     trackingnumber varchar(30) PRIMARY KEY,
  40.     shipmentdate datetime,
  41.     deliverydate datetime,
  42.     CID varchar(10),
  43.     FOREIGN KEY (CID) REFERENCES CUSTOMER,
  44.     EID varchar(10),
  45.     FOREIGN KEY (EID) REFERENCES EMPLOYEE,
  46.     );
  47. CREATE TABLE CARPART(
  48.     PartSerialID varchar(30) PRIMARY KEY,
  49.     "OEM" varchar(30) UNIQUE,
  50.     "name" varchar(30),
  51.     "brandname" varchar(30),
  52.     carmanufacturer varchar(30),
  53.     model varchar(30),
  54.     "version" varchar(30),
  55.     "year" int,
  56.     engineversion varchar(30),
  57.     gastype varchar(30),
  58.     price float ,
  59.     );
  60.  
  61.  CREATE TABLE PARTSTORAGE(
  62.     partid varchar(30) PRIMARY KEY,
  63.     place varchar(5),
  64.     quantity int,
  65.     sellprice float NOT NULL,
  66.     PartSerialID varchar(30),
  67.     FOREIGN KEY (PartSerialID) REFERENCES CARPART,
  68.     );
  69.  
  70. CREATE TABLE OrderDetails(
  71.     QuantityOrdered int,
  72.     QuantitySent int,
  73.     UnitPrice float NOT NULL,
  74.     OrderID varchar(10),
  75.     partid varchar(30),
  76.     FOREIGN KEY (OrderID) REFERENCES "ORDER",
  77.     FOREIGN KEY (partid) REFERENCES "PARTSTORAGE",
  78.     );
  79. CREATE TABLE SupplierOrder(
  80.     SupOrderID varchar(30) PRIMARY KEY,
  81.     "date" DATETIME,
  82.     totalprice float NOT NULL,
  83.     EID varchar(10),
  84.     CID varchar(10),
  85.     FOREIGN KEY (EID) REFERENCES EMPLOYEE,
  86.     FOREIGN KEY (CID) REFERENCES CUSTOMER,
  87.  
  88.     );
  89.  
  90. CREATE TABLE SupOrderDetails(
  91.     quantitysent int,
  92.     quantityordered int,
  93.     price float,
  94.     SupOrderID varchar(30),
  95.     FOREIGN KEY (SUpOrderid) REFERENCES SupplierOrder,
  96.     PartSerialID varchar(30),
  97.     FOREIGN KEY(Partserialid) REFERENCES CarPArt,
  98.  
  99.     );
  100.  
  101. CREATE TABLE DELIVERY(
  102.     deliveryID varchar(30) PRIMARY KEY,
  103.     shipmentdate date,
  104.     deliverydate date,
  105.     SupoOrderID varchar(30),
  106.     FOREIGN KEY (SupoOrderID) REFERENCES SupplierOrder,
  107.     );
  108.  
  109. CREATE TABLE DELIVERYDETAILS(
  110.     quantity int,
  111.     PartSerialNumber varchar(30),
  112.     FOREIGN KEY (PartSerialNumber) REFERENCES CARPART,
  113.     deliveryid varchar(30),
  114.     FOREIGN KEY (deliveryid) REFERENCES DELIVERY,
  115.     );
  116.  
  117. CREATE TABLE SUPPLIER(
  118.     SUpplierid varchar(30) PRIMARY KEY,
  119.     "name" varchar(30),
  120.     "country" varchar(30),
  121.     city varchar(30),
  122.     street varchar(30),
  123.     buildingnumber int,
  124.     phone varchar(30),
  125.     email varchar(30),
  126.     bankacc varchar(30),
  127.     );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top