You are on page 1of 10

DBMS UNIT-1

Data Abstraction - Data Abstraction is a process of hiding unwanted or irrelevant


details from the user. The process helps simplify complex data structures. Data
abstraction has three levels: physical, logical, and view.
Physical or Internal Level
It is the lowest level of abstraction for DBMS which defines how the data is stored. It
defines data-structures to store data and access methods used by the database. It is
decided by developers or database application programmers how to store the data in
the database. For example, if we need to store the details of a student in the university
database. Then the memory used and blocks of storage are not shown to the user.

Logical or Conceptual Level


This level contains the information that is stored in the database in the form of tables.
It also stores the relationship among the data entities in relatively simple structures. At
this level, the information available to the user at the view level is unknown.
We store the data of a student, the columns in the student table will be student_name,
age, magi_id, roll_no etc. We have to define all these at this level while we are creating
the database. The structure of the tables like the student table, teacher table, books
table, etc are defined here in the conceptual level or logical level.

View or External Level


This is the highest level of abstraction. This level exists to ease the accessibility of the
database by user. Users view data in the form of rows and columns. Tables and relations
are used to store data. Multiple views of the same database may exist. Users can just
view the data and interact with the database, storage and implementation details are
hidden from them.
In case of storing customer data,
Physical level – it will contains block of storages (bytes,GB,TB,etc)
Logical level – it will contain the fields and the attributes of data.
View level – it works with CLI or GUI access of database.

1
DBMS UNIT-1

Data Independence - Data Independence is mainly defined as a property of DBMS


that helps you to change the database schema at one level of a system without changing
the schema at the next level.
Physical level data independence: It refers to the characteristic of being able to
modify the physical schema without any changes to the conceptual or logical
schema. It is done for optimization purposes, e.g. Changing from sequential to
random access files.
Logical level data independence: It refers characteristic of being able to modify the
logical schema without affecting the external schema or application program.
The user view of the data would not be affected by any changes to the conceptual view
of the data. These changes may include insertion or deletion of attributes, altering table
structures to the logical schema, etc.

2
DBMS UNIT-1
difference between DDL and DML

DDL DML

1. It stands for Data Definition 1. It stands for Data Manipulation


Language. Language.

2. It is used to create database


2. It is used to add, retrieve or update
schema and can be used to define
the data.
some constraints as well.

3. It basically defines the column 3. It add or updates the row of the


(Attributes) of the table. table. These rows are called tuple.

4. It is further classified
4. It doesn’t have any further
into Procedural and Non-
classification.
Procedural DML.

5. Basic command present in DDL are


5. BASIC command present in DML
CREATE, DROP, RENAME, ALTER
are UPDATE, INSERT, MERGE etc.
etc.

6. DDL does not use WHERE 6. While DML uses WHERE clause in its
clause in its statement. statement.

7. DDL is used to define the 7. DML is used to manipulate the data


structure of a database. within the database.

8. DDL is used to create and modify 8. DML is used to perform operations on


database objects like tables, the data within those database
indexes, views, and constraints. objects.

9. DML statements are frequently


9. DDL statements are executed less
executed to manipulate and query
frequently than DML statements.
data.

3
DBMS UNIT-1

DDL DML

10. DML statements are typically


10. DDL statements are executed
executed by application developers
by database administrators.
or end-users.

11. DDL statements do not


11. DML statements change the
change the contents of the
contents of the database.
database.

What is data models in DBMS?


Data models describe how a database's logical structure is represented. Data models
are essential for introducing abstraction. Data models specify how data is linked to one
another, as well as how it is handled and stored within the system.

1. Relational Data Model: This type of model designs the data in the form of rows
and columns within a table. Thus, a relational model uses tables for representing
data and in-between relationships.

4
DBMS UNIT-1

2. Entity-Relationship Data Model: An


ER model is the logical representation of
data as objects and relationships among
them. These objects are known as
entities, and relationship is an
association among these entities.

