0% found this document useful (0 votes)
31 views30 pages

ppt2 Unit1

Data Models in DBMS

Uploaded by

mahe13881
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views30 pages

ppt2 Unit1

Data Models in DBMS

Uploaded by

mahe13881
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Data Models

Outlines
What is Data Model
Category of Database Model
Types of Data Models
• Hierarchical Model
• Network Model
• Relational Model
• Entity-relationship Model
• Object oriented Data Model
Outcomes
Understand the basics of data model.
Learn the categories of data model.
Learn the basic types of data models.
What is Data Model
Data models define how the logical structure of
a database is modeled. Data Models are
fundamental entities to introduce abstraction in
a DBMS. Data models define how data is
connected to each other and how they are
processed and stored inside the system.
Category of Database Model
Logical Database Model
Logical database modeling is required for compiling business requirements and
representing the requirements as a model. It is mainly associated with the gathering of
business needs rather than the database design. The information that needs to be
gathered is about organizational units, business entities, and business processes.
ERD–Entity relationship diagram shows the relationship between different categories
of data and shows the different categories of data required for the development of a
database.

Physical Database Model


Physical database modeling deals with designing the actual database based on the
requirements gathered during logical database modeling. All the information gathered is
converted into relational models and business models. During physical modeling, objects
are defined at a level called a schema level. A schema is considered a group of objects
which are related to each other in a database.
Tables and columns are made according to the information provided during logical
modeling. Primary keys, unique keys, and foreign keys are defined in order to provide
constraints.
Types of Data Models
A Database model defines the logical design and structure of a database and
defines how data will be stored, accessed and updated in a database
management system. While the Relational Model is the most widely used
database model, there are other models too:
• Hierarchical Model
• Network Model
• Relational Model
• Entity-relationship Model
• Object oriented Data Model
Hierarchical Model
• This database model organizes data into a tree-like-structure, with a single root, to which
all the other data is linked. The hierarchy starts from the Root data, and expands like a
tree, adding child nodes to the parent nodes.
• In this model, a child node will only have a single parent node.
• This model efficiently describes many real-world relationships like index of a book, recipes
etc.
• In hierarchical model, data is organized into tree-like structure with one one-to-many
relationship between two different types of data, for example, one department can have
many courses, many professors and of-course many students.
Network Model
•This is an extension of the Hierarchical model. In this model data is organised more 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 in this
database model. Also, as the data is more related, hence accessing the data is also
easier and fast. This database model was used to map many-to-many data relationships.
•This was the most widely used database model, before Relational Model was
introduced.
Relational Model
• In this model, data is organised in two-dimensional tables and the relationship is
maintained by storing a common field.
• This model was introduced by E.F Codd in 1970, and since then it has been the most
widely used database model, infact, we can say the only database model used
around the world.
• The basic structure of data in the relational model is tables. All the information related
to a particular type is stored in rows of that table.
• Hence, tables are also known as relations in relational model.
Entity-relationship Model
• In this database model, relationships are created by dividing object of interest into
entity and its characteristics into attributes.
• Different entities are related using relationships.
• E-R Models are defined to represent the relationships into pictorial form to make it
easier for different stakeholders to understand.
• This model is good to design a database, which can then be turned into tables in
relational model(explained below).
• Let's take an example, If we have to design a School Database, then Student will
be an entity with attributes name, age, address etc. As Address is generally
complex, it can be another entity with attributes street name, pincode, city etc,
and there will be a relationship between them.
Object oriented Data Model
• Object oriented data model is one of the developed data model and this can hold the
audio, video and graphic files. These consist of data piece and the methods which
are the DBMS instructions.
Data Models: A Summary
(continued)
DBMS Architecture
• The DBMS design depends upon its architecture. The basic client/server
architecture is used to deal with a large number of PCs, web servers,
database servers and other components that are connected with networks.
• The client/server architecture consists of many PCs and a workstation
which are connected via the network.
• DBMS architecture depends upon how users are connected to the database
to get their request done.
1-Tier Architecture
• In this architecture, the database is directly available to the user. It means
the user can directly sit on the DBMS and uses it.
• Any changes done here will directly be done on the database itself. It
doesn't provide a handy tool for end users.
• The 1-Tier architecture is used for development of the local application,
where programmers can directly communicate with the database for the
quick response.
2-Tier Architecture
• The 2-Tier architecture is same as basic client-server. In the two-tier
architecture, applications on the client end can directly communicate with
the database at the server side. For this interaction, API's
like: ODBC, JDBC are used.
• The user interfaces and application programs are run on the client-side.
• The server side is responsible to provide the functionalities like: query
processing and transaction management.
• To communicate with the DBMS, client-side application establishes a
connection with the server side.
3-Tier Architecture
• The 3-Tier architecture contains another layer between the client and server. In
this architecture, client can't directly communicate with the server.
• The application on the client-end interacts with an application server which
further communicates with the database system.
• End user has no idea about the existence of the database beyond the
application server. The database also has no idea about any other user beyond
the application.
• The 3-Tier architecture is used in case of large web application.
Structure of a DBMS
• A database system is partitioned into modules that deal with each of the
responsibilities of the overall system. The functional components of a database
system can be broadly divided into the storage manager and the query
processor components. The storage manager is important because databases
typically require a large amount of storage space. The query processor is important
because it helps the database system simplify and facilitate access to data.
• It is the job of the database system to translate updates and queries written in a
nonprocedural language, at the logical level, into an efficient sequence of operations
at the physical level.
Query Processor
• The query processor components include
• DDL interpreter, which interprets DDL statements and records the definitions in the
data dictionary.
• DML compiler, which translates DML statements in a query language into an
evaluation plan consisting of low-level instructions that the query evaluation engine
understands.
• A query can usually be translated into any of a number of alternative evaluation plans
that all give the same result. The DML compiler also performs query optimization,
that is, it picks the lowest cost evaluation plan from among the alternatives.
• Query evaluation engine, which executes low-level instructions generated by the
DML compiler.
Storage Manager
• A storage manager is a program module that provides the interface between the low level
data stored in the database and the application programs and queries submitted to the
system. The storage manager is responsible for the interaction with the file manager. The
raw data are stored on the disk using the file system, which is usually provided by a
conventional operating system. The storage manager translates the various DML
statements into low-level file-system commands. Thus, the storage manager is responsible
for storing, retrieving, and updating data in the database.
The storage manager components include:
Authorization and integrity manager, which tests for the satisfaction of integrity constraints
and checks the authority of users to access data.
Transaction manager, which ensures that the database remains in a consistent (correct)
state despite system failures, and that concurrent transaction executions proceed without
conflicting.
• File manager, which manages the allocation of space on disk storage and the data
structures used to represent information stored on disk.
• Buffer manager, which is responsible for fetching data from disk storage into main
memory, and deciding what data to cache in main memory. The buffer manager is a critical
part of the database system, since it enables the database to handle data sizes that are
much larger than the size of main memory.
Transaction Manager
A transaction is a collection of operations that performs a single logical function in a
database application. Each transaction is a unit of both atomicity and consistency. Thus,
we require that transactions do not violate any database-consistency constraints. That is, if
the database was consistent when a transaction started, the database must be consistent
when the transaction successfully terminates. Transaction - manager ensures that the
database remains in a consistent (correct) state despite system failures (e.g., power
failures and operating system crashes) and transaction failures.
Schema and Instance
• The data which is stored in the database at a particular moment of time is called an
instance of the database.
• The overall design of a database is called schema.
• A database schema is the skeleton structure of the database. It represents the logical
view of the entire database.
• A schema contains schema objects like table, foreign key, primary key, views,
columns, data types, stored procedure, etc.
• A database schema can be represented by using the visual diagram. That diagram
shows the database objects and relationship with each other.
Data Independence
• Data independence can be explained using the three-schema architecture.
• Data independence refers characteristic of being able to modify the schema at one
level of the database system without altering the schema at the next higher level.
There are two types of data independence:
1. Logical Data Independence
• Logical data independence refers characteristic of being able to change the
conceptual schema without having to change the external schema.
• Logical data independence is used to separate the external level from the conceptual
view.
• If we do any changes in the conceptual view of the data, then the user view of the
data would not be affected.
• Logical data independence occurs at the user interface level.
2. Physical Data Independence
• Physical data independence can be defined as the capacity to change the internal
schema without having to change the conceptual schema.
• If we do any changes in the storage size of the database system server, then the
Conceptual structure of the database will not be affected.
• Physical data independence is used to separate conceptual levels from the internal
levels.
• Physical data independence occurs at the logical interface level.
Database Language

