You are on page 1of 28

PROGRAM TITLE: BTEC-COMPUTING

UNIT TITLE: Database Design & Development

ASSIGNMENT NUMBER: 1

ASSIGNMENT NAME: ASSIGNMENT-AGC

SUBMISSION DATE: 01/09/2021

DATE RECEIVED: 08/09/2021

TUTORIAL LECTURER: LUONG THI THAO HIEU

WORD COUNT: 3548

STUDENT NAME: DO TRAN TRONG HIEU

STUDENT ID: BKC18368

MOBILE NUMBER: 0336810146


Summative Feedback:

Internal verification:
Contents
INTRODUCTION........................................................................................................................................4
P1. 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..........................4
I. Data and database definition...........................................................................................................4
1.1. Flat file databases......................................................................................................................4
1.2. Hierarchical Databases..............................................................................................................5
1.3. Relational Databases.................................................................................................................5
2. Database Management System...................................................................................................6
2.1. Common Databases Management Systems...............................................................................9
P2. Develop the database system with evidence of user interface, output and data validations, and
querying across multiple tables..............................................................................................................12
II. SYSTEM REQUIREMENTS................................................................................................................12
1. Data requirements for storage...................................................................................................12
2. Data requirements for storage...................................................................................................12
3. Relationship between entities....................................................................................................15
III. DATABASE DESIGN......................................................................................................................16
1. Entity relationship diagram (ERD)...............................................................................................16
2. Convert ERD Diagram to Relational Schema...............................................................................17
3. Normalization.............................................................................................................................18
4. Relational database system........................................................................................................18
IV. REFERENCES................................................................................................................................28
INTRODUCTION

This is about the database management system. In here we have to create a database in a
proper way for the company called “AGC Company”. And it is a private firm in Vietnam. So in
this assignment, first we discussed the data models and their benefits and disadvantages.
Then explain about different types of technologies useful for the databases. After that, we
have identified the attributes, entities, cardinalities, and all, with the scenario and draw ER
Diagram for the company.

We created this database using SQL Server Management Studio use for creating management
reports for the company. We already added relational schema. And also we added a User
manual for how to use the database, the testing part is already done. In the final task, we
discussed how to verification and validation address to the database and some details about
access rights for the users.

P1. 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.

I. Data and database definition


In computing, data is information that has been converted into digital form, which make it
more efficient for processing or storing in a computer. Data requires interpretation before
being transformed into specific forms of information, such as text documents, images, audio
clips, software programs or other types of data.
A database is a collection of relevant data that is organized for the purpose of making it
more easily to be accessed, manipulated and updated. In other words, database is a data
structure that allows organizations to store, obtain and control information more efficiently.
There are different main types of databases:

1.1. Flat file databases

This is the simplest form with almost no protection for data integrity and security and
often contain redundancy.
1.2. Hierarchical Databases

Organized in tree-like structures, have same problems of redundancy, data integrity,


and comparability of data.

1.3. Relational Databases

Data is organized in tables that are related to each other. Each table has one or more
columns assigned as primary key.
1.4. Others

Object-oriented, Distributed, Network, etc.

2. Database Management System


Managing a huge database is an extremely complicated and arduous task. In order to deal
with this troublesome job, people came up with a technology solution called Database
Management System (DBMS). Basically, DBMS is a program or a collection of programs that is
designed to optimize, manipulate and manage the store and retrieval of data in database in a
systematic way. A DBMS allows end users to create, read, delete and update data. Users can
interact with databases to manipulate the data itself, the data format, file structure, etc. via
an interface provided by a DBMS.

The actual manipulation will be handled by the DBMS.

A Database Management System (DBMS) is software designed to store, retrieve, define, and
manage data in a database.

