Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

P.1 Design A Relational Database System Using Appropriate Design Tools and Techniques, Containing at Least Four Interrelated

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 30

Contents

P.1 Design a relational database system using appropriate design tools and techniques, containing at least four interrelated
tables, with clear statements of user and system requirements.

P2 Develop the database system with evidence of user interface, output and data validations, and querying across multiple
tables.

P3 Implement a query language into the relational database system.

P4 Test the system against user and system requirements.

P5 Produce technical and user documentation.

1. Introduction:

2. Clear statements of user and system requirements:

3. Design of the relational database system using appropriate design tools and techniques:

1|Page
P.1 Design a relational database system using appropriate design tools and techniques, containing at least four interrelated
tables, with clear statements of user and system requirements.

1. Introduction:

- Before going into my database introduction, I will say a few things that I know about the database.

1.1 What is the database?

A database is an organized collection of data, generally stored and accessed electronically from a computer system. Where
databases are more complex they are often developed using formal design and modeling techniques.

1.2 Types of database:

There are 3 types of databases

1.2.1 Flat File Databases

A flat-file database is a database stored in a file called a flat file. Records follow a uniform format, and there are no structures
for indexing or recognizing relationships between records. The file is simple. A flat file can be a plain text file, or a binary file.
Relationships can be inferred from the data in the database, but the database format itself does not make those relationships
explicit.

2|Page
1.2.2Hierarchical Databases

A hierarchical database model is a data model in which the data are organized into a tree-like structure. The data are stored as
records which are connected to one another through links. A record is a collection of fields, with each field containing only one
value. The type of a record defines which fields the record contains.

3|Page
1.2.3 Relational Databases

A relational database is a digital database based on the relational model of data, as proposed by E. F. Codd in 1970. A software
system used to maintain relational databases is a relational database management system (RDBMS). Many relational database
systems have an option of using the SQL (Structured Query Language) for querying and maintaining the database.

- In relational model, data is organized into tables

Even the info about the tables is stored in tables

- Relationship among tables

4|Page
Defined by repeating column(s) from one in another table

These repeating columns are called “keys”

- This solved many problems

One of those is data redundancy

- Keys?

In RDBs, each table usually has one (or more) column(s) designated as a primary key

A key uniquely identifies each row in a table

Giving one of its values, you can find exactly one row in the table

This key becomes a foreign key when it is repeated in another table

5|Page
To create relationship between the tables

6|Page
7|Page
1.2 Database Management System (DBMS)

The database management system (DBMS) is the software that interacts with end users, applications, and the database itself to
capture and analyze the data. The DBMS software additionally encompasses the core facilities provided to administer the
database. The sum total of the database, the DBMS and the associated applications can be referred to as a "database system".
Often the term "database" is also used to loosely refer to any of the DBMS, the database system or an application associated
with the database.

1.4 Database management system

8|Page
There are many database management systems such as Oracle, MySQL, Microsoft SQL Server, PostgreSQL ... But in my opinion
MySQL is the most widely used management system, because Microsoft SQL Server is always a name present. in the list of the
most popular database management system rankings. Developed since 1989, using Assembly C language, Linux, C ++, this is a
commercial DBMS that many people love and choose to use by its utilities.

→ Some basic features:

Works on Windows and Linux operating systems.

Compatible with Oracle.

Supply, effectively manage the volume of work.

Allow multiple users to use the same database.

2. Clear statements of user and system requirements:

For convenience stores, cooffe shops, milk tea shops, or companies, the salary issue is still a big problem for them, they will
calculate the pay and will pay later than 5 to 7. day in that month, so I was thinking of a database system to help with this

- There will be quite a lot of employees in the store or company and including their name, age and hometown
- There will be quite a lot of branch stores or companies so the assignment of employees to where to work is by their
managers.
- Customer is god.
- For product will have product name, product code.
- Sales will be reported to the manager when the employee shifts to each other, including where they work.
- And finally, the salary, wages will be calculated according to sales and commissions of that employee

3. Design of the relational database system using appropriate design tools and techniques:
To manage employees, number of loyal customers, and salary, we designed a database called Salary System. The database
includes 6 new tables of relationships as follows:
Staff (Staff name nvarchar (30), Num at int, age int, home town nvarchar (MAX))
9|Page
Revenue (Work place nvarchar (50), Staff name nvarchar (30), Target int)
Assigned (Num at int, Work nvarchar (50), Work place nvarchar (50))
Customer (Staff name nvarchar (30), Customer nvarchar (30), Product ID int, Money bonus money)
Product (ID Product int, Product nvarchar (50))
Salary (Num at int, Target int, Salary money, Money bonus money)
So I explained to everyone the better understanding of my company's Salary System and this is my diagram

