You are on page 1of 32

Levels of Database or Data

Abstraction
Physical level
Physical level or internal level:
The physical level deals with how and where the data is actually
stored.
It also defines where actually data is stored in the disk.
The physical level is the lowest level of database where you can
access how data looks like.
Conceptual level or logical level

• The conceptual level is above the physical level.


• This level defines the overall organization of database. i.e.
it defines the relationship between different fields in the
Database.
View level or External level

• The View level is the highest level of Database.


• At this level the end user gets the data depend on the
queries. The same data can be viewed in multiple ways like
tables, graphs or charts etc.
View of
Data
Data
Models
Data Model is basically a collection of tools for describing
Data & relationships between the Data.

Various Data Models are


Entity-Relationship model
Relational model
Other models:
Object-oriented model
Semi-structured data models
Older models: network model and hierarchical model
Entity Relationship Model
(Cont.)
E-R model of real world
Entity:
An Entity is a thing or an object with a physical existence –
 a particular person, car, house, or employee 
Entities are represented by Rectangles

And a set of all entities is called as an entity set.


Strong entity and weak entity
Components of ER diagram
• Attribute(s):
• Attributes are the properties that define the entity type
• For example, Roll No, Name, DOB, Age, Address, Mobile
No 
•  the attribute is represented by an oval. 
• 1. Key Attribute – 
The attribute which uniquely identifies each entity in the
entity set is called key attribute
• 2. Composite Attribute – 
An attribute composed of many other attribute is called as
composite attribute. For example, Address attribute of
student Entity type consists of Street, City, State, and
Country.
• 3. Multivalued Attribute – 
An attribute consisting more than one value for a given
entity. For example, Phone_No (can be more than one for
a given student). In ER diagram, a multivalued attribute is
represented by a double oval. 
•  Derived Attribute – 
An attribute that can be derived from other attributes of
the entity type is known as a derived attribute. e.g.; Age
(can be derived from DOB). In ER diagram, the derived
attribute is represented by a dashed oval. 
ER DIAGRAM
relationship between two entities
ER diagram
Entity-Relationship
Model
• Relationship Type and Relationship Set: 
• A relationship type represents the association between
entity types
• Degree of a relationship set:
• 1. Unary Relationship – only one entity is in a
relationship

Person Passport
• 2. Binary Relationship –
• TWO entities set participating in a relationship
Cardinality:

• The number of times an entity of an entity set


participates in a relationship set is known as cardinality

• 1. One-to-one 
2. Many to one
3. Many to many
Relational Model in DBMS
• The relational Model was proposed by E.F. Codd to model
data in the form of relations or tables.

• The relational model represents how data is stored in


Relational Databases
• A relational database stores data in the form of relations
(tables).
Conversion of ER diagram to Relational model

• EXAMPLE
Database
Language
Structured Query Language (SQL)

SQL, which is an abbreviation for Structured Query Language, is a


language to request data from a database, to add, update, or remove
data within a database, or to manipulate the metadata of the database.
Data Manipulation Language (DML)
INSERT - Used to create a record.
UPDATE - Used to change certain records.
DELETE - Used to delete certain records.
SELECT - Used to retrieve certain records from one or more
tables
Data Definition Language (DDL)
CREATE - Used to create a new table, a view of a table, or other object
in database.
ALTER - Used to modify an existing database object, such as a table.
DROP - Used to delete an entire table, a view of a table or other object
in the database.

Data Control Language (DCL)


GRANT - Used to give a privilege to someone.
REVOKE - Used to take back privileges granted to someone.

You might also like