MEMBERS’ CONTRIBUTION No | Student Student ID Work Contribution Note name Code | Report | Slide (50%) | (30%) | (20%)
1 Truong | Case research, gather real 30 40 30
Trong | information for the Database, Sang | Convert ERD into relational
schema, Proofread and edit the report, Design some useful
reports and information for real usage
2 Đã Case research, gather real 30 40 30
Trung | information for the Database, Ding | Insert Data into SQL script,
Proofread and edit the report, Design some useful reports and information for real usage
3 Nguyễn Case research, gather real 60 30 10
A Chau | information for the Database, Give out solutions for the useful reports and information for real
usage, Proofread and edit the
report
4 | Neuyén | Case research, gather real 60 30 10 | Leader
Xuân | information for the Database,
Thé Design ERD, Write ERD report,
build physical database base on relational schema and real data, including writing the SQL seript and insert some data, Conclude the project
Trang 3
Table of Notations and Abbreviations
Trang 5CONTENTS Chapter 1: INTRODUCTION 6 1 About the Organization 6 2 Requirement Specification 6 2.1 Methods for investigating business rules: 6 i Interview 6 ii Reading news/websites 7 iii, Observation 7 3 Business Narrative 8 Chapter 2: ANALYZING AND DESIGNING THE DATABASE 8 1 ERD 8 2 Relational Schema 8
3 Some real data and SOL scripts 10
Chapter 3: SOME USEFUL REPORTS AND INFORMATION 1]
1 Design some useful reports and information for real usage II
2 Solutions for the above reports/information II
Trang 6Chapter 1: INTRODUCTION 1 About the Organization
Truong Ha fashion shop was first introduced and open for business 2 years ago, most of the store’s products include clothing and sometimes jewelry, but the jewelry business of the shop was not a success so there will be no data whatsoever included in the system The operation of the store is rather simple, the manager buys items from a trustworthy wholesale partner in China and then puts a tracking and authentication tag for after service and to prove that item is a high-quality item from our store afterward, the items will be sold to the customer in Vietnam’s region The business also includes collaboration with a certain shipping company
2 Requirement Specification
2.1 Methods for investigating business rules:
It was not hard to figure out the database system of the shop since the owner was a very good friend of mine and our team had 3 types of investigation made to clarify the data which afterward used by us to build up parts of this final examination
i —s Interview
We spent 2 hours every day for a whole week to interview the owner of the shop, we asked about where the source of her products was, how was that product made, if it was good to use and if it was from trustworthy and high-quality factures and suppliers
ii Researching the websites
After investigating all about the origin and how the items were made, me conducted research on the shop’s Facebook page ad website to find out the way they handle their business with customer, or to be exact, how did they sell their items and if the customer come to the shop directly to buy the items or they buy them online and have them delivered to their house
Trang 7inspect their shipping collaboration more carefully and put it in our database
iii, Observation
After looking at the store’s online platforms and its shipping companions, we wanted to inspect further in the flow of the items, would there be any other trading activities of goods after it was bought used by the customer or not In this investigation, we found out the shop supported its clients to buy and trade theirs good after buying it by establishing a trading and reselling the store’s goods community a website and there is no shipping collaboration seen in this part, the customer can offer and deal and trade freely with the website playing the role of a midman to verify the authenticity of the product
3 Business Narrative
Trang 8Chapter 2: ANALYZING AND DESIGNING THE DATABASE
ERD
To draw an ERD, we must first find out all the strong entities and theirs attributes, firstly the strong entities can be observed are MANUFACTURER have attribute name and address, SUPPLIERS have attribute number and phone number, ITEMS have attribute code and origin, SHIPPING COMPANY have attribute shipping code and delivery code, CUSTOMERS have attribute name, address and phone number and finally 2ND CUSTOMERS have attribute name, address and phone number For the part of relationships between them, MANUFACTURER to SUPPLIERS will be one must to maybe many since there must be manufacturer as the source and that source may sell to many suppliers and for the rest of the strong entities, the relationships between them all are many maybe to many maybe since many suppliers provide many items and those items may be shipped to many customers by many shipping company such as GHTK or Be or Extra Shipping and so on and many customers can also trade to many second customers
Trang 9Relational Schema -Firstly, we will list, select the filter information that must be given -Next, we define the files and relationships between the implementation collectives
-For example, in my ERD, we have:
Trang 10From SUPPLIERS we can add more unimportant entity is weak entity - SHOP One SUPPLIERS and One ITEMS can have a lot of SHOP
From ITEMS we can add more unimportant entities that are weak entities - DELIVER One ITEMS may have a lot of DELIVER One SHIPPER may have a lot of DELIVER From SHIPPER we can add more unimportant entity is weak entity - SHIPPING COMPANY One SHIPPER may have a lot of SHIPPING COMPANY One CUSTOMER may have a lot of SHIPPING COMPANY From CUSTOMER we can add more unimportant entity is weak entity - RESELLER One CUSTOMER may have a lot of TRADING 2NDCUSTOMER may have a lot of TRADING -The next step is to define attributes like primary key, foreign key and bind the attribute for the file and relationship -For example, in my ERD, we have: Primary key: Primary Key (Manufacturer_Name) Primary Key (Supplier_Number) Primary Key (Item_Code) Primary Key (Shipping Code) Primary Key (Customer_Name) Primary Key (Second_Customer_Name)
Forgein key:
Trang 11Foreign Key (Supplier_Number) references SUPPLIERS Foreign Key (Shipping Code) references
SHIPPING_COMPANY Foreign Key (Customer_Name) references CUSTOMER
Foreign Key (Second_Customer_Name) references SECOND_CUSTOMER Finally, draw an ERD diagram that identifies the type associations of the jobs performed in the schema
Trang 12
INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT
INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO
TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING TRADING INSERT INTO SECOND_CUSTOMER VALUES
INSERT INTO SECOND_CUSTOMER VALUES INSERT INTO SECOND_CUSTOMER VALUES
INSERT INTO SECOND_CUSTOMER VALUES
INSERT INTO SECOND_CUSTOMER VALUES INSERT INTO SECOND_CUSTOMER VALUES (' INSERT INTO SECOND_CUSTOMER VALUES INSERT INTO SECOND_CUSTOMER VALUES INSERT INTO SECOND_CUSTOMER VALUES INSERT INTO SECOND_CUSTOMER VALUES INSERT INTO SECOND_CUSTOMER VALUES
VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES
'Lê Thị Hiền ",
‘Truong Binh Uyên Diễm ', '186 Phan Rang, Ninh Thuan', Ø1688887788) ;
(259876, 'Nguyễn Nguyên Hồng', ‘anh long’); (3248930, ‘Ta Ai Nhi', ‘anh hai‘);
(204893, ‘Mach Qué Linh’, ‘anh thai‘); (1567823, ‘Trinh Đông Tuyền', *anh hoàng");
(122234, ‘Nguyén Anh Lé', ‘anh hiéu');
(235867, ‘Tram Thu Hường', ‘anh difc’); (587903, ‘Pham Xuan Léc' , 'anh mạnh");
(740009, 'Hồ Thế Vinh', 'anh lợi'); (988606, 'Nguyễn Cơng Hốn', 'anh cường'); (690000, 'Nguyễn Nhật Huy', 'chị hoa');
(780000, 'Quang Đức Khải', 'chị hải'); (457712, ‘Luc Xuan Bình', 'chị hẳng'); (655422, ‘Van Ngọc Khôi', ‘chi huyền"); (984453, 'Phạm Minh Khang’, ‘chi hạnh"); (365824, ‘Dinh Van Hién', ‘chi linh');
(3652887, ‘VG Thi Diém My ', ‘chi lan’); (1236056, 'Lê Thị Miền ', 'chị hòa');
(985314, 'Trương Bình Uyên Diễm ', 'chị lương');
(628021, ‘Bach Thién Hạnh', 'chị liên"); (655154, 'Lê Ngọc Sơn ', ‘chi nhàn");
liguyễn Nguyên Höng', '123 Binh Thang village', 923654728);
'Tạ Ái Nhỉ', '671 Pho Hoang Hoa Tham', 6437616458);
Mach Qué Linh', ‘Thanh Ba Townlet’, 0973885335);
Trịnh Đông Tuyền", “1 Nguyen Chỉ Thanh Street", 9932658741); Hguyễn Ánh Lệ', '182/2/6 Nguyen Huu Canh S†', 8956478521); ‘Tram Thu Hudng', ‘46 Bich Cau, Quoc Tu Giam Ward’, @956326581) ;
Pham Xuan L6éc', ‘Quarter 4, Binh Hung Hoa Ward’, 0962357841);
Hồ Thế Vinh', ‘ Be Van Dan Street’, 0956215877);
Iguyễn Công Hodn’, “123 Hoang Van Thu Street’, 9932664588); Nguyễn Nhật Huy’, ‘Binh Thanh Dist, Ho Chi Minh’, 8326547892); "Quang Đức Khải', ‘51B Tran Hung Dao Street’, @932587413):
Luc Kuan Binh’, ‘58 Nguyen Tri Phuong St‘, 0955662378); Pham Minh Khang’, ‘16 Ho Ba Kien street’, 0965632584) ; Dinh Van Hién', 'Thi Xa Ha Tien,Tinh Kien Giang’, 9903720805) ; Võ Thị Diễm My ', ‘Xa Thong Nhat, Huyen Krongbuk, Dac Lac’, 9913748604);
*D1/2 Lac Long Quan, P.19, Q.TB', 0912243263);
Trang 13INSERT INTO SHIPPING_COMPANY VALUES (1, “Extra Shipping’); INSERT INTO SHIPPING_COMPANY VALUES (2, ‘Shopee Ship’); INSERT INTO SHIPPING_COMPANY VALUES (3, ‘GHTK'); INSERT INTO SHIPPING COMPANY VALUES (4, ‘Be'); INSERT INTO SHIPPING_COMPANY VALUES (5, 'Grab'); INSERT INTO SHIPPING_COMPANY VALUES (6, ‘Aha Ship’); INSERT INTO SHIPPING_COMPANY VALUES (7, ‘Alo Ship’); INSERT INTO SHIPPING_COMPANY VALUES (8, 'Shipping'); INSERT INTO SHIPPING_COMPANY VALUES (9, ‘Long Luong Ship’); INSERT INTO SHIPPING_COMPANY VALUES (19, ‘SSS Ship’); INSERT INTO SHIPPING_COMPANY VALUES (11, ‘Aladin Ship’); INSERT INTO SHIPPING_COMPANY VALUES (12, ‘Express Ship’); INSERT INTO SHIPPING_COMPANY VALUES (13, ‘ADC Ship’); INSERT INTO SHIPPING_COMPANY VALUES (14, ‘CherryLove Ship’); INSERT INTO SHIPPING _COMPANY VALUES (15, ‘GDC');
INSERT INTO SHIPPING_COMPANY VALUES (16, ‘TombowArt'); INSERT INTO SHIPPING_COMPANY VALUES (17, ‘FlowerKnows'); INSERT INTO SHIPPING_COMPANY VALUES (18, '*RtopR'); INSERT INTO SHIPPING_COMPANY VALUES (19, ‘Marvy'); INSERT INTO SHIPPING_COMPANY VALUES (28, ‘Holicshipping');
Trang 14Chapter 3: SOME USEFUL REPORTS AND INFORMATION
Design some useful reports and information for real usage: #1 Show item list and quantity of each item #2 Show item name by item code using VIEW
#3 Sort the result-set in ascending or descending order follow price #4 Check item has price more than 100000
#5 Show item name by item code using VIEW #6 What do you do when you update the wrong name of SHIPPING_COMPANY in your inventory? Make a example #7 Find out which supplier provided what item
#8 Count the number of shippers of each company
#9 Update the name of SHIPPING_COMPANY and commit to the database (can't rollback)
#10 Creates a stored procedure named "SelectAllSuplliers” that selects all records from the "SUPLIERS" table
Solutions for the above reports/information #1
SELECT Item_Name, COUNT(Item_Name) AS "So luong" FROM ITEMS GROUP BY Item_Name; #2 CREATE VIEW [View] AS SELECT * FROM ITEMS #3
SELECT * FROM TRADING
ORDER BY Price ASC;
SELECT * FROM TRADING ORDER BY Price DESC; #4
SELECT * FROM TRADING
Trang 15#5 CREATE VIEW [View_ITEM] AS SELECT Item_Name FROM ITEMS WHERE Item_Code = 01; SELECT * FROM [View_ITEM]; #6
begin tran
UPDATE SHIPPING _COMPANY
SET Shipping_Code = 1, Company_Name= 'Lazada' WHERE Shipping _Code= 1; ROLLBACK tran SELECT *from SHIPPING COMPANY; #7 select s.supplier_name, i.item_name from suppliers s inner join shop sl on s.supplier_number = sl.supplier_number inner join items i
on sl.item_code = i.item_code; #8
select s.shipping_code, count(*) from shipper s inner join shipping_company c
on s.shipping_code = c.shipping_code group by s.shipping_code;
#9 begin tran UPDATE SHIPPING_COMPANY SET Shipping Code = 1, Company_Name= 'Extra Shipping WHERE Shipping _Code= 1; + COMMIT tran
ROLLBACK tran can't use
SELECT *from SHIPPING_COMPANY; #10
Trang 16AS SELECT * FROM SUPPLIERS EXEC SelectAllSuplliers; Chapter 4: CONCLUSION To conclude the project, I hereby summarize some of the plus pomts and also the downsides of the database built by our group as follows: 1 Advantages of the project to the business: + +
The database provides the business a clearer view of what they are doing and how many partners they are working with
The database provides a much more scientific way of managing the amount of items and which item is available
The database provides a clearer view of the flow of product - from the store to its customer then to the second customer
ERD provides the business a better view of relations between all of the subjects
The database provides a better way to audit the shop’s data compared to pens and papers
2 The downside of the database can be observed as follows:
+ There are not many types of data that can be inserted in for example there is no option of entering price of the shop’s items, there is no option for checking the time when item arrived at the shipping company and so