DBMS Unit 1
DBMS Unit 1
DBMS
Data models refers to how the logical structure of a database is made. Data
model acts as a conceptual tool that describes the data relationship, data
semantics and data constraints. Database uses three tier architecture so we need
to design the database at physical, logical and view level.
Categories of data model are −
In this model, the data is designed in form of rows and column within a table.
The tables are then going to establish the relationship among the data. Tables
are referred as relations because the relationship among the table or data is
going to be stored in relation only. It is also referred as a record-based model
and is most widely used data model. This model was initially described by
Edgar F. Codd, in 1969.
It deals with the specification of data. i.e. individual data items of the same type
may have different sets of attributes. This data model is mainly used for
transferring the data among the applications. The language that supports is
XML(Extensible Markup Language).
Schema
It implies the rules that govern the database and define schema with tables,
view, relationship and integrity constraints.
Data gets stored within disk storage i.e. this schema refers to actual storage of
data.
Instance
The general structure and parts of a database system are described by the
database system architecture. It includes the following essential elements −
User Interface − Users can communicate with the database system using
the user interface. It could take the form of a web-based interface, a GUI,
or a command-line interface. Users may submit queries, enter data, and
see query results or reports via the user interface.
A web-based e-commerce program, for instance, may offer a user
interface that enables users to look for items, make orders, and check
their order histories.
Query Processor − The query processor executes and optimizes SQL
queries after receiving them from users or applications. In order to get the
required data and carry out any necessary activities, it analyses the query,
chooses the most effective execution plan and communicates with other
components. In order to reduce resource consumption and boost speed,
the query processor makes sure that queries are processed as effectively
as possible.
Storage Manager − Managing the actual physical storage of data on
discs or other storage media is the responsibility of the storage manager.
To read and write data, it communicates with the file system or storage
subsystem. To facilitate data access and guarantee data integrity, the
storage manager manages data archiving, retrieval .
For instance, the storage manager oversees the allocation of disc space to
guarantee effective storage when a new order is placed in the e-commerce
application. It also saves the order details in the relevant tables.
Buffer Manager − Data transfer between memory and disc storage is
controlled by the buffer manager, an important component. It reduces
disc I/O operations and boosts efficiency by using a buffer cache to keep
frequently used data pages in memory. The buffer manager makes sure
that data caching and replacement procedures are effective in order to
maximize memory consumption.
For instance, when a query is run that needs to access data from the disc,
the buffer manager pulls the necessary data pages into the buffer cache
from the disc. The need for disc access can be avoided by serving
subsequent requests that access the same data from memory.
Transactions Manager − Database transactions' atomicity, consistency,
isolation, and durability are all guaranteed by the transaction manager. To
maintain data integrity and concurrency management, it maintains
concurrent access to the data, takes care of transaction execution, and
enforces transaction isolation levels.
For instance, the transaction manager makes sure that each order is
executed as a separate transaction when several clients place orders at
once, ensuring data integrity and avoiding conflicts.
Data Dictionary − The metadata regarding the database schema and
objects are stored in the data dictionary, sometimes referred to as the
metadata repository. It includes details on various database structures,
including tables, columns, data types, constraints, indexes, and more. The
DBMS uses the data dictionary to verify queries, uphold data integrity,
and offer details on the database structure
For instance, the data dictionary keeps tabs on the names, columns, data
types, and constraints of the tables in the e-commerce application.
Concurrency Control − Multiple transactions can access and edit the
database simultaneously without resulting in inconsistent data thanks to
concurrency control methods. To regulate concurrent access and preserve
data integrity, methods including locking, timestamp ordering, and multi-
version concurrency control (MVCC) are utilized.
Concurrency control measures, for instance, make sure that two
consumers updating their profiles in the same e-commerce application at
the same time are serialized and applied appropriately to maintain data
consistency.
Backup and recovery − In order to safeguard against data loss and
guarantee data availability, database systems must have backup and
recovery processes. In the case of system failures or data corruption,
recovery procedures are employed to restore the database to a consistent
condition. Regular backups are performed to create copies of the
database.
To guarantee that data can be restored in the event of hardware problems
or unintentional data loss, for instance, frequent backups of the e-
commerce database are made.
ER Model in DBMS
In Database Management Systems (DBMS), an Entity-Relationship (ER) model is
a conceptual data model used to represent the entities, their attributes, and
the relationships among them within a database. The ER model employs a
visual representation to describe the logical structure of a database in a clear
and understandable manner.
Components of the ER Model:
1. Entities:
Represent real-world objects or concepts that have attributes. For
instance, in a university database, entities might include Student,
Course, Teacher, etc.
2. Attributes:
Characteristics or properties of entities. For example, a Student
entity may have attributes like StudentID, Name, Age, etc.
3. Relationships:
Associations between entities indicating how they are related to
each other. Relationships can be one-to-one, one-to-many, or
many-to-many.
Key Elements in ER Modeling:
1. Entity:
Represented by rectangles in the ER diagram, containing the name
of the entity. Each entity has attributes that describe it.
2. Attributes:
Represented within ovals or ellipses connected to the respective
entities. They describe the properties of the entities.
3. Relationships:
Depicted by diamond shapes connecting related entities. The lines
between entities represent relationships, and the diamond shape
denotes the relationship type.
4. Cardinality and Multiplicity:
Cardinality defines the number of occurrences of an entity
participating in a relationship (e.g., one-to-one, one-to-many,
many-to-many).
Multiplicity specifies the exact number of instances in a
relationship.
Example of an ER Diagram:
Consider a simple ER diagram for a university database:
+------------+ +--------------+
| Student | 1 * | Course |
+------------+-------------+--------------+
| Student_ID | | Course_Code|
| Name | | Title |
| Age | | Credits |
+------------+ +--------------+