Professional Documents
Culture Documents
Design: 2.1 Entity-Relationship Diagram
Design: 2.1 Entity-Relationship Diagram
Design: 2.1 Entity-Relationship Diagram
DESIGN
Entities
Relations
Attributes
Cardinality ratios.
The Regular Entities of Jewellery Management System are:
Jewel
Customer
Booking
Offers
Transaction log
Jewel ( jewel_id , image, brand, name, size, amount, type, count, discount)
Customer ( customer_id, name, dob, email, gender, phone, country, state, district,
address, password)
Booking ( book_id, customer_id, jewel_id, date, grand_total, status)
Offers ( jewel_id, discount)
Transaction_log ( transaction_id, date)
ER Diagram Description:
o For each regular (strong) entity type E in the ER schema, create a relation
R that includes all the simple attributes of E.
o Choose one of the key attributes of E as the primary key for R.
o If the chosen key of E is composite, the set of simple attributes that form it
will together form the primary key of R.
Step 2: Mapping of Weak Entity Types
o For each weak entity type W in the ER schema with owner entity type E,
create a relation R & include all simple attributes (or simple components
of composite attributes) of W as attributes of R.
o Also, include as foreign key attributes of R the primary key attribute(s) of
the relation(s) that correspond to the owner entity type(s).
o The primary key of R is the combination of the primary key(s) of the
owner(s) and the partial key of the weak entity type W, if any.
Step 3: Mapping of Binary 1:1 Relationship Types
o For each 1:1 relationship type R, identify the relations S and T that
participating in R.
Foreign key approach
o For each binary 1:N relationship type R, identify the relation S that
represents the participating entity type at the N-side of the relationship.
Let T denotes the other participating entity.
o Include the primary key of T as a foreign key in S.
o Include any simple attributes of the relationship as attributes of S.
Step 5: Mapping of Binary M:N Relationship Types
o For each n-ary relationship type R, where n>2, create a new relation S to
represent R.
o Include as foreign key attributes in S the primary keys of the relations that
represent the participating entity types.
o Also include any simple attributes of the n-ary relationship type (or simple
components of composite attributes) as attributes of S.
Table 2.1 Key Correspondence between ER and Relational Models
every relational database state fulfills the integrity constraints set on a relational database
schema.
The fig.2.2 shows the schema for Jewellery Management System. The schema has
Horizontal blocks representing the entities of the particular attribute. The line from an
entity pointing to the other entity shows that particular entity is referenced.
Multivalued dependency
Transitive dependency
The functional dependencies for Jewellery Management System are:
Jewel : Jewel_id {jewel_id, image, brand, name, size, amount, type, count,
discount}
Customer:customer_id {customer_id, name, dob, email, gender, phone,
country, state, district, address, password}
Booking:book_id {book_id, customer_id, jewel_id, date, grand_total, status}
Offers {jewel_id, discount}
Transaction_log:transaction_id {transaction_id, date}
2.5 NORMALIZED RELTIONAL SCHEMA:
The relation is said to be in 1NF if it has no repeating groups. All tables have no repeating
groups so they are in 1NF.
1. jewel :-
image, jewel_id, brand, name, size, amount, type, count, discount.
2. customer :-
customer_id, name, dob, email, gender, phone, country, state, district, address,
password.
Customer_id Name dob Email gender phone country state district address password
3. bookingdetails :-
book_id, customer_id, jewel_id, date, grandtotal, status.
4. offers :-
jewel_id, discount.
Jewel_id Discount
5. transaction_log :-
t_id, date.
T_id Date
1. jewel:-
The absence of partial dependency in relation takes it into 2NF without any
modifications.
2. customer:-
The absence of partial dependency in relation takes it into 2NF without any
modifications.
Customer_id Name dob Email gender phone country state district address password
3. bookingdetails :-
The absence of partial dependency in relation takes it into 2NF without any
modifications.
4. offers :-
The absence of partial dependency in relation takes it into 2NF without any
modifications.
Jewel_id Discount
5. Transaction_log :-
The absence of partial dependency in relation takes it into 2NF without any
modifications.
T_id Date
1. jewel :-
In jewel, every attribute depends on primary key so it is in 3NF.
2. customer:-
In customer, every attribute depends on primary key so it is in 3NF.
Customer_id Name dob Email gender phone country state district address password
3. booking details:-
In bookingdetails, attributes depend on primary key so it is in 3NF.
4. offers :-
In offers, attributes depend on primary key so it is in 3NF.
Jewel_id Discount
5. transaction_log :-
In transaction_log, attributes depend on primary key so it is in 3NF.
T_id Date
4NF is concerned with multivalued dependency. A table is in 4NF if and only if, for every
one of its non-trivial multivalued de3pendencies X-->>Y, X is superkey i.e. X is either a
candidate key or a superset thereof.
5NF also known as Project Join Normal Form (PF/NF) is a level of database
normalization designed to reduce redundancy in relation databases recording multivalued
facts by isolating semantically related multiple relationships. A table is said to be in 5NF
if and only if every non-trivial join dependency in that table
The table 2.2 describes the Key attributes present in the database with primary key
and foreign key.
JEWEL JEWEL_ ID
CUSTOMER CUSTOMER_ID
BOOKING BOOK_ID
OFFERS JEWEL_ID
TRASACTION_LOG TRANSACTION_ID
PRIMARY KEY
A column or group of columns in a table which helps us to uniquely identifies every row
in that table is called a primary key. This DBMS can't be a duplicate. The same value
can't appear more than once in the table.
The Primary Key Attributes used in database are : jewel_id, customer_id, book_id,
transaction_id.
FOREIGN KEY
A foreign key is a column which is added to create a relationship with another table.
Foreign keys help us to maintain data integrity and also allows navigation between two
different instances of an entity. Every relationship in the model needs to be supported by
a foreign key.
NOT NULL
The DEFAULT constraint is used to provide a default value for a column. The
default value will be added to all new records IF no other value is specified.