10 | P a g e
P2 Develop the database system with evidence of user interface, output and data validations, and querying across
multiple tables.

1. Create databases and test them.


11 | P a g e
 So I analyzed to show everyone what my Salary system had and now I will create them using an SQL program called SQL Server
Managements Studio (SSMS)

1.1 Create databases

Database of SALARY SYSTEM created

1.2. The tables of Salary.

12 | P a g e
Assigned table

Customer table

Product table
13 | P a g e
Revenue table

Salary table

Staff table
14 | P a g e
1.3. Value for each table

Assigned table values

Customer table values

Product table values

15 | P a g e
Revenue table values

Salary table values

Staff table values

16 | P a g e
2. Check if the results work
 Now I will call up a few tables with the command to see what its output looks like.

select * from Customer


3. Salary database with 6 tables can be queried on multiple tables using T-SQL.

 Now I will query some tables to see if they can connect to each other:

Query 1: The first question is if I will check to see if the workplace matches the employee's hometown.

17 | P a g e
P3 Implement a query language into the relational database system.

1. Database is run by code:

 So I have shown everyone about my table design and now I will show people how I create those tables using lines in SSMS.

Create table Staff ([Staff name] nvarchar (30) primary key not null, [Num at] int, age int, [home
town] nvarchar (MAX) not null);
Create table Revenue ([Work place] nvarchar (50) primary key not null, [Staff name] nvarchar (30)
not null, [Target] int);
Create table Assigned ([Num at] int primary key, [Work] nvarchar (50) not null, [Work place]
nvarchar (50) not null);
Create table Customer ([Staff name] nvarchar (30) primary key not null, Customer nvarchar (30) not
null, [ID Product] int, [Money bonus] money);
Create table Product ([ID Product] int primary key, Product nvarchar (50));
Create table Salary ([Num at] int primary key, [Target] int, [Salary] money, [Money bonus] money);

 And those lines of code to create tables like the ones we've seen above now add value.

2. Add values to the table:

 Here's what I did to add value to the table.

use [SALARY SYSTEM]


insert into Staff values
('Long Kim Tran',1,'TP. Ho Chi Minh',20),
('Phuc Trinh Ngoc',2,'Dong Nai',20),
('Nghia Tran',3,'TP. Ho Chi Minh',19),
('Tuan Nguyen',4,'London',22),
('Hieu Le',5,'Phan Thiet',22);
insert into Salary values
(1,500000,6000000,500000),
(2,200000,6000000,500000),
(3,400000,6000000,500000),
18 | P a g e
(4,500000,6000000,500000),
(5,500000,6000000,500000);
insert into Revenue values
('102 Nguyen Xi','Long Kim Tran',500000),
('52 Ly Tu Trong','Phuc Trinh Ngoc',200000),
('624 Le Hong Phong','Nghia Tran',400000),
('2 Hai Ba Trung','Tuan Nguyen',500000),
('502 Duong Quang Ham','Hieu Le',500000);
insert into Product values
(1811,'Apple pen'),
(0805,'Pineapple pen'),
(2510,'Three chicken'),
(1706,'Mixi food');
insert into Customer values
('Long Kim Tran','Anh Duy',0805,500000),
('Phuc Trinh Ngoc','Bill Noy',2510,200000),
('Tuan Nguyen','Miu Miu',1706,500000),
('Nghia Tran','Teacher Three',2510,400000),
('Hieu Le','Duc Anh',1811,500000);
insert into Assigned values
(1,'Saler','102 Nguyen Xi'),
(2,'Cashier','52 Ly Tu Trong'),
(3,'Saler','624 Le Hong Phong'),
(4,'Shipper','2 Hai Ba Trung'),
(5,'Cashier','502 Duong Quang Ham');

P4 Test the system against user and system requirements.

 Now I will check the requests that the user originally requested.

1. The system of employees in the store and the company has quite a lot of employees, which will have the employee's name,
age and hometown.

19 | P a g e
select * from Customer

2. The assignment of the employees to the place is because each employee can work together or individually depending on the
arrangement of the company so what job and where will it work?

20 | P a g e
select S.[Num at],A.[Work],A.[Work place]
from Staff S join Assigned A
on S.[Num at]=A.[Num at];
3. For the product, it must have the code and name of the product to be sold to customers.

21 | P a g e
select C.[ID Product], P.[Product]
from Customer C join Product P
on C.[ID Product]=P.[ID Product];

4. Customers are the company's top priority so customers must purchase the product code and bonus for employees.

22 | P a g e
use [SALARY SYSTEM]

23 | P a g e
select C.[Customer], S.[Staff name], M.[Money bonus], P.[Product]
from Customer C join Staff S
on S.[Staff name]=C.[Staff name]
join Salary M
on M.[Money bonus]=C.[Money bonus]
join Product P
on C.[ID Product]=P.[ID Product];