• A DBMS has appropriate languages and


interfaces to express database queries
and updates.
• Database languages can be used to read,
store and update the data in the database.
Types of Database Language
1. Data Definition Language
• DDL stands for Data Definition Language. It is used to define database structure or
pattern.
• It is used to create schema, tables, indexes, constraints, etc. in the database.
• Using the DDL statements, you can create the skeleton of the database.
• Data definition language is used to store the information of metadata like the number
of tables and schemas, their names, indexes, columns in each table, constraints, etc.
Here are some tasks that come under DDL:
• Create: It is used to create objects in the database.
• Alter: It is used to alter the structure of the database.
• Drop: It is used to delete objects from the database.
• Truncate: It is used to remove all records from a table.
• Rename: It is used to rename an object.
These commands are used to update the database schema that's why they come under
Data definition language.
2.Data Manipulation Language
• DML stands for Data Manipulation Language. It is used for accessing and
manipulating data in a database. It handles user requests.
Here are some tasks that come under DML:
• Select: It is used to retrieve data from a database.
• Insert: It is used to insert data into a table.
• Update: It is used to update existing data within a table.
• Delete: It is used to delete all records from a table.
3. Data Control Language
• DCL stands for Data Control Language. It is used to retrieve the stored or saved
data.
• The DCL execution is transactional. It also has rollback parameters.
• (But in Oracle database, the execution of data control language does not have the
feature of rolling back.)
Here are some tasks that come under DCL:
• Grant: It is used to give user access privileges to a database.
• Revoke: It is used to take back permissions from the user.
There are the following operations which have the authorization of Revoke:
• CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.
4. Transaction Control Language
• TCL is used to run the changes made by the DML statement. TCL can be grouped
into a logical transaction.
Here are some tasks that come under TCL:
• Commit: It is used to save the transaction on the database.
• Rollback: It is used to restore the database to original since the last Commit.
DBMS Interfaces
A database management system (DBMS) interface is a user interface which
allows for the ability to input queries to a database without using the query
language itself.
1. Menu-Based Interfaces for Web Clients or Browsing –
These interfaces present the user with lists of options (called menus) that
lead the user through the formation of a request. Basic advantage of using
menus is that they removes the tension of remembering specific commands
and syntax of any query language, rather than query is basically composed
step by step by collecting or picking options from a menu that is basically
shown by the system.
2. Forms-Based Interfaces –
A forms-based interface displays a form to each user. Users can fill out all
of the form entries to insert a new data, or they can fill out only certain
entries, in which case the DBMS will redeem same type of data for other
remaining entries. This type of forms are usually designed or created and
programmed for the users that have no expertise in operating system. Many
DBMSs have forms specification languages which are special languages
that help specify such forms.
3. Graphical User Interface –
A GUI typically displays a schema to the user in diagrammatic form.The user then can
specify a query by manipulating the diagram. In many cases, GUI’s utilize both menus
and forms. Most GUIs use a pointing device such as mouse, to pick certain part of the
displayed schema diagram.

4. Natural language Interfaces –


These interfaces accept request written in English or some other language and attempt to
understand them. A Natural language interface has its own schema, which is similar to
the database conceptual schema as well as a dictionary of important words.

5. Speech Input and Output –


There is an limited use of speech say it for a query or an answer to a question or being a
result of a request it is becoming commonplace Applications with limited vocabularies
such as inquiries for telephone directory, flight arrival/departure, and bank account
information are allowed speech for input and output to enable ordinary folks to access
this information.

You might also like