DDD Assigment

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

PROGRAM TITLE: Database Design and Development

UNIT TITLE: Database Design & Development

ASSIGNMENT NUMBER: 1

ASSIGNMENT NAME:

SUBMISSION DATE: 8/9/2021

DATE RECEIVED: 8/9/2021

TUTORIAL LECTURER: LUONG THI THAO HIEU

WORD COUNT: 1952

STUDENT NAME:

STUDENT ID:

MOBILE NUMBER:
Summative Feedback:
Hi!
Over all, you have understood content of subject. Your report meet the requirement of
learning outcome and relative completely. Your approach is very clear and detail.
Strength

 Understand, analysis system requirement and demonstrated so carefully


 Present relationship between entities and apply in your database.
 Understand principles in convert ERD to Relation Diagram
 Explain the common nomalization and haved evidence apply how normalization
was used in your database.
 Using SQLServer to designed Database, and Implement query accross multiple
tables giving out correctly result.
 Excute testing database system with evidence of user interface, output, and data
validations
 Implement system security and database maintenance
 Hardworking and absorb the instructor’s instruction

Weakness

 You do not evaluate the effectiveness of the database solution using to user and
system requirements
 short of diagrams showing movement of data through the system, and flowcharts
describing how the system works
 reference is not follwing harvard referencing style
How to improve

  Apply advanced query across multiple table to demonstrated integrity and


accuracy of your databse system.
 Adding flowcharts describing how the system works

 Evaluate the effectiveness of the your relation database system to user and system
requirements

Grade: Pass
Date: 16/9/2021
Assessor: Luong Thi Thao Hieu
Internal verification:

Contents
A. INTRODUCTION.............................................................................................................................4
B. SYSTEM REQUIREMENTS...........................................................................................................4
I. Real world scenario.......................................................................................................................4
II. Data requirements for storage..................................................................................................4
III. Relationship between entities....................................................................................................7
C. DATABASE DESIGN.......................................................................................................................7
I. ERD Diagram.................................................................................................................................7
II. Convert ERD Diagram to Relation Diagram...........................................................................9
III. Normalization.............................................................................................................................9
IV. Relational database system.....................................................................................................11
D. DATABASE DEVELOPMENT(P2)...............................................................................................21
E. TESTCASE AND TEST LOG (P4)................................................................................................27
F. SYSTEM SECURITY AND MAINTAINACE (M2)....................................................................29
References.................................................................................................................................................36
A. INTRODUCTION. 

On the market today, there are many business companies that are not using
technologies to manage the company's operating systems or have old technologies
that do not meet the growing needs. company development. And AGC is one of
them. Until now, AGC has managed its business using a computer system developed
by a university student 5 years ago. The system is currently too slow and no system
documentation is generated when it is deployed that changes to the system cannot be
easily made. Therefore, AGC has hired a team of Database Developers at a large IT
consulting company to advise on document building and Database design for a new
system to meet the current needs of customers. The company can also develop the
system in the future if needed.

B. SYSTEM REQUIREMENTS 
I. Real world scenario 

To date, AGC has operated its company utilizing a computerized system created by a
college student five years ago. The system is currently too slow, and because no
system documentation was created when it was developed, it is difficult to make
improvements. The CEO of AGC believes that, since their business needs have
evolved, they must adapt in order to expand and operate their company successfully

II. Data requirements for storage 


1. Account

Entity Description of entity Attribute Description of attribute


accoutId Id of the account
Account userName User name of the account
password Password of the account
typeAccount Type of the account

2. Employee
Entity Description of entity Attribute Description of attribute
employeeId Id of employee
Employee name Name of employee
address Address of employee
phoneNumber Phone number of
employee
email Email of employee

3. Customer

Entity Description of entity Attribute Description of attribute


customerId Id of the customer
Customer name Name of customer
address Address of customer
phoneNumber Phone number of
customer

4. Category

Entity Description of entity Attribute Description of attribute


categoryId Id of the category
Category name Name of the category
description Description of the
category

5. Product

Entity Description of entity Attribute Description of attribute


productId Id of the product
Product name Name of the product
price Price of the product
image Image of the product
quantity Quantity of the product

6. Order

Entity Description of entity Attribute Description of attribute


orderId Id of the order
nameCustomer Name customer of the
Order order
address Address of the order
note Noye of the order
phoneNumber Phone number of order
III. Relationship between entities  
 An account belongs to an employee and 1 cx employee has only an account => the
relationship between Account and Employee is One to One. 
 An account belongs to a customer and 1 cx customer has only an account => the
relationship between Account and Customer is One to One. 
 A category can have products but a product can only belong to one category => the
relationship between Category and Product is One to Many
 One employee can import many products and one product can be imported by many
employee => the relationship between Employee and Product is Many to Many
 A customer can have many orders, but an order can only belong to one customer =>
the relationship between Customer and Order is One to Many
 A product can have many orders and an order can also have many products => the
relationship between Product and Order is Many to Many

C. DATABASE DESIGN
I. ERD Diagram  

ERD is a diagram, showing the entities in the database, and the relationship between
them.

 Some tools features to draw ERD:


 DeZign for Databases:
 Drag-and-drop user interface
 Entity Relationship Diagramming
 Multiple display modes
 Industry-standard design notations
 Multiple display modes
 Pan and zoom window
 ER-Modeling
 Forward engineering
 Reverse engineering
 Gleek.io
 Keyboard-based user interface
 Rapid Diagramming
 Version Control
 Live Collaboration
 Diagram export
 Design templates
 Customization
 dbdiagram.io
 Generates SQL statements
 Exports to images and PDFs
 One-click sharing
 Integrates with SQL databases
 ERDPlus
 User-friendly interface, easy to use
 Full EDR vẽ drawing features
 Very convenient to use can draw right on the website:
