2 ND Unit DBMS
2 ND Unit DBMS
Data model is a collection of concepts that can be used to describe the structure of a database
High-level or conceptual data models : provide concepts that are close to the way many users
perceive Data. It uses the concepts such as
Entity: Represents a real word object, such as student, employee, Book.
Attribute: Represents some properties of entity, such as student name, id, marks.
Relationship: Represents an association between two or more entities such as relationship between
Book and Author.
low-level or physical data models : provide concepts that describe the details of how data is stored
on the computer storage media.
The entity relational data model based on the perception of the real world that consist of a
collection of basics objects and relationships between them. It is an object-based logical model.
It is also high-level data model.
ADVANTAGES:
DISADVANTAGES:
In this we hide the implementation complexity and data storage details from the users.
Using this model we cannot implement reference concept.
It is poorly designed database system means every user can implement the model.
In this model data will be represent in the form of inverted tree like structure.
This structure allows representing information using parent-child relationship.
Each parent can have many children. But each child has only one parent. Hence, this relationship
is called as one to many relationships
This model is used to describe the data and maintain the logical and view level.
At the top of the hierarchy, there is one entity, which is called the root.
ADVANTAGES:
DISADVANTAGES:
In the network model, the entities are organized in a graph, in which some entities can be accessed
through several paths as shown in figure below.
ADVANTAGES:
Data must be tree like structure because of we are using the pointers.
Data manipulation can be done easily.
It is possible to represent many to many relationship
DISADVANTAGES:
A logical representation of the data for an organization or for a business area is called E-R Model. It
is also called has Entity-Relationship Model.
Entity-Relationship Diagram
Entity relationship model defines the conceptual view of database. It works around real world entity and
Pavan kumar R,(SRFGC Madhugiri) Page 4
SRFGC Madhugiri III Bcom(CS) DBMS
association among them. At view level, ER model is considered well for designing databases.
Entity
An entity is an object that exists and which is distinguishable from other objects. An entity can be a
person, a place, an object, an event, or a concept about which an organization wishes to maintain data.
For example, in a school database, student, teachers, class and course offered can be considered as
entities. All entities have some attributes or properties that give them their identity.
An entity set is a collection of similar types of entities. Entity set may contain entities with attribute
sharing similar values. For example, Students set may contain all the student of a school; likewise
Teachers set may contain all the teachers of school from all faculties. Entities sets need not to be
disjoint.
ATTRIBUTE
An attribute is a property that describes an entity. All attributes have values. For example, a
student entity may have name, class, age as attributes. There exists a domain or range of values
that can be assigned to attributes. For example, a student's name cannot be a numeric value. It
has to be alphabetic. A student's age cannot be negative, etc.
Types of attributes:
Simple attribute:
Simple attributes are atomic values, which cannot be divided further. For example, student's
phone-number is an atomic value of 10 digits.
Composite attribute:
Composite attributes are made of more than one simple attribute. For example, a
student's name may have Firstname and Lastname.
Derived attribute:
Derived attributes are attributes, which do not exist physical in the database, but there values
are derived from other attributes presented in the database.
For another example, Age can be derived from DOB.
Stored attribute:
An attribute whose value cannot be derived from the values of other attributes is
called a stored attribute.
For example, DOB
Single-valued attribute:
Pavan kumar R,(SRFGC Madhugiri) Page 5
SRFGC Madhugiri III Bcom(CS) DBMS
Key is an attribute or collection of attributes that uniquely identifies an entity among entity set.
For example, RegNo of a student makes her/him identifiable among students.
Super Key: Set of attributes (one or more) that collectively identifies anentity in an entity
set.
Candidate Key: Minimal super key is called candidate key that is, superskeys for which no
proper subset are a superkey. An entity set may have more than one candidate key.
Primary Key: This is one of the candidate key chosen by the databasedesigner to
uniquely identify the entity set.
Relationship
The association among entities is called relationship. For example, employee entity has relation
works_at with department.
Another example is for student who enrolls in some course. Here, Works_at and Enrolls are called
relationship.
Keys
Superkey: an attribute or set of attributes that uniquely identifies an entity. Composite key: a key
requiring more than one attribute.
Candidate key: a superkey such that no proper subset of its attributes is also asuperkey (minimal
superkey – has no unnecessary attributes)
Primary key:the candidate key chosen to be used for identifying entities andaccessing records.
Unless otherwise noted "key" means "primary key" Alternate key:a candidate key not used for
primary key
Secondary key:attribute or set of attributes commonly used for accessing records,but not necessarily
unique
FOREIGN KEY
term used in relational databases (but not in the E-R model) for anattribute that is the primary key
of another table and is used to establish a relationship with that table where it appears as an
attribute also.
So a foreign key value occurs in the table and again in the other table.
Relationship
A relationship describes relations between entities.
Relationship is represented using diamonds.
Attributes:
Key Attribute
Key attribute represents the main characteristic of an entity.
It is used to represent Primary key. Ellipse with underlying lines represent key
attribute.
Composite Attribute
An attributes can be sub divided. These attributes are known as composite attribute.
Multivalued Attribute
Multivalued attributes are those that are capable of
taking on more than one value. It is represented by double Ellipse.
Derived Attribute
Derived attributes are attributes whose value can be
calculated from related attribute values. They are represented by dotted ellipse.
Degree of relationship
It is process of counting number of participating entities in an E-R diagram.
There are 3 types of degree. They are
Data Abstraction
The process of hiding the irrelevant data or things from the users. It reduces the complexity and increases
efficiency.
Example of Generalization.
(a) Two entity types CAR and TRUCK.
(b) Generalizing CAR and TRUCK into VEHICLE.
In the above figure “offer” is a relationship between center and course entities and acts as an entity for
“enquires” relationship. Hence offer is called as associative entity because it acts as both relationship and
entity.
CODD’S RULE
Codd's 12 rules are a set of thirteen rules (numbered zero to twelve) proposed by Edgar F. Codd, a pioneer of
the relational model for databases, designed to define what is required from a database management system in
order for it to be considered relational, i.e., a relational database management system RDBMS
• Rule 0: The system must qualify as relational, as a database, and as a management system. For a system to
qualify as a relational database management system (RDBMS), that system must use its
relationalfacilities (exclusively) to manage the database.
The DBMS must allow each field to remain null (or empty). Specifically, it must support a representation of
"missing information and inapplicable information" that is systematic, distinct
from all regular values (for example, "distinct from zero or any other number", in the case of numeric values),
and independent of data type. It is also implied that such representations must be manipulated
by the DBMS in a systematic way.
21
UCST 2018-19 CS&E
Tables and its specifications – table names and their columns. Columns are
represented along with their datatypes and size. In addition primary key of
each table is shown at the top of the column list.
Foreign keys are used to represent the relationship between the tables.
Mapping between the tables are represented using arrows between them.
Physical data model can have denormalized structure based on the user
requirement. The tables might not be in normalized forms.
Physical data model is dependent on the RDBMS i.e.; it varies based on the
RDBMS used. This means datatype notation varies depending on the RDBMS. For
example, we have different datatypes in SQL server and oracle server. In addition,
the representation of physical data model diagram may be different, though it
contains same information as described above – some may represent primary key
and foreign keys separately at the end of the column list. This data model depends
on the user / designer how he specifies the diagram and the RDBMS servers.
Below diagram shows different ways of representing a table.
22
UCST 2018-19 CS&E
Hence object based data model is based on the real requirement from the user,
whereas record based data model is based on the actual relationships and data in
DB. The Physical data model is based on the table structure in the DB.
23