What is DBMS?
DBMS software primarily functions as an interface between the end user and the database,
simultaneously managing the data, the database engine, and the database schema in order to
facilitate the organization and manipulation of data.
Though functions of DBMS vary greatly, general-purpose DBMS features and capabilities
should include: a user accessible catalog describing metadata, DBMS library management
system, data abstraction and independence, data security, logging and auditing of activity,
support for concurrency and transactions, support for authorization of access, access support
from remote locations, DBMS data recovery support in the event of damage, and
enforcement of Disadvantage traits to ensure the data follows certain rules.
A database schema design technique that functions to increase clarity in organizing data is
referred to as normalization. Normalization in DBMS modifies an existing schema to minimize
redundancy and dependency of data by splitting a large table into smaller tables and defining
the relationship between them. DBMS Output is a built-in package SQL in DBMS that enables
the user to display debugging information and output, and send messages from subprograms,
packages, PL/SQL blocks, and triggers. Oracle originally developed the DBMS File Transfer
package, which provides procedures to copy a binary file within a database or to transfer a
binary file between databases.
A database management system functions through the use of system commands, first
receiving instructions from a database administrator in DBMS, then instructing the system
accordingly, either to retrieve data, modify data, or load existing data from the system.
Popular DBMS examples include cloud-based database management systems, in-memory
database management systems (IMDBMS), columnar database management systems
(CDBMS), and NoSQL in DBMS.

RDBMS vs DBMS
A relational database management system (RDBMS) refers to a collection of programs and
capabilities that is designed to enable the user to create, update, and administer a relational
database, which is characterized by its structuring of data into logically independent tables.
There are several features that distinguish a Relational DBMS from a DBMS, including:

 Structure: Where data is structured in hierarchical form in a DBMS, data is structured


in tabular form in a RDBMS.
 User capacity: A RDBMS is capable of operating with multiple users. DBMS can only
manage one user at a time.
 Software/hardware requirements: A RDBMS has greater software and hardware
requirements.
 Programs managed: DBMS maintains databases within the computer network and
system hard disks. A RDBMS manages the relationships between its incorporated
tables of data.
 Data capacity: A DBMS is capable of managing small amounts of data and a RDBMS
can manage an unlimited amount of data.
 Distributed databases: A DBMS does not provide support for distributed databases
while a RDBMS does.
 ACID implementation: A RDBMS bases the structure of its data on the ACID (Atomicity,
Isolation, and Durability) model.
Difference Between Data and Information in DBMS
Data is raw, unprocessed, unorganized facts that are seemingly random and do not yet carry
any significance or meaning. Information refers to data that has been organized, interpreted,
and contextualized by a human or machine so that it posses relevance and purpose.
Information is filtered data that has been made systematic and useful, and is disadvantage to
be more reliable and valuable to researchers as proper analysis and refinement has been
conducted. A DBMS is concerned with the manipulation of data in a database.

Difference Between Data Models in DBMS


A data model is an abstract model that organizes elements of data, documents the way data
is stored and retrieved, standardizes how different data elements relate to one another and
to the properties of real-world entities, and designs the responses needed for information
system requirements. There are three main types of DBMS data models: relational, network,
and hierarchical.

 Relational data model: Data is organized as logically independent tables.


 Network data model: All entities are organized in graphical representations.
 Hierarchical data model: Data is organized into a tree-like structure.

Other data models include entity-relationship, record base, object-oriented, object relation,
semi-structured, associative, context, and flat data models. Database system architecture in
DBMS is categorized as either single tier, in which the DBMS is the only entity where the user
directly sits on the DBMS and uses it, or multi-tier, in which nearly all components are
independent and can be changed independently.

Features of Distributed Database Management System


A distributed database is a collection of related data in multiple interconnected databases
that are logically interrelated, but physically stored across multiple physical locations.
Distributed databases are categorized as either homogeneous, in which all the physical
locations use the same hardware and run the same operating systems and applications, or
heterogeneous, in which each location may have different data, software, and hardware
structures.
A distributed database management system (DDBMS) refers to a centralized application that
functions to create and manipulate distributed databases, synchronize the database at
regular intervals and provide transparent access mechanisms to the user, ensure universal
application of data modifications, maintain data security and integrity of the database, can be
accessed by several users simultaneously, and is used in applications that process large
volumes of data.

How is a DBMS Different from a Traditional File System?


