Project Database of Petshop Group 2 FINALBGT

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

1

Project
“Database of Petshop”

Group 2
Names : 1. Ahamad Almuhdar (2220010246)
2. Dinah Aryani Zavitri (2220010111)
3. Ryan Aric Ardhani (2220010162)

Class : 1CC4
Faculty : Mr. Feri Nugroho, S.ST.,M.IT

CEP CCIT
FAKULTAS TEKNIK UNIVERSITAS
INDONESIA
2022
2

PROJECT ON
Database of petshop

Developed by

1. Ahamad Almuhdar (2220010246)


2. Dinah Aryani Zavitri (2220010111)
3. Ryan Aric Ardhani (2220010162)
3

PROJECT ON

Batch Code : 1CC4


Start Date : 16 December 2022
End Date : 25 December 2022
Name of the Coordinator : Feri Nugroho, S.ST.,M.IT
Name of Developer : Ahmad Almuhdar
Dinah Aryani Zavitri
Ryan Aric Ardhani

Date of Submission : 28 December 2022


4

CERTIFICATE

This is to certify that this report titled Database of Petshop done by, Ahmad
Almuhdar, Dinah Aryani Zavitri and Ryan Aric Ardhani in partial fulfillment of their
course requirement at NIIT.

Coordinator:

Mr. Feri Nugroho, S.ST.,M.IT


5

ACKNOWLEDGEMENT

Authors would like to praise to Allah, Most Merciful bless and so authors can
finish this Project 1 entitled “Database of Petshop”. Author would like to thanks to Mr. Feri
Nugroho, as Lecturer who has given useful suggestion which are help author in writing this
paper.
The writer realized that this paper far from perfection, then the writer will be very
unfettered the chest and was encouraged, if colleagues and the guide's agreeing lecturer
gave the suggestion & criticism for this paper perfection.
6

SYSTEM ANALYSIS

System Summary :

The Database is a management process that is usually used in an organization, office,


business and others.

In this project, the title is Database of Petshop. Petshop Database is a database about the
management process in Petshop, it contains of some components like Human.Customer,
Human.Employee, Animal.Pet, Produk.Item, Produk.Order, Produk.OrderDetail,
Produk.Layanan and Trans.Payment. The tables relate to each other, for example, member
info with member and so on.
7

ENTITIES

Databases Name : Database of Petshop


Databases Schema : Database of Petshop

Number of Schema : 4
Human
Animal
Trans
Product

Number of Tables :8
1. Human.Customer
2. Human.Employee
3. Animal.Pet
4. Produk.Item
5. Produk.Order
6. Produk.OrderDetail
7. Produk.Layanan
8. Trans.Payment
8

SCHEMATIC DIAGRAM
9

TABLE DESIGN

Table Human.Customer

Field Name Data Type Width Description

CustomerID CHAR 5 ID of the Customer


CustomerName VARCHAR 30 Name of the Customer
CustomerGender VARCHAR 10 Gender of the Customer
CustomerEmail VARCHAR 30 Email of the Customer
Phone Number of the
CustomerPhone VARCHAR 13
Customer
CustomerAddress VARCHAR 100 Address of the Customer

Table Human.Employee

Field Name Data Type Width Description

EmployeeID CHAR 5 ID of the Employee


EmployeeName VARCHAR 50 Name of the Employee
EmployeeGender VARCHAR 10 Gender of the Employee
EmployeePhone VARCHAR 13 Phone of the Employee
EmployeeAddress VARCHAR 100 Address of the Employee
Employee Salary NUMERIC 11,2 Salary of the Employee
Posisition of the
EmployeePosition VARCHAR 20
Employee
10

TABLE DESIGN

Table Animal.Pet
Field Name Data Type Width Description

PetID CHAR 5 ID of the Pet


PetName VARCHAR 100 Name of the Pet
PetGender VARCHAR 10 Gender of the Pet
PetCategory VARCHAR 30 Category of the Pet
PetDescription VARCHAR 100 Descriptiom of the Pet

Table Produk.Item

Field Name Data Type Width Description

ProductID CHAR 5 ID of the Customer

ProductCode VARCHAR 20 Code of the Product

ProductName VARCHAR 30 Name of the Product

ProductDetail VARCHAR 100 Detail of the Product

ProductQuantity INTERGER - Quantity of the Product


11

TABLE DESIGN

Table Produk.Layanan
Field Name Data Type Width Description

LayananID CHAR 5 ID of the Customer


LayananCode VARCHAR 30 Code of the Layanan
LayananName VARCHAR 10 Name of the Layanan
LayananCode VARCHAR 30 Code of the Layanan
LayananFee FLOAT - Fee of the Layanan

Table Produk.Order

Field Name Data Type Width Description

OrderID CHAR 5 ID of the Order


CustomerID VARCHAR 5 ID of the Customer
OrderDate VARCHAR - Date of the Order
OrderPrice NUMERIC 11,2 Price of the Order
OrderQuantity INTEGER - Quantity of the Order
12

TABLE DESIGN

Table Produk.OrderDetail
Field Name Data Type Width Description

OrederDetailID CHAR 5 ID of the Order Detail


