0% found this document useful (0 votes)
20 views

Ucse253l Dbms Module 2

The document discusses different data models including the entity relationship model, relational model, hierarchical model, and network model. It provides details on key concepts for each model such as entities, attributes, relationships and their cardinalities. Examples are given to illustrate how to construct entity relationship diagrams and identify relationships. Relational operations and query languages are also covered at a high level.

Uploaded by

Senthil Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Ucse253l Dbms Module 2

The document discusses different data models including the entity relationship model, relational model, hierarchical model, and network model. It provides details on key concepts for each model such as entities, attributes, relationships and their cardinalities. Examples are given to illustrate how to construct entity relationship diagrams and identify relationships. Relational operations and query languages are also covered at a high level.

Uploaded by

Senthil Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

UCSE253L – DATABASE

MANAGEMENT
Module 2: DATA MODELS SYSTEMS
Topics
01 Data Models

02 Entities, attributes, associations, relationships

03 Entity Relationship (ER)


Model

04 Relational data model, hierarchical model, Network data


model
Data Models

• A data model is a collection of conceptual tools for describing data, data relationships, data
semantics, and consistency constraints.
• There are different data models available:
• Entity Relational data model
• Relational data model
• Object based data model
• Hierarchical data model
• Network data model
• Semi structured data model
Data Models

• Data Association: When a large amount of data is stored in a database, we have to formalize the
storage mechanism that will be used to obtain the correct information from the data.
• Entity: An entity is a “thing” or “object” in the real world that is distinguishable from other
objects. For example, each student is an entity, and courses can be considered as entities.
• Entities are described in a database by a set of attributes. For example, the attributes dept name,
block, and budget may describe one particular department in a university, and they form attributes
of the department entity set.
Student (reg_no, name, degree, department, aadhaar_no, mobile )

department(dept_id, dept_name, block, budget)


Data Models

• An association between two attributes indicates that the values of the associated attributes are
interdependent.
• We distinguish between the association that exists among the attributes of an entity, called an
attribute association, and that which exists between entities, called a relationship.
• A relationship is an association among several entities. For example, belongs relationship
associates an student with his department. The following are the different relationship types that
may exist between two entity sets.
• One to one
• One to many
• Many to one
• many to many
Relationships
Cardinalities
Relationships

• Exercise based on Mapping Cardinality: A manufacturing company produces


products. The following product information is stored: product name, product ID and
quantity on hand. These products are made up of many components.
Assumptions:
• A component does not have to be associated with a product i.e. not all
components are used in products.
• A product cannot exist without components.
• Each component can be supplied by one or more suppliers and each supplier
will be supplying at most one component.
Identify the entities, relationships and appropriate mapping cardinality that exist in the
relationship sets.
Functional Dependency

• A functional dependency is a relationship between two attributes, typically between the PK and
other non-key attributes within a table. For any relation R, attribute Y is functionally dependent on
attribute X (usually the PK), if for every valid instance of X, that value of X uniquely determines
the value of Y.

Student (regno, name, degree, deptid, deptname, aadhaar_no, mobile )

Functional dependencies:
regno -> name
deptid -> deptname
Relationships

• Exercise based on Mapping Cardinality: A manufacturing company produces


products. The following product information is stored: product name, product ID and
quantity on hand. These products are made up of many components. Each component
can be supplied by one or more suppliers.

. . .
. . .
. . .
Product Components Suppliers
Entity Relationship Model

• Entities and Their Attributes. The basic object that the ER model represents is an
entity, which is a thing in the real world with an independent existence. An entity may
be an object with a physical existence or it may be an object with a conceptual
existence.
• Different types of attributes:
• simple versus composite: Composite attributes can be divided into smaller
subparts, which represent more basic attributes with independent meanings.
• Single valued versus multivalued: Most attributes have a single value for a
particular entity, such attributes are called single-valued.
Entity Relationship Model
Notations in ER diagram
Notations in ER diagram
Notations in ER diagram
Entity Relationship Model

• Exercise: Construct an E-R diagram for a car insurance company whose customers
own one or more cars each. Each car has associated with it zero to any number of
recorded accidents. Each insurance policy covers one or more cars, and has one or
more premium payments associated with it. Each payment is for a particular period of
time, and has an associated due date, and the date when the payment was received.
Entity Relationship Model

• Exercise: E-R diagram for a car insurance company


Entity Relationship Model

• Extended ER Features:
Entity Relationship Model

• Extended ER Features:
Relational Data Model
• The relational model refers to an abstract model that we use to manage and organise
the data that gets stored in a database. In this relational model we store the data in the
form of tables.
• In the relational model the term relation is used to refer to a table, while the term tuple
is used to refer to a row. Similarly, the term attribute refers to a column of a table.

Significant terms
domain
atomic
schema
Instance
keys
Entity Relationship Model

• Exercise: Construct an E-R diagram for a hospital with a set of patients and a set of
medical doctors. Associate with each patient a log of the various tests and examinations
conducted.
Relational Query
Language
• A query language is a language in which a user requests information from the
database. Query languages can be categorized as either procedural or nonprocedural.
• In a procedural language, the user instructs the system to perform a sequence of
operations on the database to compute the desired result. eg. Relational algebra
• In a nonprocedural language, the user describes the desired information without
giving a specific procedure for obtaining that information. Eg. Tuple relational
calculus, domain relational calculus
Relational Operations
• Cartesian product, joins – natural join, outer-join operation
• Set-operations – union, intersection & set difference
Relational Operations
• Cartesian product, joins – natural join, outer-join operation
• Set-operations – union, intersection & set difference
Relational Operations
• Cartesian product, joins – natural join, outer-join operation
• Set-operations – union, intersection & set difference
Network Data Model
• The network data model uses two different data structures to represent the database
entities and relationships between the entities, namely record type and set type.
• A set type is used to represent a directed relationship between two record types, the so-
called owner record type, and the member record type.
Hierarchical Model
• In a hierarchical database, the data is organized in a hierarchical or ordered tree
structure and the database is a collection of such disjoint trees.
• If we define the root record type to be at level 0, then the level of its dependent record
types can be defined as being at level 1.

You might also like