A traditional filing system refers to early endeavors to computerize the manual filing system.
File-based systems typically use storage devices such as a CD-ROM or hard disk to store and
organize computer files and the data within with the goal of facilitating easy access.
A traditional file system is inexpensive, ideal for a small system with smaller quantity of parts,
very low design efforts, isolated data, and has a simple backup system, but is not secure, has a
lack of flexibility and many limitations, and has integrity flaws.
The benefits of DBMS over a traditional file system include: good for large systems, data-
sharable, flexible, has data integrity, and has a complex backup system. DBMS data security
requirements leverage the use of masking, tokenization, encryption, access control lists,
permissions, firewalls, and virtual private networks, making data storage and querying in
DBMS a far more secure option than in a traditional file system.

2.1. Common Databases Management Systems

2.1.1. MySQL

MySQL is an open source relational database management system (RDBMS) that runs on a
server and is usually used for developing web-based software applications. It provides a very
fast, multithreaded and powerful SQL database server. PHP is often used along MySQL for
cross-platform applications.
Advantage Disadvantage
- Available for free - No built-in support for XML or OLAP
- Supports standard SQL - Need to pay for support
- Fast, reliable and easy to use - Difficult to debug
- Handling a huge amount of data and - Difficult to maintain
good data management. - Functionality heavily depends on add-
- Can work with other DBMSs like DB2, ons
Oracle, etc.
- Customizable

2.1.2. Microsoft SQL Server

Microsoft SQL Server is an object-relational database management system (ORDBMS)


developed, distributed and supported by Microsoft Corporation. It is built for the basic
function of storing and retrieving data as required by other applications. This database
management engine can run on local servers as well as cloud-based servers or can be
optimized to work on both at the same time. MS SQL Server allows users to store and
manipulate terra bytes of data with various types like videos, images, text and much more.
Advantage Disadvantage
- Fast, stable and reliable - Enterprise editions is extremely
- Provides excellent tools expensive
- Easy to set up - Only run on Windows-based servers
- Work well with other MS products - Compatibility issues with applications
- Different editions available running on non-Windows platforms
- Great support for XML

2.1.3. Oracle

Oracle is one of the leading SQL relational database management systems that is
commonly used for running online transaction processing (OLTP), data warehousing (DW) and
mixed (OLTP & DW) database workloads. It is designed for the cloud and supports
single/multiple server hosting. Oracle allows control over an immensely huge amount of data
with the help of latest features.
Advantage Disadvantage
- Fast, stable and convenient - Cost may be infeasible for small
- Proven technology organizations
- Latest innovations and features - Difficult to learn and use
- Exceedingly powerful tools - Need specialized skills to install and
- Available in a variety of versions maintain
- Require significant resources

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

II. SYSTEM REQUIREMENTS

1. Data requirements for storage


 The company’s operations management system includes:

 AGC_Account  AGC_BillInfo
 AGC_Customer  AGC_BillProduct
 AGC_Employee  AGC_Order
 AGC_Categories  AGC_ImportProduct
 AGC_Product

2. Data requirements for storage

Decription
Entity Attribute Description of Atribute
Entity
Account_Username This is the unique username in
the company
All account in Account_Password It is the password used to log
AGC company into the system.
AGC_Account
Account_Type Decentralization of accounts in
the company
AGC_Customer Customer_ID It is the unique identifier for a
customer type
Customer_Name This is the full name of the
customer
Company_Name This is the Company name of
the customer
Company_Address This is the Company's address
All customer in
Contact_Phone This is the phone number
AGC company
Company to contact
Contact_Email This is the email to contact the
company
Customer_Username This is the unique username in
the company
Employee_ID It is the unique identifier for a
employee type
All of the Employee_Name It is the full name of each
company's employee type.
employee BirthDate This is the employee's birthday

AGC_Employee Employee_Address This is the employee's address

PhoneNumber This is the employee's phone


number
Employee_Email This is the employee's email

Employee_Username This is the employee's login


