Assignment
Assignment
ASSIGNMENT NUMBER: 1
Contents
I. Introduction.............................................................................................................................................................................. 5
II. Theory..................................................................................................................................................................................... 5
1. Database............................................................................................................................................................................... 5
2. Relational database...............................................................................................................................................................5
3. Entity relationship diagram (ERD):......................................................................................................................................6
4. Relational database schema..................................................................................................................................................7
6. Data standardization:..........................................................................................................................................................12
7. Query language:.................................................................................................................................................................13
8. System testing:................................................................................................................................................................... 13
III. practice................................................................................................................................................................................ 14
1. Analysis of real-world issues, required database data storage............................................................................................14
2. List of entities..................................................................................................................................................................... 14
3. Attributes of entities...........................................................................................................................................................14
4. Relationships of entities.....................................................................................................................................................15
5. ERD................................................................................................................................................................................... 15
6. Relational schema..............................................................................................................................................................15
7. Constraints in the database.................................................................................................................................................15
8. Detailed settings (List of tables contained in DB)..............................................................................................................16
9. Diagram Database..............................................................................................................................................................17
10. Query statements used in the created database:..............................................................................................................17
11. Normalize created database............................................................................................................................................18
);................................................................................................................................................................................................. 19
12. System security, database maintenance..........................................................................................................................19
IV. Test applied to the created database:...................................................................................................................................20
1. Test log:............................................................................................................................................................................. 20
2. Test case:............................................................................................................................................................................ 20
V. Technical manuals and user guides:......................................................................................................................................21
1. Utilized installation manual for DBMS:.............................................................................................................................21
2. Guidelines for using RDBMS on........................................................................................................................................23
3. Describe the database system's operation using flowcharts and data flow diagrams..........................................................24
VI. Conclusion......................................................................................................................................................................... 25
1. Analyze the effectiveness of the design in light of the user and system requirements........................................................25
1.1. Requirements for Users and Systems.............................................................................................................................25
1.2. Compare the design's performance to the specified specifications.................................................................................25
2. Assess the database solution's performance in light of user and system requirements.......................................................25
2.1. Check to see if relevant data has been retrieved using query tools to produce useful management information............25
2.2. Describe how the data were chosen for the test and how the test performed..................................................................25
2.3. Compare the database's performance to the requirements as mentioned:.......................................................................25
3. Analyze the database to determine what needs to be improved so that the system can continue to function effectively....25
3.1. System Resilience:.........................................................................................................................................................25
3.2. Make suggestions for the required upgrades:.................................................................................................................26
3.3. Does the database's examination of the aforementioned enhancements assist to guarantee continuity?.........................26
VII. References......................................................................................................................................................................... 26
I. Introduction
Introduction to databases: The terms "databases" and "databases" are frequently used in the context
of software, information technology, websites, etc. essential for creating and developing software and
apps for PC and mobile platforms. The subject focuses on developing the capabilities for managing
phone goods, as well as managing personnel and clients. Generally speaking, the topic has created all
of the fundamental specifications for a ShopPhone software.
II. Theory
1. Database
A database is a planned grouping of material that has been arranged and is often kept electronically
in a computer system. A database management system often oversees a database (DBMS). The term
"database system," which is frequently abbreviated to "database," refers to the combination of the
data, the DBMS, and the applications that are connected to it.
Any collection of data or information that has been properly structured for quick search and retrieval
by a computer is referred to as a database, often known as an electronic database. Databases are
designed to make it easy to save, retrieve, edit, and delete data while carrying out various data-
processing tasks.
DBMS fulfills the job of giving users with a database definition language to describe and declare
data types and structure data. It provides a creation environment for databases.
Several databases:
- Object-oriented databases
- Distributed databases
- Data warehouses
- NoSQL databases
- Graph databases
- Cloud databases
- Open source databases
2. Relational database
Data points that are connected to one another are stored and accessible in a relational database, which
is a form of database. The relational model, an easy-to-understand method of representing data in
tables, is the foundation of relational databases. Each table row in a relational database is a record
with a distinct ID known as the key. It is simple to determine the associations between data points
because the table's columns carry the properties of the data and each record typically has a value for
each property.
Components of the database system:
- Rows, Columns, Primary Keys, Foreign Keys
3. Entity relationship diagram (ERD):
Entity-relationship diagrams, or ERDs for short, show the connections between various entities that
are maintained in a database. Diagrams help to explain the database's logical organization. ERD is a
pattern that uses a variety of specialized symbols, and its meaning distinguishes it.
In the database design process, the E-R model aims to examine the data, identify the fundamental
information units required by the organization, and characterize their arrangement and relationships.
Real-world data management requirements are transformed using the E-R middleware model into a
relational database model.
Elements of an entity-relationship diagram:
- Real-world items, whether they are discernible or abstract (conceptual) objects.
- Each of the distinguishing properties that make up an entity set is referred to as an attribute of the
entity set. The value domain is a collection of values that correspond to each attribute.
- There are 3 types of relationships:
+ 1-much : A department with many employees
+ 1-1 : An employee belongs to only 1 department
+ 0-much : An employee can be the head of a department
+ 0-1 : An employee can be assigned to multiple projects or not assigned to any
- Symbols of components in an entity-relationship diagram:
+ String type (string)
+ Integer type (Integer)
+ Real number type (real)
+…
Some ERD drawing tools are:
- Draw.io
- QuickDBD
- Microsoft Visio
- DrawSQL
- DeZign
I choose drawn.io as my drawing tool because:
- It is very simple to create and organize drawings.
- This entity relationship diagram tool works on all browsers, including Chrome, Firefox, and
Internet Explorer.
- There is no limit to the number of sizes available.
- It allows you to store the model in a location of your choice.
- This software has drag and drop function.
- You can build database diagrams in a variety of formats, including UML (Unified Modeling
Language), ERD, and others.
- It comes with ready-to-use database design patterns.
- You have the option of working both online and offline.
- Draw.io is available on both desktop and mobile platforms.
4. Relational database schema
- A relational (database) schema is a collection of constraints, derivation rules, and table definitions
(stored base tables or derived views). A named collection of characteristics (columns) that receive
their values from domains is referred to as a table schema. At least one candidate key exists for each
column or combination of columns that is extended by a uniqueness requirement.
- A relational schema is a diagram that illustrates how businesses store and arrange data in a
database. The database's connections are also displayed. Relational schemas are frequently viewed by
developers as the form, blueprint, or design of the sets of information included within the database.
For example:
- Complex primary keyword (with 4 attributes)
DEPENDENT (EmployeeID, FirstName, Middlelinitial, LastName, DateOfBirth: Gender)
(EmployeeID, FirstName, Middlelinitial, LastName, DateOfBirth: Gender)
- Change to an alternative key
- DEPENDENTS (Dependent Number, Employee ID, First Name, First Name, Last Name, Date of
Birth: Gender) (Dependent Number, Employee ID, First Name, First Name, Last Name, Date of
Birth: Gender)
How to switch between an ERD and a relational schema:
- Relationships: The names of tables in a relational database.
- Rules:
- 1. Entity names will be the names of the relationships (Written in one word, without accents). For
example: Student, Teacher, Class, Vehicle, Course,...
- 2. Attributes:
2.1. Simple attributes will be directly converted into columns (fields) in the relationships.
- Example: The ID of an entity is a simple attribute => It will have a column named "ID".
2.2. Composite attributes will have three options to be converted into columns of the relationships.
- Example: The User entity has an Address attribute, which is a composite attribute consisting of three
sub-attributes: Province, Districts, Streets.
- Consider a multi-valued attribute as an independent relationship, and the relationship between the
main entity (main relationship) and the relationship of the multi-valued attribute is a one-to-many
relationship.
3. Relationships:
Alternatively:
The foreign key will be in the participating relationship in the relationship and references the primary
key of the partial relationship.
- Example:
- It is known that:
- One person (Users) has only one ID card number (Infors).
- One person (Users) may or may not have an ID card number (Infors) => Users partially participate in
the relationship.
- An ID card number (Infors) must belong to someone (Users) => Infors totally participates in the
relationship.
- Users is the partial relationship and has UserID as the primary key.
- In other words, Infors will have a foreign key referencing the primary key of Users.
- So:
- Rule:
- Use the primary key of the (1) relationship as the foreign key of the (n) relationship.
- In other words, in the (n) relationship, there will be a foreign key referencing the primary key of
the (1) relationship.
- Example:
- One Users can make many Orders.
- One Order belongs to only one Users.
- Relationship:
- Users (UserID, ...)
- Orders (OrderID, ...)
- Question: Where will the foreign key be placed, in the Users relationship or the Orders relationship?
- Rule:
It is necessary to use a third relationship to break the many-to-many relationship into two one-to-
many relationships.
The third relationship will use foreign keys to the two main relationships as the primary key
(Composite Primary Key).
Example:
One Order can have one or many Products.
One Product (a product code) can belong to one or many Orders.
Therefore, the relationship between Orders and Products is a many-to-many relationship.
7. Query language:
The term "query language" refers to a class of programming languages used to write queries for
databases and information systems.
Statements in query language:
- Insert values: add records to the table.
- Insert select: add records from another table to the table.
- Select into: put the selection results in a new table.
- Delete: delete records from the table.
- Truncate: delete all records of the table.
- Update: fix the records in the table.
8. System testing:
A comprehensive and integrated product is tested during system testing. after unit and integration
testing. System testing assures the system will function in many various environments, integrating
with many different software and systems, whereas software products are typically only tested on one
due to the demo environment. Black box testing includes system testing. System discusses how the
program functions outside from the viewpoint of the user.
The main purpose of testing is to discover software defects so that they can be remedied and
corrected. Testing cannot confirm that the product functions properly under all conditions, but can
only confirm that it does not work properly under specific conditions.
III. practice
1. Analysis of real-world issues, required database data storage
Several mobile phone retailers make up the "ShopPhone" franchise. The store's primary function is to
supply all customers who require mobile phones and other portable gadgets with such items.
When the warehouse gets an import/export order from the planning department, the storekeeper will
create an import/export note based on the import/export request document, with the entire amount of
input. /delivery to the warehouse.
The amount changes during the import/export process, thus the storekeeper must record the quantity
while importing/exporting.
To handle goods more effectively, however, the warehouse must be unified because it houses a wide
variety of materials.
2. List of entities
3. Attributes of entities
Product (IMEI, name, release date, capacity, phone size)
ProductType (ProductTypeID, ProductTypeName, ProductTypeDesc)
Staff (ProductTypeID, ProductTypeName, ProductTypeDesc)
Customers (CustID, CustFirstName, CustLastName, CustEmail, CustPhone, CustAddress)
Manufacturer (ManID, ManName, ManEmail, ManPhone, ManAddress)
Orders (OrderID, ReceiverFirstName, ReceiverLastName, ReceiverEmail, ReceiverPhone,
ReceiverAddress)
Orderdetail (productPrice, ProductQuantity, IMEI)
4. Relationships of entities
Customers has relationship with orders, one Customers has many orders
The relationship between Customers and orders is 1 - n
Staff has orders relationship, one Staff can print out multiple orders
The relationship between staff and orders is 1 - n
Manufacturer has relationship with product, one Manufacturer can have many product
The relationship between Manufacturer and product is 1 - n
Product type has relationship with product, one product type can have many product
The relationship between product type and product is 1 - n
Product has relationship with order detail, one product can have many order detail
The relationship between product and order detail is 1 - n
Orders has relationship with order detail, one orders can have many order detail
The relationship between orders and order detail is 1 - n
5. ERD
6. Relational schema
7. Constraints in the database
- NOT NULL
- PRIMARY Key
- FOREIGN Key
- CHECK
- UNIQUE
8. Detailed settings (List of tables contained in DB)
TABLE COLUMN NAME DATATYES CONSTRAINT
Staff StaffID INT PK,IDENTITY
StaffName VARCHAR(255) NOT NULL
StaffPhone VARCHAR(255) NOT NULL
StaffAddress VARCHAR(255)
StaffEmail VARCHAR(255)
Customer CusID INT PK,IDENTITY
CusName VARCHAR(255) NOT NULL
CusPhone VARCHAR(255) NOT NULL
CusAddress VARCHAR(255)
CusEmail VARCHAR(255)
Manufacturer ManID INT PK,IDENTITY
ManName VARCHAR(255) NOT NULL
ManPhone VARCHAR(255) NOT NULL
ManAddress VARCHAR(255)
ManEmail VARCHAR(255)
ProductType ProductTypeID INT PK,IDENTITY
ProductTypeName VARCHAR(255) NOT NULL
ProductTypeDesc DATEDEFAULT NOT NULL
Product ProductID INT PK,IDENTITY
ProductName VARCHAR(255) NOT NULL
Productprice FLOAT NOT NULL
CPU VARCHAR(255) NOT NULL
RAM VARCHAR(255) NOT NULL
ROM VARCHAR(255) NOT NULL
PhoneSize VARCHAR(255) NOTNULL
IMEI VARCHAR(255) NOT NULL
ProductTypeID INT FK
ManID INT FK
Orders OrderID INT PK,IDENTITY
ReceiverEmail VARCHAR(255) NOT NULL
ReceiverPhone VARCHAR(255) NOT NULL
ReceiverName VARCHAR(255) NOT NULL
ReceiverAdress VARCHAR(255) NOTNULL
CusID INT FK
StaffID INT FK
OrderDetail ProductID INT FK
OrderID INT FK
ProductPrice INT NOTNULL
ProductQuantity INT NOTNULL
IMEI VARCHAR(255) NOTNULL
9. Diagram Database
10. Query statements used in the created database:
USE ShopPhone;
);
StaffAddress VARCHAR(255),
StaffEmail VARCHAR(255),
);
CusAddress VARCHAR(255),
);
);
);
);
);
-- Set 1
INSERT INTO Product
(ProductID, ProductName, ProductPrice, IMEI, ROM, RAM, CPU, PhoneSize, ProductTypeID,
ManID)
VALUES
(12, 'iPhone 14 Pro Max', 12000, 'Apple A16 Bionic', '6 GB', '128 GB', '1', '3'),
(13, 'S22 Ultra', 20000, 'Samsung Exynos 2200', '8 GB', '128 GB', '2', '1');
-- Set 2
SELECT * FROM Product;
-- Set 3
UPDATE Product SET ProductPrice = 15000 WHERE ProductID = 1;
-- Set 4
DELETE FROM Product WHERE ProductID = 12;
-- Set 5
SELECT * FROM Product WHERE ProductPrice >= 20000;
-- Set 6
INSERT INTO Product
(ProductID, ProductName, ProductPrice, IMEI, ROM, RAM, CPU, PhoneSize, ProductTypeID,
ManID)
VALUES
(13, 'S22 Ultra', 20000, 'Samsung Exynos 2200', '8 GB', '128 GB', '2', '1');
-- Set 7
SELECT * FROM Product ORDER BY ProductPrice DESC;
-- Set 8
SELECT Orders.OrderID, Orders.ReceiverName, Orders.ReceiverEmail, Orders.ReceiverPhone,
Staff.StaffID, Staff.StaffName FROM Orders INNER JOIN Customers ON Orders.CusID =
Customers.CusID INNER JOIN Staff ON Orders.StaffID = Staff.StaffID;
2. Test case:
Step 3: In the Install location window, click Browse to change the location where the installation files
are saved or to default and click install
Step 4: Wait for the machine to install
Step 5: Dowload add the SSMS tool on the Microsoft home page to Microsoft SQL Server
Management Studio to make the workflow more intuitive
Step 4: Create a table. A table is a collection of related data. To create a table, you use the CREATE
TABLE statement. For example, the following statement creates a table named Customers with the
following columns:
Step 5: Insert data into the table. Once you have created a table, you can insert data into it by using
the INSERT INTO statement. For example, the following statement inserts a row into the Customers
table:
Step 6: Retrieve data from the table. You can retrieve data from a table by using the SELECT
statement. For example, the following statement retrieves all of the rows from the Customers table:
Step 7: Update data in the table. You can update data in a table by using the UPDATE statement. For
example, the following statement updates the CustomerName column in the Customers table to Jane
Doe:
Step 8: Delete data from the table. You can delete data from a table by using the DELETE statement.
For example, the following statement deletes the row with the CustomerID value of 1 from the
Customers table:
3. Describe the database system's operation using flowcharts and data flow diagrams.
A data flow diagram (DFD) shows how information moves through any system or process. It
displays data inputs, outputs, storage locations, and routes between each destination using predefined
symbols such rectangles, circles, and arrows as well as brief text descriptions. Data flow diagrams
can be as basic as hand-drawn process overviews or more complex, multi-level DFDs that gradually
delve deeper into the data handling process. They can be used to model a new system or examine an
existing one. A DFD works for both technical and nontechnical audiences, from developers to CEOs,
and, like all the finest diagrams and charts, frequently seems to "express" things that would be
difficult to convey in words. That is why DFDs are still so widely used year. Today, they are less
useful for visualizing interactive, real-time, or database-oriented software or systems, even if they
still function well for data flow software and systems.
VI. Conclusion
1. Analyze the effectiveness of the design in light of the user and system requirements.
1.1. Requirements for Users and Systems
To add, update, and remove records, the user and system criteria must be met. Make it a system-
optimized approach for simple product management and accurate billing.
1.2. Compare the design's performance to the specified specifications.
We can clearly see that it is incredibly effective since it totally satisfies all of the standards I have
listed. It is designed to be optimized and user-friendly.
2. Assess the database solution's performance in light of user and system requirements.
2.1. Check to see if relevant data has been retrieved using query tools to produce useful management
information.
I have very logically incorporated the query tools. I included my work using basic query tools. I have
rationally and skilfully combined these tools for ease of usage.
2.2. Describe how the data were chosen for the test and how the test performed.
I entered the data into the database after carefully calculating it and using references from other
sources to compare.
2.3. Compare the database's performance to the requirements as mentioned:
It optimizes utilization and offers a positive user experience. simple to use for those new to the
application
3. Analyze the database to determine what needs to be improved so that the system can continue to
function effectively.
3.1. System Resilience:
By ensuring that backup procedures are in place to handle crucial operational tasks, disaster recovery
helps reduce the impact of a tragedy on a business.
3.2. Make suggestions for the required upgrades:
I'll address issues, increase system security, and add new features to make the system better:
3.3. Does the database's examination of the aforementioned enhancements assist to guarantee continuity?
Because that's one of my objectives, it's definitely feasible.
VII. References
Several pages for references are:
By Visual Paradigm: https://www.visual-paradigm.com/guide/data-modeling/what-is-entity-
relationship-diagram/;WWWSESSIONID=1A198EE7AFD4F4D8912CAC6C81BE5B94.www1
By Oracle: https://www.oracle.com/database/what-is-database/
Article Contributed By supriya_saxena: https://www.geeksforgeeks.org/relation-schema-in-dbms/
By phoenixNAP: https://phoenixnap.com/glossary/relational-database-management-system-rdbms
By Guru99: https://www.guru99.com/software-testing-introduction-importance.html