OrderID CHAR 5 ID of the Order
ProductID CHAR 5 ID of the Product
LayananID CHAR 5 ID of the Layanan
Quantity INTERGER - Quantity of the OrderDetail
QuantityPrice NUMERIC 11,2 Quantity Price of the OrderDetail

Table Trans.Payment
Field Name Data Type Width Description

PaymentID CHAR 5 ID of the Payment


OrderID CHAR 5 ID of the Order
TotalPrice NUMERIC 11,2 Total Price of the Trand.Payment
Payment Date of the
PaymentDate DATE -
Trans.Payment
PaymentType VARCHAR 8 Payment Type of the Trans
13

VALIDATIONS PERFORMED
Table Animal.Pet

Validation Required Method used for Validation

PetID should be in this format;


Check constraint like statement
[P][I][D][0-9][0-9]

Gender should be in this format;


Check constraint or statement
'Female' or 'Male'

PetID, PetName, PetGender,


NOT NULL clause in the CREATE
PetCategory and PetDescription
TABLE statement
should not be left empty

Table Produk.Item

Validation Required Method used for Validation

ProdukItemID should be in this


format; Check constraint like statement
[P][P][0-9][0-9][0-9]

ProductID, ProductName,
NOT NULL clause in the CREATE
ProductDetail and ProductQuantity
TABLE statement
should not be left empty
14

VALIDATIONS PERFORMED

Table Product.Layanan

Validation Required Method used for Validation

LayananID should be in this


format; Check constraint like statement
[L][I][0-9][0-9][0-9]

LayananID,LayananCode,
NOT NULL clause in the CREATE
LayananName, LayananFeeshould
TABLE statement
not be left empty

Table Product.Detail

Validation Required Method used for Validation

OrderID should be in this format;


Check constraint like statement
[O][I][0-9][0-9][0-9]

LayananID,LayananCode,
NOT NULL clause in the CREATE
LayananName, LayananFeeshould
TABLE statement
not be left empty
15

VALIDATIONS PERFORMED

Table Produk.OrderDetail

Validation Required Method used for Validation


OrderDetailID should be in this
format; Check constraint like statement
[O][I][0-9][0-9][0-9]

CustomerIDshould be in this
format; References for Foreign Key
[C][I][0-9][0-9][0-9]

OrderID, CustomerID,
OrderDate, OrderQuantity and NOT NULL clause in the CREATE
OrderPrice should not be left TABLE statement
empty

Table Trans.Payment

Validation Required Method used for Validation


PaymentID, should be in this
format; Check constraint like statement
[P][I][0-9][0-9][0-9]

OrderID be in this format;


[O][I][0-9][0-9][0-9] References for Foreign Key

TotalPrice, PaymentType and


NOT NULL clause in the CREATE
PaymentData should not be left
TABLE statement
empty
16

VALIDATIONS PERFORMED

Table Human.Customer

Validation Required Method used for Validation

CustomerID should be in this format;


Check constraint like statement
[C][I][0-9][0-9][0-9]

CustomerGender should be in this


format; Check constraint or statement
'Female' or 'Male'

CustomerName,
CustomerEmailAddress, NOT NULL clause in the CREATE
CustomerNumber, CustomerAddress TABLE statement
should not be left empty

Table Human.Employee
Validation Required Method used for Validation
EmployeeID should be in this
format; Check constraint like statement
'[E][D][0-9][0-9][0-9]'

EmployeeGender should be in
this format; Check constraint or statement
'Female' or 'Male'

EmployeeName,
EmployeePhone,
EmployeeAddress, NOT NULL clause in the CREATE
EmployeeSalary and TABLE statement
EmployeePosisition should not
be left empty
17

PROCEDURE

Create PROCEDURE Updt.Produk.Item


@ProductID Char(5),
@ProductCode Varchar(20),
@ProductName varchar(30),
@ProductDetail varchar(100),
@ProductQuantity INTEGER
AS
BEGIN
UPDATE Produk.Item SET
ProductID=@ProductID,
ProductCode=@ProductCode,
ProductName=@ProductName,
ProductDetail=@ProductDetail,
ProductQuantity=@ProductQuantity
WHERE ProductID=@ProductID
END

GO

EXEC UpdtProduk.Item @ProductID= 'PP001',


@ProductCode= 'PL001',
@ProductName= 'Pet Litter',
@ProductDetail= 'Litter for Pet',
@ProductQuantity='100'
18

TRIGGER

create trigger trg_stok on Produk.OrderDetail


after insert
as
begin
declare @qty int
declare @idp char(5)
select @idp = ProductID, @qty = Quantity from
Produk.OrderDetail
if (@qty > 0)
begin
update Produk.Item set ProductQuantity =
ProductQuantity - @qty FROM Product.OrderDetail ord
join Product.Item mn on ord.ProductID =
mn.ProductID where mn.ProductID = @idp
end
END
19

ERD
20

CONFIGURATION

Hardware : Laptop, Acer nitro 5 an515-57 and Asus ROG


Operating System : Windows 11 Home
Software : Microsoft Word, Microsoft SQL Server Management Studio
21

You might also like