• Tidak ada hasil yang ditemukan

Merancang Relasi Dasar / Base Relations

Dalam dokumen BAB 3 ANALISIS DAN PERANCANGAN SISTEM (Halaman 87-98)

3.5 Perancangan Basis Data Fisikal

3.5.1 Menerjemahkan Model Data Logikal untuk target DBMS

3.5.1.1 Merancang Relasi Dasar / Base Relations

Tujuan dari langkah ini adalah menentukan bagaimana cara merepresentasikan relasi dasar yang teridentifikasi pada model data logikal dalam DBMS yang dituju. Berikut adalah hasil dokumentasi dengan menggunakan DBDL (Database Design Language) :

1. Employee

DOMAIN EmployeeCode Fixed length char, length 6

DOMAIN NameOfEmployee Variable length varchar, length 50 DOMAIN EmployeeAddress Variable length varchar, length 100 DOMAIN PhoneOfEmployee Variable length varchar, length 20 DOMAIN EmployeePassword Variable length varchar, length 20 DOMAIN PositionCode Fixed length char, length 4

Employee (

EmployeeID EmployeeCode NOT NULL,

EmployeeName NameOfEmployee NOT NULL, EmployeeAdd EmployeeAddress,

EmployeePhone PhoneOfEmployee NOT NULL, EmployeePass EmployeePassword NOT NULL,

PositionID PositionCode NOT NULL,

Primary Key (EmployeeID),

Foreign Key (PositionID) references Position (PositionID) ON UPDATE CASCADE ON DELETE NO ACTION);

  145   2. Customer

DOMAIN CustomerCode Fixed length char, length 5

DOMAIN NameOfCustomer Variable length varchar, length 50 DOMAIN CustomerAddress Variable length varchar, length 100 DOMAIN CustomerTaxNumber Fixed length char, length 16

DOMAIN PhoneOfCustomer Variable length varchar, length 20 DOMAIN FaxOfCustomer Variable length varchar, length 20 DOMAIN CustomerContactPerson Variable length varchar, length 50 DOMAIN CustomerPassword Variable length varchar, length 20 DOMAIN DestinationAddress Variable length varchar, length 100