5. Sales will be reported when employees are given their jobs including where they work and that revenue target.

use [SALARY SYSTEM]


select S.[Staff name], T.[Target], Wl.[Work place]
from Revenue T join Staff S
on S.[Staff name]=T.[Staff name]
join Assigned Wl
on Wl.[Work place]=T.[Work place];

24 | P a g e
6. And finally, the salary will be distributed when the revenue is reported and the salary will be calculated based on the
employee's goals and bonuses.

use [SALARY SYSTEM]


select C.[Money bonus],S.[Num at],R.[Target],Sa.[Salary]
from Salary Sa join Staff S
25 | P a g e
on S.[Num at]=Sa.[Num at]
join Revenue R
on R.[Target]=Sa.[Target]
join Customer C
on C.[Money bonus]=Sa.[Money bonus];

P5 Produce technical and user documentation.

 Under the conditions above there are things that need to be stored and recorded.

1. Database structure:

 The structure of an interface that makes databases based on the language that it is programmed as my code.

Create table Staff ([Staff name] nvarchar (30) primary key not null, [Num at] int, age int, [home
town] nvarchar (MAX) not null);
Create table Revenue ([Work place] nvarchar (50) primary key not null, [Staff name] nvarchar (30)
not null, [Target] int);
Create table Assigned ([Num at] int primary key, [Work] nvarchar (50) not null, [Work place]
nvarchar (50) not null);
Create table Customer ([Staff name] nvarchar (30) primary key not null, Customer nvarchar (30) not
null, [ID Product] int, [Money bonus] money);
Create table Product ([ID Product] int primary key, Product nvarchar (50));
Create table Salary ([Num at] int primary key, [Target] int, [Salary] money, [Money bonus] money);

2. Database development process.

 The database development process all depends on the values you add inside it, just like the values I added inside of a table.

use [SALARY SYSTEM]


insert into Staff values
('Long Kim Tran',1,'TP. Ho Chi Minh',20),
('Phuc Trinh Ngoc',2,'Dong Nai',20),
('Nghia Tran',3,'TP. Ho Chi Minh',19),
26 | P a g e
('Tuan Nguyen',4,'London',22),
('Hieu Le',5,'Phan Thiet',22);
insert into Salary values
(1,500000,6000000,500000),
(2,200000,6000000,500000),
(3,400000,6000000,500000),
(4,500000,6000000,500000),
(5,500000,6000000,500000);
insert into Revenue values
('102 Nguyen Xi','Long Kim Tran',500000),
('52 Ly Tu Trong','Phuc Trinh Ngoc',200000),
('624 Le Hong Phong','Nghia Tran',400000),
('2 Hai Ba Trung','Tuan Nguyen',500000),
('502 Duong Quang Ham','Hieu Le',500000);
insert into Product values
(1811,'Apple pen'),
(0805,'Pineapple pen'),
(2510,'Three chicken'),
(1706,'Mixi food');
insert into Customer values
('Long Kim Tran','Anh Duy',0805,500000),
('Phuc Trinh Ngoc','Bill Noy',2510,200000),
('Tuan Nguyen','Miu Miu',1706,500000),
('Nghia Tran','Teacher Three',2510,400000),
('Hieu Le','Duc Anh',1811,500000);
insert into Assigned values
(1,'Saler','102 Nguyen Xi'),
(2,'Cashier','52 Ly Tu Trong'),
(3,'Saler','624 Le Hong Phong'),
(4,'Shipper','2 Hai Ba Trung'),
(5,'Cashier','502 Duong Quang Ham');

27 | P a g e
References:

Resource, B. and Resource, B., 2020. Kiến Thức, Kinh Nghiệm, Tài Liệu Quản Trị Doanh Nghiệp Cho Kỷ Nguyên Số - 10000+ Subscribers - Base
Resources. [online] Resources.base.vn. Available at: <https://resources.base.vn/hr/cach-trien-khai-he-thong-luong-3p-cach-
tinhluongcho-nhan-vien-chinh-xac-nhat-358> [Accessed 11 March 2020].

Symplefy. 2020. 10 Mô Hình Quản Lý Nhân Sự Hiệu Quả Nhất Hiện Nay | Symplefy. [online] Available at:
<https://www.symplefy.com/vi/mo-hinh-quan-ly-nhan-su-hieu-qua/> [Accessed 11 March 2020].

Bravo.com.vn. 2020. Các Mô Hình Quản Lý Nhân Sự Trong Doanh Nghiệp Cơ Bản Nhất Hiện Nay. [online] Available at:
<https://www.bravo.com.vn/vi/Tin-tuc/Quan-tri-doanh-nghiep/Cac-mo-hinh-quan-ly-nhan-su-trong-doanh-nghiep-co-ban-nhat-hien-
nay> [Accessed 11 March 2020].

