Professional Documents
Culture Documents
Assignment Solution
Assignment Solution
Assignment Solution
Student ID:
1 (20 points) you want to create a database for computer lab management.
You want to keep track of the following information:
The information about the software installed. Each computer station has various types of
software (e.g., word processor, spreadsheet, database, diagramming tools, etc.) Note you only
care about the types, version and vendors of the software, not the licensing information of each
piece of software. You just want to know which type of the software is used most frequently.
The information about projects that are running on some computer station. Including the project
ID, description, project leader and starting date, etc.
The information about users who are the employees currently working some projects. Including
employee’s ID and name, as well as job title.
The information about appointments made by users to use the lab. A user needs to make an
appointment to use a workstation. For an appointment, employee need to indicate (or assigned) a
station ID, indicating types of software to use, and the time period of using the station.
Note: In each appointment, an employee can only indicate one computer with multiple software
to use.
b. Convert the data model in (a) into tables, clearly indicate the keys and foreign keys
Answer:
Create ERD using given case
Part a:
Relational schema
Part b:
Create table:
With SQL:
Table 1:
Computer Station
Table attributes:
Station_ID Model
Table 2:
Employee
Table attributes:
Employee ( Employee_ID INT PK , Employee Name VARCHAR , job tittle VATCHAR )
Table 3:
Project
SQL
Table 4:
Appointment
Table Project:
artist artist Artwor Artwork Trans- Pric Custom Custom Custom Trans Agent
ID Name k-Title ID Type e er - er- er- -Date name
Numbe Name Locatio
r n
Note: each artist has an agent who handles the transactions of his/her art pieces. But artist may
change their agent periodically. Customers can buy/sell a piece of art from/to the gallery. Type
your answer
a. Carefully exam the data shown in this table to list all FDs.
b. If you want to create above table in a database, what is the primary KEY for this
table? Namely, what combination of attributes can provide the value to uniquely
identify a transaction record? Note this table is very bad design.
c. What normal form this table is in? Why?
d. How many “themes” (i.e., pieces of information) that are implied by above table?
State each “theme”.
f. Normalize above table. In the normalization result you must show the table name and
the key, and FK if there is any.
Answer:
Normalize table
Liberalization is a physical database technique which also eliminates downfalls such as Insertion,
Update, and Deletion Anomalies. Stabilization rules divide larger tables into smaller tables and
use relationships to connect them. The goal of SQL homogenization is to remove redundant
(repetitive) data and ensure that data is stored logically.
The inventor of the conceptual data Edgar Codd put forward the idea of normalization of data
with the intro of the First Relational Model, and he persisted to enlarge theory with Second and
Third Fourth Column. Subsequently, he collaborated with Raymond F. Boyce to establish the
Boyce-Codd Normal Form theory.
This enhances the precision and quality of your data all the while making your database more
navigable. Simply said, data normalization guarantees that business data looks, reads, and can be
employed consistently across all the records in your customer information.
As a Database Management system, you usually operate with massive volumes of data contained
in various tables inside databases. If the info is not appropriately collected, it might be
challenging to find. We may use Convergence to fix that issue by arranging the database in
various ways. Through examples, this piece can assist you comprehend the notion of DBMS
normality.
We'll talk about the attribute values that can exist in a table and the anomalies that can develop as
a result of these functional dependencies. For eradicate the aberrations, tables will be translated
back conventional formats.
What is the purpose of Smoothing?
Normalization is the act of clustering into numerous two or more tables in an attempt to
minimize data redundancy and inconsistency. Its goal is to remove data abnormalities.
Data inconsistency is caused by anything that impairs data integrity. As a result, the data may be
valid in one spot but incorrect in another. This can result in untrustworthy and nonsensical data.
It happens across tables when similar data is stored in 2 different rows in various forms.
FD’s attributs:
Keys attributes:
artworkID(PK INT)
Artist ID (FK)
Database anomalies are simply mismatched or missing data produced by limits or defects in a
database. Databases are designed to collect data and sort or show it to the end user in certain
ways. If the database is restricted or contains 'bugs,' entering or removing information, whether
an update or a new record, might cause problems.
Table 1
artist ID artist Name
1 John
2 Roman
3 Shaw
4 Peter
5 Kim
Table 2:
Artwork-Title Artwork ID
A-Boy 1
Farmers 2
A-face 3
XYZ 4
Table 3:
Answer the following questions, assuming all FDs are implied by given data. Note the
shipping charge depends on type of shipping. The products’ discount rates depend on quantities
and the Month when an order is placed.
a. List FD and multivalued dependencies (MVD), if there is any.
b. If a table include all columns of above sheet, what is the Key of this table?
c. What Normal Form this table is in? Why?
d. Normalize above table into a set of tables.
Answer:
List of attributes
But first of all we do normalize the table and first step is rearranged double single cell values
Data inconsistency is caused by anything that impairs data integrity. As a result, the data may be
valid in one spot but incorrect in another. This can result in untrustworthy and nonsensical data.
It happens across tables when similar data is stored in 2 different rows in various forms.
Functional dependency
Functional dependence ensures that the same data does not appear again throughout a database or
network of databases. Preserve data quality and integrity. Because functional dependence factors
frequently result in a more effective and less redundant system, the quality and integrity of your
data are often greater.
The Advantages of Data Normalization
FD’s attributes:
Order no, customer ID, customer Name, products name, products unit price, quantity of product
Table 1
Ord Custo Shippi Shippi Order Produ Prod Quant Disco
er Cutome mer ng ng date cts uct ity of unt
No rID Name Type Charg M/D/Y Name Unit Produ rate
e Price ct
246 XYZ Dan 12/20/20 A $12 40 10%
21.
Expre 12
ss
246 XYZ Dan 12/20/20
21. B $34 50 10%
Expre 12
ss
246 XYZ Dan 12/20/20 C $12 30 0%
21.
Expre 12
ss
298 ABC Sam 11/2/202 A $12 30 5%
Regul 8 0
ar
298 ABC Sam 11/2/202
Regul 8 0 B $34 60 5%
ar
341 ABC Sam 3/5/2022 A $12 40 0%
Groun 5
d
341 ABC Sam 3/5/2022
Groun 5 D $45 80 5%
d
519 ASD Larry 4/20/201 A $12 20
Expre 12 9 0%
ss
Key attributes
Table 3:
Products Product Quantity of Discount rate
Name Unit Price Product
A $12 40 10%
B $34 50 5%
C $12 30 0%
A $12 30
0%
B $34 60 10%
A $12 40 5%
D $45 80 0%
A $12 20
0%
Products Product
Name Unit Price
A $12
B $34
C $12
D $45
4. (10 points) A law firm proposed the following table to keep track the information about cases
and the lawyers who handle the cases:
LawyerInCharge is the name of the lawyer (a single person) who is in charge of the case.
NOTE: There may be also several staffs in the firm serve as the caseAssistant working for one
LawyerInCharge in a case
paymentMethod can be credit card, cash or check, payment method cannot be changed once a
case is on file.
salary and bonus are paid to the lawyerInCharge. Bonus depends on the case, salary is not.
a. List Function Dependencies based on above information. Also list the multivalued-
dependency given by above narrative.
b. What is the KEY for table Case? (hint: the caseID cannot be the key for above table
because knowing the caseID only cannot identify the values of some other attributes in
this table uniquely.)
c. What normal form the table CASE is in? Why? Give a clear explanation.
d. Normalize this table. Show your result.
Answer:
Create table
Key attributes
CREATE TABLE `computer
lab`.`case` (`casenumber` INT(50) NOT NULL , `casedescription` VA
RCHAR(100) NOT NULL , `lawyerincharge` VARCHAR(50) NOT NULL , `ca
seAssitent` VARCHAR(50) NOT NULL , `beginningdate` DATE NOT NULL
, `endingdate` DATE NOT NULL , `lawyerrate` INT(50) NOT NULL , `a
ccumulateedhours` INT(50) NOT NULL , `clientname` VARCHAR(50) NOT
NULL , `clientphone` VARCHAR(100) NOT NULL , `clientAdress` VARCH
AR(100) NOT NULL , `clienttype` VARCHAR(50) NOT NULL , `lawyerpho
ne` VARCHAR(50) NOT NULL , `caseresultdescription` VARCHAR(100) N
OT NULL , `clientcurrentpayment` INT(50) NOT NULL , `paymentmetho
d` VARCHAR(50) NOT NULL , `salary` INT(50) NOT NULL , `bouns` INT
(50) NOT NULL , PRIMARY KEY (`casenumber`)) ENGINE = InnoDB;
The act of structuring data into tables in such a manner that the outcomes of utilising the
database are always clear and as intended is known as database normalisation. This type of
normalisation is inherent in relational database theory. It has the potential to duplicate data inside
the database and frequently leads in the development of new tables.
Database normalisation is widely credited to E.F. Codd, an IBM researcher who presented a
paper explaining the relational database paradigm in 1970. What Codd referred to as "a normal
form for database relations" was a critical component of the relational method. Such data
normalisation found an eager audience in the 1970s and 1980s, when disc drives were relatively
expensive and a very efficient source of data storage.
While data normalization procedures increase data duplication, they do not introduce data
redundancy, or unneeded duplication. Following the initial exercise of selecting the data items
that should be in the relational database, establishing their relationships, and defining the rows
and columns inside each table, database normalization is often a refining process.
Database normalisation is a procedure that should be completed for each database that you
construct. Normal Forms refers to the act of taking a database design and applying a set of
formal criteria and rules to it.
If all of an entity's properties are dependent on the whole primary key, it is in a second normal
form. As a result, the values in the various columns are dependent on the values in the other
columns.
The table must already be in 1 NF, and all non-key columns must be dependent on the
PRIMARY KEY.