Customer (

CustomerID CustomerCode NOT NULL,

CustomerName NameOfCustomer NOT NULL, CustomerAdd CustomerAddress NOT NULL, CustomerTaxNo CustomerTaxNumber NOT NULL, CustomerPhone PhoneOfCustomer NOT NULL,

CustomerFax FaxOfCustomer NOT NULL,

CustomerCP CustomerContactPerson NOT NULL,

CustomerPass CustomerPassword NOT NULL, DestinationAdd DestinationAddress NOT NULL,

  146   3. Delivery

DOMAIN DeliveryCode Variable length varchar, length 20 DOMAIN DateOfDelivery Date

DOMAIN VehicleCode Variable length varchar, length 9 DOMAIN WarehouseCode Fixed length char, length 4

Delivery (

DeliveryID DeliveryCode NOT NULL,

DeliveryDate DateOfDelivery NOT NULL,

VehicleID VehicleCode NOT NULL,

WarehouseID WarehouseCode NOT NULL,

Primary Key (DeliveryID),

Foreign Key (VehicleID) references Vehicle (VehicleID) ON UPDATE CASCADE ON DELETE NO ACTION,

Foreign Key (WarehouseID) references Warehouse (WarehouseID) ON UPDATE CASCADE ON DELETE NO ACTION );

4. Input

DOMAIN EmployeeCode Fixed length char, length 6 DOMAIN CustomerCode Fixed length char, length 5 DOMAIN DateOfInput Date

Input (

  147  

CustomerID CustomerCode NOT NULL,

InputDate DateOfInput NOT NULL,

Primary Key (EmployeeID, CustomerID),

Foreign Key (EmployeeID) references Employee (EmployeeID) ON UPDATE CASCADE ON DELETE NO ACTION,

Foreign Key (CustomerID) references Customer (CustomerID) ON UPDATE CASCADE ON DELETE NO ACTION);

5. Position

DOMAIN PositionCode Fixed length char, length 4

DOMAIN PositionInDivision Variable length varchar, length 30

Position (

PositionID PositionCode NOT NULL,

Position PositionInDivision NOT NULL, Primary Key (PositionID) );

6. Message

DOMAIN MessageCode Fixed length char, length 8

DOMAIN TopicMessage Variable length varchar, length 100 DOMAIN TimeMessage DateTime

DOMAIN PostMessage Variable length varchar, length 50 DOMAIN CustomerCode Fixed length char, length 5

  148   Message (

MessageID MessageCode NOT NULL,

Topic TopicMessage NOT NULL,

MessageTime TimeMessage NOT NULL,

MessagePost PostMessage NOT NULL,

CustomerID CustomerCode NOT NULL,

EmployeeID EmployeeCode NOT NULL,

Primary Key (MessageID),

Foreign Key (CustomerID) references Customer (CustomerID) ON UPDATE CASCADE ON DELETE NO ACTION,

Foreign Key (EmployeeID) references Employee (EmployeeID) ON UPDATE CASCADE ON DELETE NO ACTION );

7. DetailMessage

DOMAIN MessageCode Fixed length char, length 8

DOMAIN CommentOfMessage Variable length varchar, length 200 DOMAIN PostDetailMessage Variable length varchar, length 50 DOMAIN TimeDetailMessage DateTime

DetailMessage (

MessageID MessageCode NOT NULL,

Comment CommentOfMessage NOT NULL,

CommentPost PostDetailMessage NOT NULL, CommentTime TimeDetailMessage NOT NULL,

  149   Primary Key (MessageID, CommentTime),

Foreign Key (MessageID) references Message (MessageID) ON UPDATE CASCADE ON DELETE NO ACTION );

8. Product

DOMAIN ProductCode Fixed length char, length 10 DOMAIN NameOfProduct Variable length varchar, length 50 DOMAIN PriceOfProduct Integer, in the range 0 – 11

DOMAIN SizeOfProduct Variable length varchar, length 20 DOMAIN ImageOfProduct Variable length varchar, length 30 DOMAIN StockOfProduct Integer, in the range 0 – 11

DOMAIN ProductTypeCode Fixed length char, length 2

Product (

ProductID ProductCode NOT NULL,

ProductName NameOfProduct NOT NULL,

ProductPrice PriceOfProduct NOT NULL,

ProductSize SizeOfProduct NOT NULL,

ProductImage ImageOfProduct NOT NULL, Stock StockOfProduct NOT NULL, ProductTypeID ProductTypeCode NOT NULL, Primary Key (ProductID),

Foreign Key (ProductTypeID) references ProductType (ProductTypeID) ON UPDATE CASCADE ON DELETE NO ACTION );

  150   9. ProductType

DOMAIN ProductTypeCode Fixed length char, length 2

DOMAIN TypeOfProduct Variable length varchar, length 20

ProductType (

ProductTypeID ProductTypeCode NOT NULL,

ProductType TypeOfProduct NOT NULL,

Primary Key (ProductTypeID) );

10. Transaction

DOMAIN DocumentNumber Fixed length char, length 5 DOMAIN CustomerCode Fixed length char, length 5

DOMAIN PurchaseOrderCode Variable length varchar, length 30 DOMAIN DateOfTransaction Date

DOMAIN DateOfMaturity Date DOMAIN DateOfSalesConfirm Date

DOMAIN DeliveryCode Variable length varchar, length 20 DOMAIN EmployeeCode Fixed length char, length 6

DOMAIN StatusConfirmation Tiny Integer

DOMAIN TransferNumber Variable length varchar, length 20 DOMAIN StatusOfDelivery Tiny Integer

DOMAIN StatusOfPayment Tiny Integer Transaction (

  151  

CustomerID CustomerCode NOT NULL,

PurchaseOrderID PurchaseOrderCode NOT NULL, TransactionDate DateOfTransaction,

MaturityDate DateOfMaturity,

DeliveryID DeliveryCode NOT NULL,

EmployeeID EmployeeCode NOT NULL,

Status StatusConfirmation NOT NULL, TransferNo TransferNumber,

DeliveryStatus StatusOfDelivery NOT NULL, PaymentStatus StatusOfPayment NOT NULL, Primary Key (DocumentNo),

Foreign Key (CustomerID) references PurchaseOrder (CustomerID) ON UPDATE CASCADE ON DELETE NO ACTION,

Foreign Key (PurchaseOrderID) references PurchaseOrder (PurchaseOrderID) ON UPDATE CASCADE ON DELETE NO ACTION,

Foreign Key (DeliveryID) references Delivery (DeliveryID) ON UPDATE CASCADE ON DELETE NO ACTION,

Foreign Key (EmployeeID) references Employee (EmployeeID) ON UPDATE CASCADE ON DELETE NO ACTION );

11. DetailTransaction

DOMAIN DocumentNumber Fixed length char, length 5 DOMAIN ProductCode Fixed length char, length 10 DOMAIN QtyOfProduct Integer, in the range 0 – 11

  152  

DOMAIN DateDetail DateTime

DetailTransaction (

DocumentNo DocumentNumber NOT NULL,

ProductID ProductCode NOT NULL,

Qty QtyOfProduct NOT NULL,

DetailDate DateDetail NOT NULL,

Primary Key (DocumentNo, ProductID),

Foreign Key (DocumentNo) references Transaction (DocumentNo) ON UPDATE CASCADE ON DELETE NO ACTION ),

Foreign Key (ProductID) references Product (ProductID) ON UPDATE CASCADE ON DELETE NO ACTION);

