5th Lecture (DBMS Model)
5th Lecture (DBMS Model)
Barshan Dev
Lecturer, Dept. of TE, BUFT.
1
Relational model in DBMS
2
Course table: Course table
3
E-R model in DBMS
4
5
E-R diagram with multivalued and derived
attributes:
Multivalued Attributes: An attribute that can hold multiple
values is known as multivalued attribute. We represent it
with double ellipses in an E-R Diagram. E.g. A person can
have more than one phone numbers so the phone
number attribute is multivalued.
6
E-R diagram with multivalued and derived
attributes:
Double Ellipses: Multivalued Attributes
Dashed Ellipses: Derived Attributes
7
Hierarchical model in DBMS
In hierarchical
model, data is
organized into a tree
like structure with
each record is having
one parent record and
many children. The
main drawback of this
model is that, it can
have only one to many
relationships between
nodes.
Sample Hierarchical Model Diagram:
8
Example of hierarchical data represented as
relational tables: The above hierarchical model can be
represented as relational tables like this:
Course Table:
9
DBMS languages
Database languages are used for read, update and store data in a database.
There are several such languages that can be used for this purpose; one of
them is SQL (Structured Query Language).
Data Definition Language (DDL): DDL is used for specifying the database
schema. Let’s take SQL for instance to categorize the statements that comes
under DDL.
To create the database instance – CREATE
To alter the structure of database – ALTER
To drop database instances – DROP
To delete tables in a database instance – TRUNCATE
To rename database instances – RENAME
All these commands specify or update the database schema that’s why they
come under Data Definition language.
10
Data Manipulation Language (DML): DML is used for
accessing and manipulating data in a database.
To read records from table(s) – SELECT
To insert record(s) into the table(s) – INSERT
Update the data in table(s) – UPDATE
Delete all the records from the table – DELETE
11