account to access the system
Category_ID It is the unique identifier for a
All of the category at the company.
AGC_Categories company's Category_Name It is the full name of each
categories category type.
Descriptions This is the category description
All products Product_ID It is the unique identifier for a
product
Category_ID It is the unique identifier for a
category at the company.
Product_Name It is the full name of each
product type.
Brand It is the brand of each product
AGC_Product type.
Year_Produce This is the year the product
was manufactured
Unit_Price This is the price of the product
Quantity This is the total output of the
product
Picture This is a place to store of
image of product
Bill_ID It is the unique identifier for a
bill info at the company.
All bill info for Bill_Date This is the time when you buy
the company the product.
AGC_BillInfo
Employee_ID It is the unique identifier for a
employee type.
Customer_ID It is the unique identifier for a
customer type.
AGC_BillProduct Bill_ProductID It is the unique identifier for a
bill product at the company.
All bill product Bill_ID It is the unique identifier for a
for the bill info at the company.
company Product_ID It is the unique identifier for a
product
Is_Setup This is used to see if customers
have setup it when they buy it.
Order_ID It is the unique identifier for a
All customer order ID at the company.
orders Customer_ID It is the unique identifier for a
customer type.
Product_ID It is the unique identifier for a
AGC_Order
product
Quantity This is the total output of the
orders
Is_Setup This is used to see if customers
have setup it when they buy it.
All import Import_ID It is the unique identifier for a
product import ID at the company.
Detailed Import_Date This is the date when you
quotation of import products
each product Customer_ID It is the unique identifier for a
customer type.
Employee_ID It is the unique identifier for a
AGC_ImportProduct employee type.
Product_ID It is the unique identifier for a
product
Quantity This is the total output of the
product
Total_Price This is the price of the product
3. Relationship between entities

- Product - Category: 
o A category will have many products. A product belongs to one category. So, the
relationship between category and product is the One - Many relationships. 

- Product - Supplier: 
o A supplier will have many products. A product belongs to one supplier. So, the
relationship between product and supplier is the One - Many relationships. 

- Invoice - Employee: 
o An employee will have many invoices. An invoice belongs to one employee. So,
the relationship between employee and invoice is the One - Many
relationships. 

- Invoice - Customer: 
o A customer will have many invoices. An invoice can only belong to one
customer. So, the relationship between customer and invoice is the One -
Many relationships. 

- Invoice – Invoice detail - Product: 


o An invoice will have many products. A product can belong to many invoice. So,
the relationship between invoice and product is Many – Many
relationships. Therefore, I create invoice detail entity. An invoice will have
many invoice detail. Each invoice detail can contain one product. So the
relationship between invoice and invoice detail is the One - Many relationships
and the relationship between invoice detail and product is the One - One
relationships. 

- Import - Employee: 
o An employee will have many import invoices. An import invoice belongs to one
employee. So, the relationship between employee and invoice is the One -
Many relationships. 

- Import - Supplier: 
o A customer will have many import invoices. An invoice can only belong to one
supplier. So, the relationship between supplier and import is the One - Many
relationships. 

- Import – Import detail - Product: 


o An import invoice will have many products. A product can belong to many
invoice. So, the relationship between invoice and product is Many – Many
relationships. Therefore, I create import detail entity. An import invoice will
have many import detail. Each import detail can contain one product. So the
relationship between import and import detail is the One - Many relationships
and the relationship between import detail and product is the One - One
relationships. 
III. DATABASE DESIGN
1. Entity relationship diagram (ERD)

- Definition: Entity Relationship Diagram, also known as ERD, ER Diagram or ER


model, is a type of structural diagram for use in database design. An ERD contains
different symbols and connectors that visualize two important information: The
major entities within the system scope, and the inter-relationships among these
entities.
- To avoid ruining the data in a production database, it is important to plan out the
changes carefully. ERD is a tool that helps. By drawing ER diagrams to visualize
database design ideas, you have a chance to identify the mistakes and design flaws,
and to make corrections before executing the changes in the database.
 There are many tools for drawing ERD. I use the ERDPlus.com system to plot the
ERD diagram.
 My ERD:
2. Convert ERD Diagram to Relational Schema.

 Definiton: Relational Model represents how data is stored in database in the form
of table.
 A relational schema for a database is an outline of how data is organized. It can be
