Академический Документы
Профессиональный Документы
Культура Документы
INDEX
1. APPLICATION DESCRIPTION ................................................................................... 2 1.1. Presentation of the Company and the System.......................................................... 2 1.2. Users of the Database............................................................................................... 3 1.3. Entities of the Database ........................................................................................... 3 1.4. Inputs of the Database .............................................................................................. 3 1.5. Data Constraints of the Database ............................................................................. 4 1.6. Reports of the Database ........................................................................................... 6 1.7. Operations of the Database ...................................................................................... 6 2. CONCEPTUAL DATA MODEL ................................................................................... 6 2.1. Entity-Relationship Diagram ................................................................................... 7 3. LOGICAL DATA MODEL............................................................................................ 8 3.1. Normalized Relational Schema................................................................................ 8 3.2. Primary Keys ........................................................................................................... 8 3.3. Referential Integrity Constraints .............................................................................. 9 3.4. Functional Dependencies ......................................................................................... 9 4. PHYSICAL DATA MODEL........................................................................................ 10 4.1. DDL SQL Statements ............................................................................................ 10 4.1.1. CUSTOMER Table ...................................................................................... 10 4.1.2. PRODUCT Table ......................................................................................... 11 4.1.3. PERSONNEL Table ..................................................................................... 12 4.1.4. ORDER Table .............................................................................................. 12 4.1.5. WAREHOUSE Table ................................................................................... 13 4.1.6. DELIVERY Table ........................................................................................ 13 4.1.7. INVOICE Table ........................................................................................... 14 4.1.8. STORE Table ............................................................................................... 14 5. OPERATIONS AND REPORTS ................................................................................. 16 5.1. DML SQL Statements for Operations ................................................................... 16 5.2. DML SQL Statements for Reports ........................................................................ 16
1. APPLICATION DESCRIPTION
1.1. Presentation of the Company and the System
The Hayat Group, the share capital of which is under the possession of the Kil Family, primarily shows activity in the chemicals and wood-based industry. Hayat Group consists of: Hayat Chemicals Inc. Hayat Cleaning and Sanitary Products Corp. Lima Port Enterprises Inc. Yongapan Forestry Products Inc.
Hayat Chemicals Cleaning and Sanitary Products is manufacturing household cleaning products, baby-care products, feminine hygienic products and personal care products with its state-of-the-art technology in its zmit-Yeniky Integrated Manufacturing Facilities. The company uses ERP system built on SAP software. The system consists of several modules which provide overall control and manageability. The most important modules are listed below: MM (Materials Management) PP (Production Planning) SD (Sales and Distribution)
Besides the main modules, Hayat Group uses also the assistant SAP modules such as: FI (Financial Accounting) CO (Controlling) PS (Project Systems) QM (Quality Management) BW (Business Warehousing) PM (Plant Maintenance)
Delivery data (delivery ID, delivery date, delivery cost, delivery status, delivery channel, total weight, total volume) Invoice data (invoice number, date, sum, total tax) Warehouse data (warehouse number, location, city, capacity) Store data(product quantity, stock amount)
Attributes having alphabetic characters: o Customer name(50 characters) o Country (25 characters) o City(25 characters) o Street (25 characters) o Order status (accepted or rejected) o Personnel name (25 characters) o Personnel surname (25 characters) o Personnel type (25 characters) o Department (20 characters) o Delivery status (delivered or not delivered) o Delivery Channel (25 characters) o Warehouse city (25 characters) o Status (available or not available)
Attributes having alphanumeric characters: o Customer type (25 characters) o Street (25 characters) o Customer e-mail ( 25 characters) o Personnel address (50 characters) o Personnel e-mail (25 characters) o Warehouse location (25 characters) o Product name (50 characters) o Product type (25 characters) o Brand (25 characters)
Description, Status, P_Weight, P_Volume) WAREHOUSE (Warehouse_No, Location, City, Capacity, Personnel_ID) DELIVERY (Delivery_No, D_Date, D_Cost, D_Status, D_Channel,
Total_Weight, Total_Volume, Personnel_ID) INVOICE (Invoice_No, Order_ID, Date, Sum, Tax_Amount, Personnel_ID) STORE (Order_ID, Product_ID, Warehouse_No, P_Quantity, Stock_Amt) 9
Product int <pk> char(50) char(25) char(25) numeric(5) varchar(50) char(25) numeric(4,2) numeric(5,2)
FK_PRODUCT_IS_STORED
Store Warehouse int <pk>,<fk1> Warehouse_No int int <pk>, <fk2> FK_WAREHOUSE_IS_STORED Personnel_ID int int <pk>, <fk3> Location char(25) numeric(6,2) Capacity char(10) numeric(6,2) City char(25)
<pk> <fk>
FK_ORDER_IS_STORED
FK_PERSONNEL_CONTROLS_WAREHOUSE
Customer Customer_ID int C_Name char(50) C_Type char(25) Country char(25) City char(25) Street char(25) C_Phone char(15) C_Email char(25) C_Fax char(15)
FK_ORDER_HAS_INVOICE
SSN Name FK_PERSONNEL_TAKES_ORDER Surname Type Department Salary Address Phone Email FK_PERSONNEL_CREATES_INVOICE
Personnel int char(25) char(25) char(25) char(20) char(5) char(50) char(10) char(25)
<pk>
Invoice int <pk> int <fk> int <fk> datetime numeric(8,2) numeric(5,2)
FK_PERSONNEL_PERFORMS_DELIVERY
FK_DELIVERY_RECEIVES_ORDER
Delivery Delivery_ID int <pk> Personnel_ID int <fk> D_Date datetime D_Cost numeric(6,2) D_Status char(25) D_Channel char(25) Total_Weight numeric(8,2) Total_Volume numeric(10,2)
10
4.1.2. PRODUCT Table CREATE TABLE PRODUCT ( Product_ID P_Name P_Type P_Brand Unit_Price Description Status P_Weight P_Volume int char(50) char(25) char(25) numeric(5,2) varchar(50) char(25) numeric(4,2) numeric(5,2) NOT NULL IDENTITY (1,1), NOT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
CONSTRAINT ProductPK PRIMARY KEY (Product_ID), CONSTRAINT ProductStatusValues (Status IN (available, not available)) );
11
4.1.3. PERSONNEL Table CREATE TABLE PERSONNEL ( SSN Name Surname Type Department Salary Address Phone Email int char (25) char(25) char(25) char(20) char(5) char(50) char(10) char(25) NOT NULL IDENTITY (1,1), NOT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
CONSTRAINT PersonnelPK PRIMARY KEY (SSN) CONSTRAINT SalaryValues CHECK (Salary 1000 AND Salary 10000 ) );
4.1.4. ORDER Table CREATE TABLE ORDER ( Order_ID O_Date O_Status int datetime char(10) NOT NULL IDENTITY (1,1), NULL, NULL,
CONSTRAINT OrderPK PRIMARY KEY (Order_ID), CONSTRAINT CustomerFK FOREIGN KEY (Customer_ID) REFERENCES CUSTOMER (Customer_ID) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT PersonnelFK FOREIGN KEY (Personnel_ID) REFERENCES PERSONNEL (SSN)
12
ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT DeliveryFK FOREIGN KEY (Delivery_ID) REFERENCES DELIVERY (Delivery_ID) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT StatusValues (O_Status IN (Accepted, Rejected)), );
4.1.5. WAREHOUSE Table CREATE TABLE WAREHOUSE ( Warehouse_No Location Capacity City int char(25 ) char(10) char(25) NOT NULL IDENTITY (1,1), NULL, NULL, NULL,
CONSTRAINT WarehousePK PRIMARY KEY (Warehouse_No) CONSTRAINT PerssonnelFK FOREIGN KEY (Personnel_ID) REFERENCES PERSONNEL(SSN) ON DELETE SET DEFAULT ON UPDATE CASCADE, );
4.1.6. DELIVERY Table CREATE TABLE DELIVERY ( Delivery_ID D_Date D_Cost D_Status D_Channel Total_Weight int datetime numeric(6,2) char(25) char(25) numeric(8,2) NOT NULL IDENTITY (1,1), NULL, NULL, NULL, NULL, NULL, 13
Total_Volume
numeric(10,2)
NULL,
CONSTRAINT DeliveryPK PRIMARY KEY (Delivery_ID), CONSTRAINT PersonnelFK FOREIGN KEY (Personnel_ID) REFERENCES PERSONNEL(SSN) ON DELETE SET DEFAULT ON UPDATE CASCADE, CONSTRAINT DstatusValues (D_Status IN (delivered, not delivered)), );
4.1.7. INVOICE Table CREATE TABLE INVOICE ( Invoice_No Date Sum Total_Tax int datetime numeric(8,2) numeric(5,2) NOT NULL IDENTITY (1,1), NULL, NULL, NULL,
CONSTRAINT InvoicePK PRIMARY KEY (Invoice_No), CONSTRAINT OrderFK FOREIGN KEY (Order_ID) REFERENCES ORDER (Order_ID) ON DELETE SET DEFAULT ON UPDATE CASCADE, CONSTRAINT PersonnelFK FOREIGN KEY (Personnel_ID) REFERENCES PERSONNEL(SSN) ON DELETE SET DEFAULT ON UPDATE CASCADE, ); 4.1.8. STORE Table CREATE TABLE STORE ( Product_ID Order_ID Warehouse_No int int int NOT NULL IDENTITY (1,1), NOT NULL, IDENTITY(1,1), NOT NULL, IDENTITY(1,1)
14
Stock_Amt P_Quantity
numeric(6,2) numeric(6,2)
CONSTRAINT ProductFK FOREIGN KEY (Product_ID) REFERENCES PRODUCT(Product_ID), CONSTRAINT OrderFK FOREIGN KEY (Order_ID) REFERENCES ORDER(Order_ID), CONSTRAINT WarehouseFK FOREIGN REFERENCES WAREHOUSE(Warehouse_No), ); KEY (Warehouse_No)
15
Stock Control: UPDATE STORE SET Stock_Amt = 2500 WHERE Product_ID = 15 and Warehouse_No= 3;
Customer.CustomerID, Delivery.D_Date, Delivery.D_Status FROM Delivery INNER = JOIN (Customer INNER ON JOIN [Order] ON =
Customer.[CustomerID] Order.[DeliveryID];
Order.[CustomerID])
Delivery.[DeliveryID]
16
Invoice.TotalTax, Personnel.SSN, Personnel.Name, Personnel.Surname FROM (Personnel INNER JOIN Invoice ON Personnel.[SSN] = Invoice.[P_SSN]) INNER JOIN [Order] ON Invoice.[InvoiceNo] = Order.[InvoiceNo];
Warehouse.Location, Store.StockAmount FROM Warehouse INNER JOIN (Product INNER JOIN Store ON Product.[ProductID] = Store.[ProductID]) ON Warehouse.[WarehouseNo] = Store.[WarehouseNo];
17