12. PurchaseOrder

DOMAIN PurchaseOrderCode Variable length varchar, length 30 DOMAIN CustomerCode Fixed length char, length 5

DOMAIN EmployeeCode Fixed length char, length 6 DOMAIN DateOfPurchaseOrder Date

PurchaseOrder (

PurchaseOrderID PurchaseOrderCode NOT NULL,

CustomerID CustomerCode NOT NULL,

EmployeeID EmployeeCode NOT NULL,

  153   Primary Key (PurchaseOrderID, CustomerID),

Foreign Key (EmployeeID) references Employee (EmployeeID) ON UPDATE CASCADE ON DELETE NO ACTION ),

Foreign Key (CustomerID) references Customer (CustomerID) ON UPDATE CASCADE ON DELETE NO ACTION );

13. Vehicle

DOMAIN VehicleCode Variable length varchar, length 9 DOMAIN NameOfVehicle Variable length varchar, length 50 DOMAIN WarehouseCode Fixed length char, length 4

Vehicle (

VehicleID VehicleCode NOT NULL,

VehicleName NameOfVehicle NOT NULL,

WarehouseID WarehouseCode NOT NULL,

Primary Key (VehicleID),

Foreign Key (WarehouseID) references Warehouse (WarehouseID) ON UPDATE CASCADE ON DELETE NO ACTION );

14. Warehouse

DOMAIN WarehouseCode Fixed length char, length 4

DOMAIN NameOfWarehouse Variable length varchar, length 50 DOMAIN WarehouseAddress Variable length varchar, length 100 DOMAIN PhoneOfWarehouse Variable length varchar, length 20

  154  

DOMAIN FaxOfWarehouse Variable length varchar, length 20 DOMAIN WarehousePassword Variable length varchar, length 20 DOMAIN VerificationPassword Variable length varchar, length 30

Warehouse (

WarehouseID WarehouseCode NOT NULL,

WarehouseName NameOfWarehouse NOT NULL, WarehouseAdd WarehouseAddress NOT NULL, WarehousePhone PhoneOfWarehouse NOT NULL, WarehouseFax FaxOfWarehouse NOT NULL, WarehousePass WarehousePassword NOT NULL,

VerPass VerificationPassword NOT NULL, Primary Key (WarehouseID));

15. Request

DOMAIN RequestCode Fixed length char, length 4 DOMAIN DateOfRequest Date

DOMAIN WarehouseCode Fixed length char, length 4

Request (

RequestID RequestCode NOT NULL,

RequestDate DateOfRequest NOT NULL,

WarehouseID WarehouseCode NOT NULL,

  155  

Foreign Key (WarehouseID) references Warehouse (WarehouseID) ON UPDATE CASCADE ON DELETE NO ACTION );

16. RequestDetail

DOMAIN RequestCode Fixed length char, length 4 DOMAIN ProductCode Fixed length char, length 10 DOMAIN QtyOfRequest Integer, in the range 0 – 11

RequestDetail (

RequestID RequestCode NOT NULL,

ProductID ProductCode NOT NULL,

Qty QtyOfRequest NOT NULL,

Primary Key (RequestID, ProductID),

Foreign Key (ProductID) references Product (ProductID) ON UPDATE CASCADE ON DELETE NO ACTION,

Foreign Key (RequestID) references Request (RequestID) ON UPDATE CASCADE ON DELETE NO ACTION );

Dalam dokumen BAB 3 ANALISIS DAN PERANCANGAN SISTEM (Halaman 87-98)

Dokumen terkait