3.3 Perancangan Basis Data Konseptual .1 Identifikasi Tipe Entitas
3.4.2 Menentukan Relasi untuk Model Data Logikal
Tujuan dari tahap ini adalah membuat relasi model data logikal lokal untuk menampilkan kembali entitas, relational, dan atribut yang telah diidentifikasi.
3.4.2.1 Strong and Weak Entity Types
Pada model data kami yang merupakan strong entity types adalah sebagai berikut :
a) Employee (EmployeeID, EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, Position)
Primary Key : EmployeeID
b) Customer (CustomerID, CustomerName, CustomerAdd, CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass, DestinationAdd)
Primary Key : CustomerID
c) Delivery (DeliveryID, DeliveryDate, WarehouseID, VehicleID) Primary Key : DeliveryID
d) Transaction (DocumentNo, PurchaseOrderID, TransactionDate, MaturityDate, SalesConfirmDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo)
Primary Key : DocumentNo
e) Product (ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductType, Stock)
Primary Key : ProductID
107 Primary Key : VehicleID
g) Warehouse (WarehouseID, WarehouseName, WarehouseAdd, WarehousePhone, WarehouseFax, WarehousePass, VerPass)
Primary Key : WarehouseID
h) Request (RequestID, RequestDate, WarehouseID) Primary Key : RequestID
i) PurchaseOrder (PurchaseOrderID, CustomerID, PurchaseOrderDate, EmployeeID)
Primary Key : PurchaseOrderID
Pada model data kami yang merupakan weak entity types adalah sebagai berikut :
a) Message (MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID, Comment, CommentPost, CommentTime)
Primary Key : MessageID
b) DetailTransaction (DocumentNo, ProductID, Qty, DetailDate) Primary Key : ProductID, DocumentNo
c) RequestDetail (RequestID, ProductID, Qty) Primary Key : RequestID, ProductID
d) Input (EmployeeID, CustomerID, InputDate) Primary Key : EmployeeID, CustomerID
108
3.4.2.2 One-to-Many Binary Relationship Types
Relasi 1:* memiliki 2 bagian, yaitu pada entitas yang bernilai 1 (one) disebut dengan istilah parent entity dan pada entitas yang bernilai * (many) disebut dengan istilah child entity. Berikut adalah relasi – relasi 1:* serta hasil posting dari entitas – entitas yang berhubungan satu dengan yang lainnya :
1. Relasi antara Employee dengan Input melakukan posting EmployeeID ke entitas Input.
Employee (EmployeeID,
EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, Position)
Primary Key (EmployeeID)
Input (EmployeeID, CustomerID, InputDate) Primary Key (EmployeeID, CustomerID)
Foreign Key (EmployeeID) references Employee
(EmployeeID)
Foreign Key (CustomerID) references Customer
109
2. Relasi antara Employee dengan Message melakukan posting EmployeeID ke entitas Message.
Employee (EmployeeID, EmployeeName,
EmployeeAdd, EmployeePhone,
EmployeePass, Position) Primary Key (EmployeeID)
Message (MessageID, Topic, MessageTime, MessagePost, CustomerID,
EmployeeID, Comment, CommentPost, CommentTime) Primary Key (MessageID) Foreign Key (EmployeeID)
references Employee (EmployeeID) Foreign Key (CustomerID)
110
3. Relasi antara Customer dengan Message melakukan posting CustomerID ke entitas Message.
Customer (CustomerID, CustomerName, CustomerAdd, CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass, DestinationAdd)
Primary Key (CustomerID)
Message (MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID, Comment, CommentPost, CommentTime)
Primary Key (MessageID) Foreign Key (EmployeeID)
references Employee (EmployeeID) Foreign Key (CustomerID)
111
4. Relasi antara Customer dengan PurchaseOrder melakukan posting CustomerID ke entitas PurchaseOrder.
Customer (CustomerID, CustomerName, CustomerAdd, CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass, DestinationAdd)
Primary Key (CustomerID)
PurchaseOrder (PurchaseOrderID, EmployeeID, CustomerID,
PurchaseOrderDate)
Primary Key (PurchaseOrderID) Foreign Key (CustomerID)
references Customer (CustomerID) Foreign Key (EmployeeID)
references Employee (EmployeeID)
5. Relasi antara Employee dengan PurchaseOrder melakukan posting EmployeeID ke entitas PurchaseOrder.
Employee (EmployeeID, EmployeeName,
EmployeeAdd, EmployeePhone,
EmployeePass, Position) Primary Key (EmployeeID)
PurchaseOrder (PurchaseOrderID, EmployeeID, CustomerID,
PurchaseOrderDate)
Primary Key (PurchaseOrderID) Foreign Key (CustomerID)
references Customer (CustomerID) Foreign Key (EmployeeID)
112
6. Relasi antara Employee dengan Transaction melakukan posting EmployeeID ke entitas Transaction.
Employee (EmployeeID, EmployeeName,
EmployeeAdd, EmployeePhone,
EmployeePass, Position) Primary Key (EmployeeID)
Transaction (DocumentNo, TransactionDate, MaturityDate, DeliveryID, TransferNo, PurchaseOrderID, EmployeeID, Status, DeliveryStatus, PaymentStatus) Primary Key (DocumentNo) Foreign Key (DeliveryID) references Delivery (DeliveryID) Foreign Key (EmployeeID) references Employee
(EmployeeID)
Foreign Key (PurchaseOrderID) references PurchaseOrder
113
7. Relasi antara Vehicle dengan Delivery melakukan posting VehicleID ke entitas Delivery.
Vehicle (VehicleID,
VehicleName, WarehouseID) Primary Key (VehicleID) Foreign Key (WarehouseID) references Warehouse (WarehouseID) Delivery (DeliveryID, WarehouseID, VehicleID, DeliveryDate)
Primary Key (DeliveryID) Foreign Key (VehicleID) references Vehicle (VehicleID) Foreign Key (WarehouseID) references Warehouse
(WarehouseID)
8. Relasi antara Warehouse dengan Delivery melakukan posting WarehouseID ke entitas Delivery.
Warehouse (WarehouseID, WarehouseName, WarehouseAdd, WarehousePhone, WarehouseFax, WarehousePass, VerPass) Primary Key (WarehouseID)
Delivery (DeliveryID, WarehouseID, VehicleID, DeliveryDate)
Primary Key (DeliveryID) Foreign Key (VehicleID) references Vehicle (VehicleID) Foreign Key (WarehouseID) references Warehouse
114
9. Relasi antara Warehouse dengan Vehicle melakukan posting WarehouseID ke entitas Vehicle.
Warehouse (WarehouseID, WarehouseName, WarehouseAdd, WarehousePhone, WarehouseFax, WarehousePass, VerPass) Primary Key (WarehouseID) Vehicle (VehicleID, VehicleName, WarehouseID) Primary Key (VehicleID) Foreign Key (WarehouseID) references Warehouse
115
10. Relasi antara Warehouse dengan Request melakukan posting WarehouseID ke entitas Request.
Warehouse (WarehouseID, WarehouseName, WarehouseAdd, WarehousePhone, WarehouseFax, WarehousePass, VerPass) Primary Key (WarehouseID)
Request (RequestID,
WarehouseID, RequestDate) Primary Key (RequestID) Foreign Key (WarehouseID) references Warehouse
(WarehouseID)
3.4.2.3 One-to-One Binary Relationship Types
Pada hubungan ini entitas yang terkait akan digabungkan menjadi satu entitas dan primary key akan dipilih dari salah satu entitas tersebut jika terbukti bahwa kedua entitas tersebut tidak mempunyai alasan yang tepat untuk tetap memiliki hubungan binary one-to-one. Pada model data kami ditemukan adanya tiga hubungan one-to-one dan setelah dipertimbangkan hubungan tersebut tidak perlu digabungkan.
3.4.2.4 Superclass / Subclass Relationship Types
Pada model data konseptual, tidak ditemukan adanya hubungan superclass maupun subclass.
116
3.4.2.5 Many-to-Many Binary Relationship Types Hubungan Product dengan Transaction Transaction (DocumentNo,
PurchaseOrderID,
TransactionDate, MaturityDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo)
Primary Key (DocumentNo)
Foreign Key (DeliveryID) references Delivery (DeliveryID)
Foreign Key (EmployeeID) references Employee (EmployeeID)
Foreign Key (PurchaseOrderID) references PurchaseOrder (PurchaseOrderID)
Product (ProductID,
ProductName, ProductPrice, ProductSize, ProductImage, ProductType)
Primary Key (ProductID)
DetailTransaction (DocumentNo, ProductID, Qty, DetailDate) Primary Key (DocumentNo, ProductID)
Foreign Key (DocumentNo) references Transaction (DocumentNo)
117 Hubungan Product dengan Request Request (RequestID,
WarehouseID, RequestDate) Primary Key (RequestID) Foreign Key (WarehouseID) references Warehouse (WarehouseID) Product (ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductType)
Primary Key (ProductID)
RequestDetail (RequestID, ProductID, Qty) Primary Key (RequestID, ProductID)
Foreign Key (RequestID) references Request (RequestID) Foreign Key (ProductID) references Product (ProductID)
3.4.2.6 Multivalue Attribute
Multivalue attribute merupakan atribut yang memiliki nilai multiple / lebih dari satu. Dalam model data yang telah dibentuk, tidak ada entitas yang memiliki atribut demikian. Setiap atribut dibuat dengan hanya memiliki satu nilai.
Tabel 3. 19 Dokumentasi Relasi untuk Model Data Logikal
No Relation
1 Employee (EmployeeID, EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, Position)
118
No Relation
Primary Key : EmployeeID
2 Customer (CustomerID, CustomerName, CustomerAdd, CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass, DestinationAdd)
Primary Key : CustomerID
3 Message (MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID, Comment, CommentPost, CommentTime)
Primary Key : MessageID
Foreign Key : EmployeeID references Employee Foreign Key : CustomerID references Customer
4 Delivery (DeliveryID, DeliveryDate, WarehouseID, VehicleID) Primary Key : DeliveryID
Foreign Key : VehicleID references Vehicle Foreign Key : WarehouseID references Warehouse
5 Product (ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductType)
Primary Key : ProductID
6 Transaction (DocumentNo, PurchaseOrderID, TransactionDate, MaturityDate, SalesConfirmDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo)
119
No Relation
Foreign Key : DeliveryID references Delivery
Foreign Key : PurchaseOrderID references PurchaseOrder Foreign Key : EmployeeID references Employee
7 DetailTransaction (DocumentNo, ProductID, Qty, DetailDate) Primary Key : DocumentNo, ProductID
Foreign Key : DocumentNo references Transaction Foreign Key : ProductID references Product
8 PurchaseOrder (PurchaseOrderID, CustomerID, EmployeeID, PurchaseOrderDate)
Primary Key : PurchaseOrderID
Foreign Key : CustomerID references Customer Foreign Key : EmployeeID references Employee 9 Input (EmployeeID, CustomerID, InputDate)
Primary Key : EmployeeID, CustomerID Foreign Key : EmployeeID references Employee Foreign Key : CustomerID references Customer 10 Vehicle (VehicleID, VehicleName, WarehouseID)
Primary Key : VehicleID
Foreign Key : WarehouseID references Warehouse
11 Warehouse (WarehouseID, WarehouseName, WarehouseAdd, WarehousePhone, WarehouseFax, WarehousePass, VerPass) Primary Key : WarehouseID
120
No Relation
12 Request (RequestID, WarehouseID, RequestDate) Primary Key : RequestID
Foreign Key : WarehouseID references Warehouse 13 RequestDetail (RequestID, ProductID, Qty)
Primary Key : RequestID, ProductID Foreign Key : RequestID references Request Foreign Key : ProductID references Product
Gambar 3. 15 ERD Logikal Awal
121 3.4.3 Validasi Relasi menggunakan Normalisasi
Tujuan dari langkah ini adalah untuk menghilangkan redundansi dan menghindari data yang tidak konsisten terutama bila dilakukan penambahan atau penghapusan data.
1. Employee (EmployeeID, EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, Position)
1NF : @EmployeeID, EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, Position
2NF : @EmployeeID, EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, Position
3NF : @EmployeeID, EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, PositionID
Position : @PositionID, Position
2. Customer (CustomerID, CustomerName, CustomerAdd, CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass, DeliveryAdd)
1NF : @CustomerID, CustomerName, CustomerAdd, CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass, DeliveryAdd
3. Message (MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID, Comment, CommentPost, CommentTime)
1NF : @MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID, Comment, CommentPost, CommentTime
122
2NF : @MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID
DetailMessage : @CommentTime, @MessageID, Comment, CommentPost
3NF : @MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID
DetailMessage : @CommentTime, @MessageID, Comment, CommentPost
Customer : @CustomerID, CustomerName, CustomerAdd,
CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass,
DeliveryAdd
Employee :@EmployeeID, EmployeeName,
EmployeeAdd, EmployeePhone, EmployeePass, PositionID
4. Delivery (DeliveryID, DeliveryDate, WarehouseID, VehicleID) 1NF : @ DeliveryID, DeliveryDate, WarehouseID, VehicleID 2NF : @ DeliveryID, DeliveryDate, WarehouseID, VehicleID 3NF : @ DeliveryID, DeliveryDate, WarehouseID, VehicleID
Warehouse :@WarehouseID, WarehouseName, WarehouseAdd, VerPass, WarehouseFax, WarehousePass, Warehouse Phone
123
5. Product (ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductType)
1NF : @ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductType
2NF : @ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductType
3NF : @ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductTypeID
ProductType : @ProductTypeID, ProductType
6. Transaction (DocumentNo, PurchaseOrderID, TransactionDate, MaturityDate, SalesConfirmDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo)
1NF :@DocumentNo, PurchaseOrderID, TransactionDate, MaturityDate, SalesConfirmDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo
2NF :@DocumentNo, PurchaseOrderID, TransactionDate, MaturityDate, SalesConfirmDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo
3NF :@DocumentNo, PurchaseOrderID, TransactionDate, MaturityDate, SalesConfirmDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo
Delivery : @DeliveryID, DeliveryDate, WarehouseID, VehicleID
124
PurchaseOrder :@PurchaseOrderID, PurchaseOrderDate, @CustomerID, EmployeeID
Employee :@EmployeeID, EmployeeName,
EmployeeAdd, EmployeePhone, EmployeePass, PositionID
7. DetailTransaction (DocumentNo, ProductID, Qty, DetailDate) 1NF : @ DocumentNo, @ProductID, Qty, DetailDate
2NF : @ DocumentNo, @ProductID, Qty, DetailDate 3NF : @ DocumentNo, @ProductID, Qty, DetailDate
Product : @ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductTypeID 8. PurchaseOrder (PurchaseOrderID, PurchaseOrderDate, CustomerID,
EmployeeID)
1NF :@PurchaseOrderID, PurchaseOrderDate, CustomerID, EmployeeID
2NF :@PurchaseOrderID, PurchaseOrderDate, CustomerID, EmployeeID
3NF :@PurchaseOrderID, PurchaseOrderDate, @CustomerID, EmployeeID
Customer : @CustomerID, CustomerName, CustomerAdd,
CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass,
125
Employee :@EmployeeID, EmployeeName,
EmployeeAdd, EmployeePhone, EmployeePass, PositionID
9. Input (CustomerID, EmployeeID, InputDate) 1NF :@CustomerID, @EmployeeID, InputDate 2NF :@CustomerID, @EmployeeID, InputDate 3NF :@CustomerID, @EmployeeID, InputDate
Customer : @CustomerID, CustomerName, CustomerAdd,
CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass,
DeliveryAdd
Employee :@EmployeeID, EmployeeName,
EmployeeAdd, EmployeePhone, EmployeePass, PositionID
10. Vehicle (VehicleID, WarehouseID, VehicleName) 1NF :@VehicleID, WarehouseID, VehicleName 2NF :@VehicleID, WarehouseID, VehicleName 3NF :@VehicleID, WarehouseID, VehicleName
Warehouse :@WarehouseID, WarehouseName, WarehouseAdd, VerPass, WarehouseFax, WarehousePass, WarehousePhone
11. Warehouse (WarehouseID, WarehouseName, WarehouseAdd, WarehousePhone, WarehouseFax, WarehousePass, VerPass)
126
1NF : @WarehouseID, WarehouseName, WarehouseAdd, VerPass, WarehouseFax, WarehousePass, WarehousePhone
12. Request (RequestID, RequestDate, WarehouseID) 1NF :@RequestID, RequestDate, WarehouseID 2NF :@RequestID, RequestDate, WarehouseID 3NF :@RequestID, RequestDate, WarehouseID
Warehouse :@WarehouseID, WarehouseName, WarehouseAdd, VerPass, WarehouseFax, WarehousePass, WarehousePhone
13. RequestDetail (RequestID, ProductID, Qty) 1NF :@RequestID, @ProductID, Qty 2NF :@RequestID, @ProductID, Qty 3NF :@RequestID, @ProductID, Qty
Product :@ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductTypeID
Tabel 3. 20 Dokumentasi Relasi Model Data Logikal Setelah Dilakukan Normalisasi
No Relation
1 Employee (EmployeeID, EmployeeName, EmployeeAdd, EmployeePhone, EmployeePass, PositionID)
Primary Key : EmployeeID
Foreign Key : PositionID references Position 2 Position (PositionID, Position)
127
No Relation
Primary Key : PositionID
3 Customer (CustomerID, CustomerName, CustomerAdd, CustomerTaxNo, CustomerPhone, CustomerFax, CustomerCP, CustomerPass, DeliveryAdd)
Primary Key : CustomerID
4 Message (MessageID, Topic, MessageTime, MessagePost, CustomerID, EmployeeID)
Primary Key : MessageID
Foreign Key : EmployeeID references Employee Foreign Key : CustomerID references Customer 5 DetailMessage (MessageID, Comment, CommentPost,
CommentTime)
Primary Key : MessageID, CommentTime Foreign Key : MessageID references Message
6 Delivery (DeliveryID, DeliveryDate, WarehouseID, VehicleID) Primary Key : DeliveryID
Foreign Key : WarehouseID references Warehouse Foreign Key : VehicleID references Vehicle
7 Product (ProductID, ProductName, ProductPrice, ProductSize, ProductImage, ProductTypeID)
Primary Key : ProductID
128
No Relation
8 ProductType (ProductTypeID, ProductType) Primary Key : ProductTypeID
9 Transaction (DocumentNo, CustomerID, PurchaseOrderID, TransactionDate, MaturityDate, SalesConfirmDate, DeliveryID, EmployeeID, Status, DeliveryStatus, PaymentStatus, TransferNo) Primary Key : DocumentNo
Foreign Key : CustomerID references PurchaseOrder Foreign Key : PurchaseOrder ID references PurchaseOrder Foreign Key : DeliveryID references Delivery
Foreign Key : EmployeeID references Employee
10 DetailTransaction (DocumentNo, ProductID, Qty, DetailDate) Primary Key : DocumentNo, ProductID
Foreign Key : DocumentNo references Transaction Foreign Key : ProductID references Product
11 PurchaseOrder (PurchaseOrderID, PurchaseOrderDate, CustomerID, EmployeeID)
Primary Key : PurchaseOrderID
Foreign Key : CustomerID references Customer Foreign Key : EmployeeID references Employee 12 Input (CustomerID, EmployeeID, InputDate)
Primary Key : CustomerID, EmployeeID Foreign Key : CustomerID references Customer
129
No Relation
Foreign Key : EmployeeID references Employee 13 Vehicle (VehicleID, WarehouseID, VehicleName)
Primary Key : VehicleID
Foreign Key : WarehouseID references Warehouse
14 Warehouse (WarehouseID, WarehouseName, WarehouseAdd, WarehousePhone, WarehouseFax, WarehousePass, VerPass) Primary Key : WarehouseID
15 Request (RequestID, RequestDate, WarehouseID) Primary Key : RequestID
Foreign Key : WarehouseID references Warehouse 16 RequestDetail (RequestID, ProductID, Qty)
Primary Key : RequestID, ProductID
Foreign Key : RequestID references Request Foreign Key : ProductID references Product
130
Gambar 3. 16 ERD Logikal setelah dilakukan Normalisasi