Fundamentals of DBS - CH - 2
Fundamentals of DBS - CH - 2
1
Chapter 2: Contents
Data Models, Schema and Instances
DBMS Architecture and Data
Independence
Database Language and Interface
The Database System Environment
Classification of DBMS
2
Data models
Data models:- a collection of
concepts/tools used to describe the
structure of a data (data types,
relationships and constraints) in database.
A data model is a notation for describing
data/information and database.
Data Model provides a means to achieve
data abstraction
Data Abstraction refers to the hiding of
certain details of how the data are stored
and maintained.
3
Data models
There are several types of data
models.
Entity–relationship (ER) model
Relational model
Hierarchical model or Network
model
The object-oriented data models.
ER and relational models are popular
and most widely used.
4
Types of Data Model
1. Entity-Relationship (ER) model
It is a High-level Data models that
provide concepts that are close to the
way people perceive data to present the
data.
It use concepts like entities, attributes,
and relationships to represent objects.
5
Entities, Attributes, and Relationships
Entity:-represents real-world objects with
physical or conceptual existence.
(e.g. EMPLOYEE, PROJECT, STUDENT, COURSE)
7
… types of data model
Relational data model…
◦ Data and relationships are represented by a
collection of tables.
◦ Each table has a number of columns with
unique names, e.g. customer, account
8
… types of data model
3. Hierarchical model:
Data is represented by a simple tree
structure.
Record type is referred to as node or segment
The top node is the root node
A parent record can have many child records
but a child record can have only one parent.
The relationship between parent and child is
one-to-many
There are no many-to-many relationships
between records.
9
Hierarchical model:
10
… types of data model
4. Object-Oriented Model:
The database is seen as a collection of
objects;
Objects that have similar properties are
grouped into a class. So, an entity is
represented as a class.
A class has attributes (properties and
behaviour).
Subclasses inherits attributes from the
parent class
Diagram: class name at the top, properties in
the middle, methods at the bottom.
11
… types of data model
4. Object-Oriented Model:
12
Recap Activity
13
Schemas versus Instances
Database Schema
◦ The description of the Structure of a database.
Schema Diagram
◦ An illustrative display of a database schema.
◦ With out data type and relationships
Schema Construct
◦ Each object of the schema , e.g., STUDENT,
COURSE.
14
E.g. Schema diagram for university database
15
Database state(instance)
The actual data in a database may change quite
frequently.
State of database is changed any time we add,
delete or update an item.
Database State /database instance / occurrence
/ snapshot: is the actual data stored in a database at
a particular moment in time.
Every time we insert or delete a record or change
the value of a data item in a record, we change one
state of the database into another state.
For example, the UNIVERSITY database
changes every time we add a new student or enter
a new grade.
16
Example of a database state
17
Database Schema vs. Database State
Distinctions
◦ The database schema changes very
infrequently.
◦ The database state changes every time the
database is updated.
18
Database Languages
Database uses database languages to
create database, manipulate data in
database and control access.
Three languages are used.
Data Definition Language (DDL)
Data Manipulation Language (DML)
Data Control Language (DCL)
19
Database Languages …
1. Data Definition Language (DDL):
For describing data and data structures
Used to define database scheme
Creating and describing the types of entities,
constraints and relationships.
Typical DDL operations in the structured query
language SQL):
Creation of tables and definition of attributes
(CREATE TABLE ...)
Change of tables by adding or deleting attributes
(ALTER TABLE …)
Deletion of whole table including content (!) (DROP
TABLE …) etc
20
Database Languages …
2. Data Manipulation Language (DML):
◦ a language used for manipulation of data like
store, search, read, change, etc
◦ Used for Retrieval, insertion, deletion, and
modification of the data.
Typical DML in the structured query
language SQL:
Add data (INSERT)
Change data (UPDATE)
Delete data (DELETE)
Query data (SELECT) Etc….
21
Database Languages …
3. Data Control Language (DCL):
◦ A Data Control Language (DCL) is a DB
language used to control access to data in a
database.
◦ Set of commands that generally control
permissions on the data, such as defining access
rights.
Typical DCL commands include:
◦ GRANT used to allow specified users to
perform specified tasks.
◦ REVOKE used to cancel previously granted
access right or denied permissions
22
Database Interface
Menu-Based Interface:
This interfaces present the user with lists of
options, called menus that lead the user through
the formulation of a request.
Pull-down menus are becoming a very popular
technique in window-based user interfaces.
Forms-Based Interface:
Displays a form to each user.
Users fill out all of the form entries to insert new
data, or they fill out only certain entries, in which
case the DBMS will retrieve matching data for the
remaining entries.
Forms are usually designed and programmed for
naive users as interfaces to canned transactions.
23
Database Interface…
Graphical User Interfaces:
Displays a schema to the user in diagrammatic
form. The user can then specify a query by
manipulating the diagram/icons.
GUIs utilize both menus and forms.
Most GUIs use a pointing device, such as a
mouse, to pick certain parts of the displayed
schema diagram.
Natural Language Interfaces:
These interfaces accept requests written in English
or some other language and attempt to
"understand" them.
They refer to words in its schema and set of
standard words to interpret the request.
24
Database Interface…
Interfaces for Parametric Users:
Parametric(naïve users) users, such as bank tellers,
often have a small set of operations that they must
perform repeatedly.
Systems analysts and programmers design and
implement a special interface for a known class of
naive users.
Interfaces for the DBA:
Most database systems contain privileged
commands that can be used only by the DBA’s staff.
These include commands for creating accounts,
setting system parameters, granting account
authorization, changing a schema, and
reorganizing the storage structures of a database.
25
I thank you!!!
26
Assignment
Preparebrief notes on the following
database concepts:
Level of Abstraction and view level
Database Architectures
Data Independence
Types of DBMS
27
Quiz 5%
1. What is data model? (1pt)
2. List and explain at least two data
models. (2pts)
3. Differentiate database schema
and database instance (2pts)
28