Professional Documents
Culture Documents
Internal verification:
Contents
A. INTRODUCTION.............................................................................................................................................. 4
B. SYSTEM REQUIREMENTS ........................................................................................................................... 4
I. Real world scenario........................................................................................................................................ 4
II. Data requirement for storage .......................................................................................................................... 4
III. Relationship between entities............................................................................................................................. 6
C. DATABASE DESIGN ....................................................................................................................................... 6
I. ER Diagram .................................................................................................................................................... 6
1. What is ER diagram? ................................................................................................................................ 6
2. Role of ER Diagram in database design process: .................................................................................... 7
3. Basic components of ER Diagram ............................................................................................................ 7
4. Build ER Diagram...................................................................................................................................... 9
5. Software that supports drawing ER Diagram ....................................................................................... 10
II. Convert from associative entity diagram to relational schema............................................................ 11
1. Relational schema .................................................................................................................................... 11
2. Convert from ER Diagram to Relational Diagram. .............................................................................. 12
III. Normalization ........................................................................................................................................... 16
1. The goal of standardization ..................................................................................................................... 17
2. Nomalization divided into what type ...................................................................................................... 17
IV. Relational database system ..................................................................................................................... 17
1. Design Database. ...................................................................................................................................... 17
D. Test ................................................................................................................................................................ 22
E. SYSTEM SECURITY AND MAINTAINACE ......................................................................................... 22
F. TECHNICAL AND USER DOCUMENT .............................................................................................................. 22
1. MySQL Workbench for design Database .................................................................................................. 22
Object Management ............................................................................................................................................... 23
Connection Management ....................................................................................................................................... 24
2. Install MySQL and MySQL Workbench. .................................................................................................... 24
G. REFERENCES ................................................................................................................................................... 40
A. INTRODUCTION
Currently, there are many stores that do not use technology to manage the store's operating system
or have outdated technology that cannot meet the growing needs and Glass Shop is one of them.
manage its operations using a computer system developed by a university. student 5 years ago. The
current system is too slow and no system documentation is created at deployment time to prevent
this. You can easily make changes to the system. Therefore, GS invited the database development
team of a large IT consulting company to advise on document development and database design for
the project. A new system that meets current customer needs.
B. SYSTEM REQUIREMENTS
I. Real world scenario
Until now, GS has run his shop on a computer system created by a university student 5 years
ago. The system is currently too slow and since no system documentation is created during
development it is difficult to make improvements. GS executives believe that in order to
successfully grow and operate their store, they must adapt as their business needs evolve.
1. User
Entity Description Attribute Descriptio of
attribute
Id_user Id of user
Name User name
User Phone User phone number
Email User email
Pass User pass
Address User Address
2. Staff
Entity Description Attribute Descriptio of
attribute
Id_staff Id of staff
Staff Name Staff name
Phone Staff phone number
Email Staff email
Pass Staff pass
3. Type
Entity Description Attribute Descriptio of
attribute
Type Id_type Id of type
Name Name type
4. Manufacturer
Entity Description Attribute Descriptio of
attribute
Manufacturer Id_manufacturer Id of manufacturer
Name Name manufacturer
5. Warehouse
Entity Description Attribute Descriptio of
attribute
Warehouse Id_warehouse Id of warehouse
Name Name warehouse
6. Product
Entity Description Attribute Descriptio of
attribute
Id_product Id of product
Id_type Id of type
Product Id_manufacturer Id of manufacturer
Id_warehouse Id of warehouse
Name Product name
Price Product price
7. Orders
Entity Description Attribute Descriptio of
attribute
Id_orders Id of orders
Staff Id_user Id of user
Id_staff Id of staff
Date Order date
Total Total price
8. Ordersdetail
Entity Description Attribute Descriptio of
attribute
Id_orders Id of order
Ordersdetail Id_product Id of product
Amount The number of
products
Price Product price
A user has many orders, and an order belongs to only one user.
A product has many order details, an order detail has only one product.
C. DATABASE DESIGN
I. ER Diagram
1. What is ER diagram?
The Entity Relationship model (E-R) introduced by CHEN in 1976 is a widely used
model in conceptual database designs, built on the recognition of real world knowledge
through a set of objects called entities and the relationships between these objects.
Compared with the network model, the entity-relationship model has more advantages
and it shows more clearly the components in the real world. If the network model only
represents the main objects but not the features in that object, the entity-relationship
model overcomes these weaknesses. Therefore, the choice of this model is always the
decision of the database design analyst.
ii. Attributes:
Each entity set has a set of characteristic properties, each of which is called an
attribute of the entity set. For each attribute there is a set of values for that attribute
called the value domain.
The attribute's value domain includes the following value types:
• String Type
• Integer type
• Real number type (real)
• ...
• Monovalues: attributes with unique values for an entity (eg ID number, ...)
• Multivalued: attributes that have a set of values for the same entity (e.g.
degree, ...)
• Deductible (year of birth <----> age)
iv. ER Diagram
A graph that represents sets of entities, attributes, and relationships
Example ER Diagram:
v. Link types in ER Diagram:
4. Build ER Diagram
i. Rule:
• Exactly
• Avoid duplicates
• Easy to understand
• Choose the right relationship
• Choose the right attribute type
ii. Gleek.io
iv. ERDPlus
Staff
NO Attribute Describe Datatypes Size Constraint
name
1 Id_staff Id of staff INT 11 Not null,
Primary
key
2 Name Name of Varchar 45 Default
staff null
3 Phone Phone of Varchar 45 Default
staff null
4 Email Email of Varchar 45 Default
staff null
5 Pass Pass of Varchar 45 Default
staff null
Manufacturer
NO Attribute name Describe Datatypes Size Constraint
1 Id_manufacturer Id of INT 11 Not null,
manufacturer Primary
key
2 Name Name of Varchar 45 Default
manufacturer null
Type
NO Attribute name Describe Datatypes Size Constraint
1 Id_type Id of type INT 11 Not null,
Primary
key
2 Name Name of type Varchar 45 Default
null
Warehouse
NO Attribute name Describe Datatypes Size Constraint
1 Id_warehouse Id of INT 11 Not null,
warehouse Primary
key
2 Name Name of Varchar 45 Default
warehouse null
User
NO Attribute Describe Datatypes Size Constraint
name
1 Id_user Id of user INT 11 Not null,
Primary
key
2 Name Name of Varchar 45 Default
user null
3 Phone Phone of Varchar 45 Default
user null
4 Email Email of Varchar 45 Default
user null
5 Pass Pass of user Varchar 45 Default
null
6 Address Address of Varchar 45 Default
user null
Product
NO Attribute name Describe Datatypes Size Constraint
1 Id_product Id of user INT 11 Not null, Primary key
2 Id_type Id of type INT 11 Default null, FK(type)
3 Id_manufacturer Id of INT 11 Default null
manufacturer FK( manufacturer)
4 Id_warehouse Id of warehouse INT 11 Default null,
FK(warehouse)
5 Name Product name Varchar 45 Default null
6 Price Address of user Varchar 45 Default null
Orders
NO Attribute name Describe Datatypes Size Constraint
1 Id_orders Id of orders INT 11 Not null, Primary key
2 Id_user Id of user INT 11 Default null, FK(user)
3 Id_staff Id of staff INT 11 Default null
FK(staff)
4 Date Order date Date Default null,
5 Total Total price Varchar 45 Default null
Ordersdetail
NO Attribute name Describe Datatypes Size Constraint
1 Id_orders Id of orders INT 11 Default null, FK(orders)
2 Id_product Id of product INT 11 Default null, FK(product)
3 Amount The number of Varchar 45 Default null
products
4 Price Product price Varchar 45 Default null,
III. Normalization
1. The goal of standardization
▪ Eliminate data redundancy
▪ Remove update anomaly
▪ Remove insertion anomaly
▪ Remove deletion anomaly
ii. 2NF
• Is 1NF
• Non-key attributes must be fully functionally dependent on the
primary key
iii. 3NF
• Is 2NF
• Non-key attributes must depend directly on the primary key
Oracle
Advantages:
• There will be improvements and new features. Because Oracle tends to set the bar
for other database management tools.
• Oracle's database management tools are also extremely powerful. You might find a
tool that can do what you want.
Disadvantages:
• The cost of Oracle is quite high, especially for small organizations.
• The system will require quite a lot of resources after installation. So it is necessary
to upgrade the hardware
SQL Server
Advantages:
• It is very fast and has stability.
• Provides performance tuning and monitoring capabilities. Reduces the use of
resources.
• Visualization is accessible on mobile devices.
• Works well with other Microsoft products.
Disadvantages:
• Even with performance throttling, Microsoft SQL Server can consume resources.
• Many individuals have problems using SQL Server integration services to import
files.
MySQL
Advantages:
• Free version available.
• Provides many functions.
• Various types of user interfaces.
• It can work on other databases like DB2 and Oracle.
Disadvantages:
• You need to spend a lot of time working with MySQL (which other systems will do
automatically).
• Support will be available in the free version but you need to pay for it.
• Conclude: From the above priority points, we will choose the site using MySQL to
deploy the project's database.
D. Test
No Test Error Fix Result
1 Update product Set price = Unknown Change from Pass
600000 Where id =1 column 'ID' in "id=1" to
'where clause' "id_product=1"
2 INSERT INTO Incorrect date Change from Pass
`glass_shop`.`orders` value: '25-6- "25-6-2022" to
(`id_orders`, `id_user`, 2022' for column "2022-06-25"
`id_staff`, `date`, `total`) 'date' at row 1
VALUES ('01', '01', '01', '25-
6-2022', '500000')
Trigger
A trigger (from the Dutch trekken, meaning to pull) is a lever which, when pulled by the
finger, releases the hammer on a firearm. In a database, a trigger is a set of Structured Query
Language (SQL) statements that automatically "fires off" an action when a specific
operation, such as changing data in a table, occurs.
What is the function of a trigger?
Creating a response to an event is done with a trigger. A trigger is a declaration that you are
interested in a certain event or set of events. Binding a function to a trigger allows you to
capture and act on events.
• Table Editor - easily edit data and commit changes using a simple grid format.
• Results Window - execute multiple queries simultaneously and view text results,
image and spatial views, and query performance statistics on individual tabs.
• SQL Snippet Panel - save and easily reuse common Selects, DML and DDL code.
• History Panel - view complete session history of queries and statements showing
what queries were run and when. Easily retrieve, review, re-run, append or modify
previously executed SQL statements.
• Table Data Search Panel - find data across an entire database by proving text search
on any number of tables and schemas, showing rows matching a given pattern.
• Export Results - export results data to common formats including CSV, HTML, and
XML.
Object Management
The Object Browser enables developers to easily navigate database schemas and objects.
DBAs can visually select tables and fields to query, edit tables, create new tables and
databases, and drop tables and databases.
Schema Inspector - Leverage a suite of detailed grids on all objects in their database
schemas to view, sort, and analyze various details and statistics. From within Schema
inspector developers can easily invoke table maintenance operations such as ANALYZE
and OPTIMIZE TABLE.
Object Browser - Easily navigate, explore, and perform actions on database objects
(tables, views, triggers, etc.)
Object Editor - Easily edit, create or delete database objects (tables, views, triggers, etc.)
Connection Management
The Database Connections Panel and Connections Wizard enables developers to create,
organize, and manage standard database connections, including MySQL Fabric.
Advanced users can use the Manage Connections dialog to enter connection parameters
like IP address, port, username, and password, as well as easily create secure remote
connections via ssh.