Assignment DBMS: Mojahid Ali
Assignment DBMS: Mojahid Ali
Assignment DBMS: Mojahid Ali
DBMS
Submit by
Mojahid Ali
TO
Sir Jamshaid
C
address
C city
C state
C postal
code
ORDER
Order ID
Order date
Customer ID
Product ID
Ordered quantity
ORDER LINE
Order ID
Product
Product ID
Product
Product
description finish
Product
price
Product
line ID
SQL table;
CREATE TABLE Customer _T
(customer ID
Customer name
Customer address
Customer city
Customer state
Customer postal code
Anomaly
An error or inconsistency that may result when a user attempts to
update a table that contains redundant data. The three types of
anomalies are insertion, deletion, and modification anomalies.
1.Insertion anomaly Suppose that we need to add a new
employee to EMPLOYEE2. The primary key for this relation is the
combination of Emp ID and course Title . therefore to insert a
new row the user must supply values for both EMP ID and Course
Title. This is an anomaly because the user should be able to enter
employee data without supplying course data.
2. Deletion anomaly Suppose the data for employee number 140
are deleted from the table. This will result in losing the
information that this employee completed a course. It result in
losing the information that the course had an offering that
completed on that data.
Modification anomaly Suppose the employee number 100 gets
a salary increase. We must recorded the increase in each of the
rows for that employee otherwise the data will be inconsistent.
CUSTOMER
customer ID
customer name
customer address
customer postal code
CUSTOMER
Customer ID
Customer name
Customer address
Customer postal
code
(b)CUSTOMER relation
2.Weak entities are entities that cannot exist except with an
identifying relationship with an owner entity type. Weak
entities are identified by rectangle with a double line.
3. Associative entities also called gerunds are formed from
many to many relationships between other entity types.
Associative entities are represented by a rectangle with
rounded corners.
EMPLOYEE
Employee ID
Employee name
Employee address
{skills}
EMPLOYEE
Employee ID
Employee name
EMPLOYEE SKILL
Employee ID
Employee address
Skill
MULTIVALUED ATTRIBUTES
When the regular entity type contains a multivalued attribute two
new relations are created. The first relation contains all of the
attributes of the entity type except the multivalued attribute. The
second relation contains two attributes that from the primary key
of the second relation. The first of these attributes is the primary
key from the first relation which becomes a foreign key in the
second relation. The second is the multivalued attribute.
DEPENDENT
Dependent name
Name,
Recall that a weak entity type does not have an(First
independent
Middle
initial, with
existence but exists only through an identifying
relationship
Last Name)
another entity type called the owner. A weak entity
type does not
Date of called
Birth a
have a complete identifier but must have an attribute
Gender
partial identifier that permits distinguishing the
various
occurrences of the weak entity for each entity for each owner
entity instances.
EXAMPLE of weak entity
EMPLOYEE
Employee ID
Employee Name
EMPLOYEE
Employee ID
Employee
Name
DEPENDENT
First
Name
Middle
initial
Last
name
Employe
e ID
Date of
Birth
Gender
CUSTOMER
Customer ID
Customer name
Customer address
Customer postal
code
EMPLOYEE
Employee ID
Employee name
Employee date birth
COURSE
Course ID
Course title
CARE CENTER
Center ID
Center location