SQL Unit 2
SQL Unit 2
System
Prof. Manish Kumar Joshi, Assistant Professor,
Prof. Nishant P. Khatri, Assistant Professor,
Parul Institute Of Computer Application.
CHAPTER-2
Data Models
Data Models
A database model may be a form of data model that determines the logical structure
or variety of a database and essentially determines in which manner data is kept,
organized, and manipulated.
The most standard example of a info model is:- relational model, which uses a table-
based format.
Data models outline however data is connected to every alternative and
how they're processed and stored inside the system.
Entity:-
Anything regarding that information are collected/stored.
An entity is associate degree object that exists and is distinguishable
from different objects.
Example: specific person, company, event, plant
An entity set could be a set of entities of the same type that share the
same properties.
Example: set of all persons, companies, trees, holidays
Data Model Basic Building Blocks
Example:-
Attribute
Characteristic of an entity
Relationship
Describes an association among entities
One-to-one (1:1) relationship (1 student enroll for one
course)
One-to-many (1:M) relationship (1 company many
departments)
Many-to-one (M:1) relationship (Many seller 1 product)
Many-to-many (M:N or M:M) relationship (many books many
Categories of data models
• Conceptual (high-level, semantic) data models:- Provide
concepts that are close to the way many users perceive(distinguish)
data. (Also called entity-based or its also called object-based data
models.)
• Physical (low-level, internal) data models:- Provide concepts that
describe details of how data is stored in the computer.
• Implementation (representational/External) data models:-
Provide concepts that fall between the above two, balancing user
views with some computer storage details.
Database Relationship
A relationship is represented by diamond shape in Entity Relational
diagram, it shows the relationship among entities. There are four
types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
One to One Relationship
• When a one instance of an entity is associated with
a one instance of another entity then it is called
one to one relationship. For eg:- , a person has only
one passport and a passport is given to one person.
• A hierarchical database model is a data model in that the data are organized
into a tree-like structure. ... The hierarchical database model mandates that
each child record has only 1 parent, whereas every parent record can have
one or a lot of child records.