Phần mềm Quản lý Doanh nghiệp & Cộng tác trực tuyến thời gian thực mọi lúc, mọi nơi. 2020. Mô Hình Quản Lý Nhân Sự Nào Phổ Biến
Hiện Nay? - Phần Mềm Quản Lý Doanh Nghiệp & Cộng Tác Trực Tuyến Thời Gian Thực Mọi Lúc, Mọi Nơi. [online] Available at:
<https://www.ihcm.vn/tin-tuc/tin-tuc/quan-tri-doanh-nghiep/1397-mo-hinh-quan-ly-nhan-su-nao-pho-bien-hien-nay.html> [Accessed 11
March 2020].

Doanh Nhân Sài Gòn Online. 2020. 2 Mô Hình Quản Lý Nhân Sự Phổ Biến. [online] Available at: <https://doanhnhansaigon.vn/goc-nha-
quan-tri/2-mo-hinh-quan-ly-nhan-su-pho-bien-1062875.html> [Accessed 11 March 2020].

Eduviet. 2020. Các Mô Hình Quản Lý Nhân Lực - Eduviet. [online] Available at: <http://eduviet.vn/tin-tuc/cac-mo-hinh-quan-ly-nhan-
luc.html> [Accessed 11 March 2020].

Viện Kế toán và Quản trị Doanh nghiệp. 2020. [online] Available at: <https://iabm.edu.vn/ba-mo-hinh-quan-tri-nhan-su-thanh-cong-ma-
cac-nha-quan-ly-can-tham-khao.html> [Accessed 11 March 2020].

2020. [online] Available at: <https://www.thuatngumarketing.com/database-management-system-viet-tat-dbms/> [Accessed 11 March


2020].

 2020. [online] Available at: <http://www.d

28 | P a g e
Referent
 Dịch vụ hosting | Thuê máy chủ ảo VPS | Đăng ký tên miền giá rẻ. (2020). Cơ sở dữ liệu database là gì? có những loại database nào?. [online]
Available at: https://hostingviet.vn/co-so-du-lieu-database-la-gi [Accessed 7 Mar. 2020].

VietTuts. (2020). RDBMS là gì? - học sql cơ bản đến nâng cao - VietTuts. [online] Available at: https://viettuts.vn/sql/rdbms-la-gi [Accessed 3
Mar. 2020].

Vi.wikipedia.org. (2020). PostgreSQL. [online] Available at: https://vi.wikipedia.org/wiki/PostgreSQL?fbclid=IwAR36qJrtF9wXR63myb2m4-


TrmXq5YHrHjKU3wFL0ZP2P5o3lXTEhyBS2kQ0 [Accessed 3 Mar. 2020].

Vn.wacontre.com. (2020). Ưu điểm nổi bật được mọi người sử dụng cơ sở dữ liệu Oracle là gì? | Tạo app Wacontre. [online] Available at:
https://vn.wacontre.com/vi/uu-diem-noi-bat-duoc-moi-nguoi-su-dung-co-so-du-lieu-oracle-la-gi-2/?fbclid=IwAR0WWKqYwgp6UDKOIXjTHi-
4ABW7A0eX7VqBU16vnAKNWWqjrLK7VTTTR1Q [Accessed 3 Mar. 2020].

Thư viện khoa học. (2020). Database là gì? Các loại database phổ biến - Thư viện khoa học. [online] Available at:
https://thuvienkhoahoc.net/database-la-gi-cac-loai-database-pho-bien.html [Accessed 7 Mar. 2020].

29 | P a g e
Blog TINOGROUP JSC. (2020). Database là gì ? Vai trò và tầm quan trọng của database. [online] Available at:
https://blog.tinohost.com/database-la-gi/ [Accessed 7 Mar. 2020].

Anon, (2020). [online] Available at: https://contentscrawl.com/get-help-in-database-management-assignment/ [Accessed 7 Mar. 2020].

Techopedia.com. (2020). What is a Database Management System (DBMS)? - Definition from Techopedia. [online] Available at:
https://www.techopedia.com/definition/24361/database-management-systems-dbms [Accessed 7 Mar. 2020].

SearchDataManagement. (2020). What is a Relational Database? - Definition from WhatIs.com.. [online] Available at:
https://searchdatamanagement.techtarget.com/definition/relational-database [Accessed 7 Mar. 2020].

En.wikipedia.org. (2020). Hierarchical database model. [online] Available at: https://en.wikipedia.org/wiki/Hierarchical_database_model


[Accessed 7 Mar. 2020].

Techterms.com. (2020). Flat File Definition. [online] Available at: https://techterms.com/definition/flatfile [Accessed 7 Mar. 2020].

30 | P a g e

You might also like