Professional Documents
Culture Documents
DB Chapter 3
DB Chapter 3
DB Chapter 3
DATABASE MODELING
The first step in database design is requirements
collection and analysis.
The next step is conceptual data modeling
DATABASE It provides concepts that are close to the way
many user perceive the data.
MODELING It identifies the business objects that would
exist in the system and relationships among
them.
E-R is used to conceptual database design.
DATABASE MODELING
Logical design:-
It’s the actual implementation of the database, using a DBMS such as SQL.
So the conceptual schema is transformed from the high-level data model into the
implementation data model.
The last step is the physical design phase
Internal storage structures file organizations, indexes, access paths, and physical
design parameters for the database files are specified.
In parallel with these activities, application programs are designed and
implemented.
• Entity: Entity refers to an\object "or \ thing “ in real world with the
existence that can be differentiated from other objects.
• Object may be any person, place, event etc. An entity can be an object
with physical existence like student, a car, employee ,etc. or an object
with conceptual existence like job, positioned,
• Attributes: An attribute is particular properties that describe an entity.
Basic
For example,
• A student can be described by his name, age, address, height, class
concepts
etc.
• Loans can be described by their types such as house loan, car loan etc.
• Employees in any company can be described by their Employee_ID,
name, department, designation etc. A car can be described by its color,
model ,company etc.
• An Attribute is named Column of a relation
presented.
• In the relational model, relations are used to hold
information about the objects to be presented in
the database.
• A relation is represented a two dimensional table
…Attributes in which the rows of the table correspond to
individual records and the table columns
correspond to attributes.
• Attributes can appear in any order and the
relation will still be the same relation, and
therefore convey the same meaning.
Domain: A domain is the set of allowable values for one or
more attributes.
• Relationships are an
association between two or
more entities.
• Relationships shows how the
Entity are connected or
related to each other.
• Total number of entity sets participate in a
relationship set is known as degree of that
Degree Of relationship set.
• There are three types of relationship that
Relationship exist between Entities:-
1. Binary Relationship
2. Recursive Relationship
3. Ternary Relationship
Degree Of Relationship
• Many-to-Many
Cardinality: The cardinality of a relationship is the actual number of related occurrences
for each of the two entities. The basic types of connectivity for relations are: one-to-one,
one-to-many, and many to-many.
One to One
defining
Primary
key
Foreign key
• A Foreign key is a key borrowed from another related table (that’s why its
foreign) in order to make the relationship between two tables.
• A foreign key is an attribute in any entity set which is also a Primary Key in
any other entity set and is used to link two tables together.
• A foreign key is a column which is added to create a relationship with
another table.
• When a primary key from one table appears in another table, it is called a
foreign key.
Foreign key
Student table
Course table
CCode IDNo CTitle CChr
MIS001 001 Database 5
MIS002 003 Networking 5
IDNo is primary key for student table and foreign key for course table
Primary Key and Foreign Key
Entity Integrity
These are the rules or constraints applied to the database to keep data
stable, accurate or consistent.
Entity Integrity ensures that there are no duplicate records within the
table and that the field that identifies each record within the table is
unique and never null.
The existence of the Primary Key is the core of the entity integrity. If you
define a primary key for each entity, they follow the entity integrity rule.
Referential Integrity
The integrity of a row that contains a foreign key depends on the integrity
of the row that it references—the row that contains the matching primary
key.
By default, the database server does not allow you to violate referential
integrity
• The Rule defines that a foreign key have a matching primary
key.
• Reference from a table to another table should be valid.
…Referential
Integrity
…Referential Integrity
• Once requirement are collected and analyzed, database
design stage begins.
• E-R diagrams represents the logical structure of a database.
• E-R modeling is begins by identifying the important data
called entities and relationships between the data that must
Entity be represented in the model.
• Symbols used in E-R diagrams are shown below
Relationship
Diagram(E-
R Diagram)
E-R Diagram Symbols
E-R Diagram
Example of Attributes
Lastname Firstname
ID No.
Gender
Student Address
Birth date
Email
Example of Attributes
Name
Chairperson
Lastname Firstname
Program ID
Enrollment ID No.
Date
Gender
Email
has Faculty
Lastname
Firstname
34
E-R Diagram
Identify all the entities in the system. An entity
should appear only once in particular diagram.
Guidelines of
Identify relationship between entities. Connect
them using a line and add a diamond in the
middle describing the relationship.
how to draw
E-R Add attributes for entities.