https://erdplus.com/
Through the above features, I use ERDPlus to draw Diagram to Relation
Diagram.
II. Convert ERD Diagram to Relation Diagram

III.   Normalization
1. The goal of standardization
 Eliminate data redundancy
 Remove update anomaly
 Remove insertion anomaly
 Remove deletion anomaly
2. Chuan hoa chia thanh cac loai nao 
a. 1NF (First Normal Form)

 A table (relation) is said to be in 1NF normal form if and only if all the
domains of the columns present in the table (relation) contain only atomic
(prime) values.
b.  2NF
 Is 1NF
 Non-key attributes must be fully functionally dependent on the primary
key

c. 3NF
 Is 2NF
 Non-key attributes must depend directly on the primary key

3. For example
Table Employee( name, email, phoneNumber, address, city, hiredate, accountId).
 1NF:
 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.
 Eg:

 2NF: Tables in 2NF must be in 1NF and not have any partial dependency

 3NF: Tables in 3NF must be in 2NF and have no transitive functional dependencies
on the primary key.
IV.   Relational database system
1. Design Database.  
a. A database management system (DBMS)
DBMS is a software package designed to define, manipulate, retrieve, and manage data in a
database. The DBMS usually manipulates its own data. Data format, field names, record
structure, and file structure. It also defines rules for validating and manipulating these data
b. The most popular database management systems today:
 Oracle

 Advantages:

o There will be improvements and new features. Because Oracle tends to set the bar
for other database management tools.
o Oracle's database management tools are also extremely powerful. You might find
a tool that can do what you want.

 Disadvantages:

o The cost of Oracle is quite high, especially for small organizations.


o The system will require quite a lot of resources after installation. So it is
necessary to upgrade the hardware
 MySQL

 Advantages:
o Free version available.
o Provides many functions.
o Various types of user interfaces.
o It can work on other databases like DB2 and Oracle.

 Disadvantages:

o You need to spend a lot of time working with MySQL (which other systems will
do automatically).
o There is no built-in support for XML or OLAP.
o Support will be available in the free version but you need to pay for it.
 SQL Server

 Advantages:

o It is very fast and has stability.


o Provides performance tuning and monitoring capabilities. Reduces the use of
resources.
o Visualization is accessible on mobile devices.
o Works well with other Microsoft products.

 Disadvantages:

o Even with performance throttling, Microsoft SQL Server can consume resources.
o Many individuals have problems using SQL Server integration services to import
files.

Conclude: From the above priority points, we will choose the site using SQL Server
to deploy the project's database
2. Database Diagram:  

3. Implement a query language


a. Select 
 Insert normally:
 Select with PROCEDURE: compact and can be reused many times
b. Insert 
 Insert normally:

 Insert with PROCEDURE: compact and can be reused many times


c. Update
 Insert normally:
 Update with PROCEDURE: compact and can be reused many times

d. Delete  
 Delete normally:
 Delete with PROCEDURE: compact and can be reused many times

Use triggers to increase database security


D. DATABASE DEVELOPMENT(P2)
1. Form Login 

2. Form Categories, Products


 Product
E. TESTCASE AND TEST LOG (P4) 
Admin

Description Step Expected Result


Check the layout of login 1.host -Show the same screen
screen http://127.0.0.1:8000/login (Refer Layout Section )
2. Check UI
Check layout login
3.Click button Submit - Displaying an error
asking to enter full-field
information (Refer Layout
Section )
Check display of Brands Check UI - Display the same screen
items (Refer Layout Item )
Check to delete 1.Log in to the system - Data is deleted
productitem 2. Click menu Brands
3. Input delete
Check and edit the list 1.Log in to the system -Show items to fix (Refer
2. Click menu product Layout Section )
3. Input edit - The product item is edited
and displayed on the
product
Check add product 1.Log in to the system - display additional input
2. Click menu product items product
3. Input add product - More success product
Check display of product Check UI - Display the same screen
items (Refer Layout Item )
Check to delete product 1.Log in to the system - Data is deleted
item 2. Click menu product 3.
Input delete
Check and edit the list 1.Log in to the system -Show items to fix (Refer
2. Click menu Brands Layout Section )
3. Input edit - The product item is edited
and displayed on the
Brands
Check add Brands 1.Log in to the system - display additional input
2. Click menu Brands items Brands
3. Input add Brands - More success Brands
Check more Bills items Check UI Display information input
items
F. SYSTEM SECURITY AND MAINTAINACE (M2)  
1. 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.
Eg:

2. Create user login database


SQL Server authentication, using users on SQL Server for authentication, is suitable for the
purposes of use and enhances security through the following steps:

Under Security > Logins, select New Login…

Next, in the General section:


 (4) Set the login account name
 (5) Select the authentication type as SQL Server authentication and set the
password for the account.
 (6) Implement password policies for the account, these options you can
choose or not, depending on your needs:
 Enforece Password Policy and Enforce password: These two items will
use the policy of Computer Configuration -> Windows Settings ->
Security Settings -> Account Policies
 User must change password at next login: With this option, the user will
have to change the password again when the next login.
Next, in the Server Roles
Next, in the User Mapping section:
 (10) Select the database that the user is allowed to grant access to.

 (11) Select the permissions that the user will be granted on the database
In the Status section, make sure the user is in the state as shown below and
click OK to finish the account creation process.
References
https://www.gleek.io/blog/best-erd-tools.html

https://viblo.asia/p/tong-hop-ve-chuan-hoa-co-so-du-lieu-ORNZqP33K0n
https://vietnix.vn/he-quan-tri-co-so-du-lieu/

You might also like