3. Object-Oriented Data Model: In the


Object-Oriented Data Model, data and
their relationships are contained in a
single structure which is referred to as an object in this data model. In this, real-
world problems are represented as objects with different attributes. All objects have
multiple relationships between them.

4. Network Model: In network model data is organized like a graph and are allowed
to have more than one parent node. In this database model data is more related as
more relationships are established. Accessing the data is also easier and fast. This
database model was used to map many-to-many data relationships.

5
DBMS UNIT-1

5. Hierarchical Data Model: Hierarchical data model is the oldest type of the data
model. It organizes data in the tree-like structure. It contains nodes which are
connected by branches. The topmost node is called the root node. If there are
multiple nodes appear at the top level, then these can be called as root segments.
Each node has exactly one parent. One parent may have many child.

Difference between Hierarchical, Network and Relational Data Model:


S. Hierarchical Data Network Data
No. Model Model Relational Data Model

1. define define define

It organizes records It organizes records


It organizes records in
2. in the form of tree in the form of
the form of tables.
data structure. directed graphs.

6
DBMS UNIT-1

It implements
It implements 1:1 ,1:n
It implements 1:1 1:1 ,1:n and many
3. and many to many
and 1:n relations. to many
relationships.
relationships.

The logical
Pointers are used to A linked list is used representation is used
establish relationships to establish a with rows and
4.
among records relationship among columns to establish a
physically. records physically. relationship among
records physically.

There is insertion
anomaly in this model
There is no insertion There is no insertion
5. i.e. child node cannot
anomaly. anomaly.
be inserted without
the parent node.

There is deletion
anomaly in this model
There is no deletion There is no deletion
6. i.e. it is difficult to
anomaly. anomaly.
delete the parent
node.

Update leads to
Updating a record is easy
inconsistency
No such problem as and simple with the
problems because of
7. only one instance of process of normalization,
the existence of
records exist. the redundant data gets
multiple instances of
removed.
a child record.

This model has


This model lacks This model has data
8. partial data
data independence. independence.
independence.

7
DBMS UNIT-1

No such facility for No such facility for


SQL-based declarative
9. querying database is querying database is
querying is supported.
supported. supported.

It is used to access It is used to access


It is used to access the
the data which is the data which is
10. data which is complex
complex and complex and
and symmetric.
asymmetric. symmetric.

Difficult to design a
database and
It is easy to comprehend
Difficult to design a manipulate a
due to concealed
11. database because of database because of
physical level details
its complexity. its complexity. Hence,
from end-users.
it imposes a burden
on the programmer.

It is flexible as It is flexible as compared


12. It is less flexible. compared to the to the hierarchical
hierarchical model. model.

Integrity Constraints
• Integrity constraints are a set of rules.
• It is used to maintain the quality of information.
• Integrity constraints ensure that the data insertion, updating, and other processes
must be performed in such a way that data integrity is not affected.
• Integrity constraint is used to guard against accidental damage to the database.
Types of Integrity Constraint

8
DBMS UNIT-1

Domain constraints
• Domain constraints can be
defined as the definition of a
valid set of values for an
attribute.
• The data type of domain
includes string, character,
integer, time, date, currency,
etc. The value of the attribute
must be available in the corresponding domain.
Entity integrity constraints
• The entity integrity constraint states that primary key value can't be null.
• This is because the primary key value is used to identify individual rows in relation
and if the primary key has a null value, then we can't identify those rows.
• A table can contain a null value other than the primary key field.

Referential Integrity Constraints


A referential integrity constraint is specified between two tables.
In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary
Key of Table 2, then every value of the Foreign Key in Table 1 must be null or be
available in Table 2.
9
DBMS UNIT-1

Key constraints
• Keys are the entity set that is used to identify an entity within its entity set
uniquely.
• An entity set can have multiple keys, but out of which one key will be the primary
key. A primary key can contain a unique and null value in the relational table.

10

You might also like