a graphic illustration or another kind of chart used by programmers to understand
how each table is laid out, including the columns and the types of data they hold
and how tables connect.
 Here is my Relational Schema:

- AGC_Employee (Employee_ID, Employee_Name, Birthdate, Employee_Address,


PhoneNumber, Employee_Email, Employee_Username)
- AGC_Customer (Customer_ID, Customer_Name, Company_Name,
Company_Address, Contact_Phone, Contact_Email, Customer_Username) 
- AGC_Account (Account_ID, Account_Username, Account_Password, Account_Type) 
- AGC_Categories (Category_ID, Category_Name, Descriptions) 
- AGC_Product (Product_ID, Category_ID, Product_Name, Brand,
Year_Produce, Unit_Price, Quantity, Picture) 
- AGC_BillInfo (Bill_ID, Employee_ID, Customer_ID, Bill_Date) 
- AGC_BillProduct (Bill_ProductID , Bill_ID, Product_ID, Is_Setup) 
- AGC_Order (Order_ID, Customer_ID, Product_ID, Quantity, Is_Setup) 
- AGC_ImportProduct (Import_ID Customer_ID, Employee_ID, Product_ID,
Import_Date, Quantity, Total_Price) 
3. Normalization
 Normalization is a database design technique that reduces data redundancy and
eliminates undesirable characteristics like Insertion, Update, and Deletion
Anomalies. Normalization rules divide larger tables into smaller tables and link
them using relationships. The purpose of Normalisation in SQL is to eliminate
redundant (repetitive) data and ensure data is stored logically.
 The three main types of normalization are listed below. Note: "NF" refers to
"normal form."
 First normal form (1NF):
Tables in 1NF must adhere to some rules:
 Each cell must contain only a single (atomic) value.
 Every column in the table must be uniquely named.
 All values in a column must pertain to the same domain.
 Second normal form (2NF):
Tables in 2NF must be in 1NF and not have any partial dependency (e.g. every
non-prime attribute must be dependent on the table’s primary key).
 Third normal form (3NF):
Tables in 3NF must be in 2NF and have no transitive functional dependencies on
the primary key.

4. Relational database system

A. Database Diagram:
B. Implement a query language 

 SQL defines the following data languages to manipulate data 


of the RDBMS.  
 DDL: Data Definition Language 
 DML: Data Manipulation Language 
 TCL: Transaction Control Language 
 DCL: Data Control Language  
 DQL: Data Query Language 

 
   
 
 
 
 
 After design my database, I use DDL to create my database: 
Example: I use DDL create employee table 
 Create table AGC_Account

 Create table AGC_Customer

 Create table AGC_Employee


 Create table AGC_Categories

 Create table AGC_Product

 Create table AGC_BillInfo


 Create table AGC_BillProduct

 Create table AGC_Order

 Create table AGC_ImportProduct


a. Select 
Here are some example of how I use select query on my database: 
 Select all the record of table employee, customer and supplier 

 
 
 Select all the customers have the address “Ha Noi”. 
 
 
 
 
 Select name, phone number and address of the customers who have order on
2020-10-22. 

 
 Select all the product with the price higher than average. 
 
 
 
 Select customers with the invoice they have. 

 
 
 
 Select information of all import invoice of supplier with employee who created
the invoice. 
 
 
 Count the number of product supplied by each company 

b. Insert 
 Insert into table customer 

 
 For example, your employee birthdate is later than date time then it
will caught error: 

 
 
c. Update 
 Update customer username of the customer with ID = 1  

 
d. Delete 
 Delete from table categories where category = 3 
Before delete 

 
 
After delete 

 
 
IV. REFERENCES
- https://asq.org/quality-resources/relations-diagram#:~:text=Variation%3A%20matrix
%20diagram,that%20are%20not%20easily%20recognizable
- https://www.smartdraw.com/entity-relationship-diagram/
- https://www.sciencedirect.com/topics/computer-science/ternary-
relationship#:~:text=A%20ternary%20relationship%20is%20an,the%20semantics
%20of%20the%20association.
- https://www.omnisci.com/technical-glossary/dbms

You might also like