0% found this document useful (0 votes)
5 views2 pages

Cheat

Uploaded by

sandeepcse523
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)
5 views2 pages

Cheat

Uploaded by

sandeepcse523
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/ 2

a transaction refers to a logical unit of work that is performed within a Role of Views in DBMS:

database management system against a database. It is an essential concept in


ensuring data integrity and consistency in a multi-user environment where Views in DBMS are virtual tables that provide simplified
multiple transactions may be executed concurrently. access to data by presenting a subset of data from one or
ACID Properties of Transactions:
The ACID properties are the fundamental principles that guarantee the
more underlying tables. They enhance security, simplify
reliability and consistency of transactions within a DBMS. querying, enforce data integrity, optimize performance, and
Atomicity:Atomicity ensures that a transaction is treated as a single, provide logical data independence.
indivisible unit of work. Either all operations within the transaction are Operations on Views Containing Group Functions:
successfully completed and committed to the database, or none of them Views containing group functions (like SUM, COUNT, AVG)
are. typically cannot be updated (inserted, deleted, modified)
Consistency:Consistency ensures that a transaction transforms the because these functions aggregate data across rows.
database from one consistent state to another consistent state. It
Modifying individual rows would affect the aggregated result,
guarantees that all data constraints, rules, and policies are maintained
during the execution of the transaction. leading to inconsistencies. Therefore, DBMS restricts such
Isolation:Isolation ensures that the intermediate state of a transaction is operations on views with group functions to maintain data
invisible to other transactions. Even if multiple transactions are integrity and consistency.
executing concurrently, each transaction should operate as if it is the
only transaction being executed in the system. Normalization:
Durability:Durability guarantees that once a transaction has been committed, Normalization is the process of organizing data in a database to
the changes made by the transaction persist even in the event of system failures reduce redundancy and dependency by dividing large tables into
(like power loss or crashes). The committed changes are stored permanently in smaller tables and defining relationships between them. The main
the database and survive subsequent system failures. goal of normalization is to ensure that each table represents a
Importance of ACID Properties:
single theme or entity and that every piece of data is stored in only
Reliability: ACID properties ensure that transactions are reliable and
one place, thereby minimizing data redundancy and improving data
predictable, regardless of system failures or concurrent access.
integrity.
Data Integrity: They maintain the integrity and consistency of data,
Synthesis Approach:
enforcing rules and constraints defined in the database schema.
Definition: The synthesis approach involves starting with smaller,
Concurrency Control: Isolation ensures that multiple transactions can
less normalized tables and combining them into larger, more
run concurrently without interfering with each other, avoiding issues
normalized tables.
such as dirty reads, non-repeatable reads, and phantom reads.
Process: This approach begins by identifying entities and their
attributes, then creating tables with the minimal set of attributes
The ANSI-SPARC database architecture is the basis of most of the
needed to uniquely identify each entity (1NF). Subsequent normal
modern databases.
forms are achieved by adding attributes and creating relationships
The three levels present in this architecture are Physical level, Conceptual level
and External level.
between tables.
Advantages: It allows for a step-by-step approach to normalization,
beginning with a less strict structure and gradually refining it to
higher normal forms.
Disadvantages: It can sometimes lead to complex structures and
may not always ensure optimal normalization.
Decomposition Approach:
Definition: The decomposition approach involves starting with a
larger, more complex table and breaking it down into smaller, more
normalized tables.
Process: This approach begins with a fully denormalized table and
decomposes it into smaller tables to eliminate redundancy and
The details of these levels are as follows − dependencies. Each decomposition step aims to achieve a higher
Physical Level normal form (like 1NF, 2NF, 3NF, BCNF).
This is the lowest level in the three level architecture. It is also known as the Advantages: It directly addresses redundancy and dependency
internal level. The physical level describes how data is actually stored in the issues in existing tables, resulting in a more optimized database
database. In the lowest level, this data is stored in the external hard drives in structure.
the form of bits and at a little high level, it can be said that the data is stored Disadvantages: It requires careful planning and analysis to ensure
in files and folders. The physical level also discusses compression that all dependencies are properly maintained during the
and encryption techniques.
decomposition process.
Conceptual Level
The conceptual level is at a higher level than the physical level. It is also known
as the logical level. It describes how the database appears to the users Checkpoints in the context of database management systems
conceptually and the relationships between various data tables. The (DBMS) refer to a technique used to ensure that transactions and
conceptual level does not care for how the data in the database is actually database changes are consistently recorded on stable storage
stored. media. Checkpoints play a crucial role in database recovery
External Level mechanisms by establishing known points in time when all the
This is the highest level in the three level architecture and closest to the user. It is transactions up to that point have been properly written to disk.
also known as the view level. The external level only shows the relevant Contribution of Checkpoints to Database Recovery:
database content to the users in the form of views and hides the rest of the data. Consistency and Durability
So different users can see the database as a different view as per their individual Reduced Recovery Time:
requirements. Transaction Rollback and Rollforward:
Deadlock avoidance protocols Data fragmentation refers to the division of data into smaller
Deadlock avoidance protocols are strategies implemented in pieces for storage or processing purposes. This division can
operating systems to prevent the occurrence of deadlocks, which occur in various forms within a database or a file system. The
are situations where two or more processes are unable to proceed
objectives of data fragmentation typically revolve around
because each is waiting for a resource held by another. Unlike
optimizing storage efficiency, improving access speed, and
deadlock detection and recovery strategies that deal with
deadlocks after they occur, avoidance protocols aim to structure enhancing system performance. Here are the main objectives
resource allocation and process scheduling in a way that deadlock of data fragmentation:
can be prevented from happening altogether. 1. Storage Efficiency

Here are some commonly used deadlock avoidance protocols: **Relational


- Optimize useAlgebra:**
of storage space by dividing data into smaller
Relational
fragments. Algebra is a procedural query language used to
Resource Allocation Graph (RAG): query the relational database management systems (RDBMS).
..Processes and resources are represented as nodes and edges in a It provides a theoretical foundation for relational databases
graph, respectively. - Facilitate
and defines dynamic allocation that
a set of operations and efficient use of to
can be applied available
relations
..Use algorithms like Banker's Algorithm to ensure that resources are storage resources.
(tables) to retrieve, modify, and manipulate data.
only allocated if the system remains in a safe state, where there is no
**Utility of Relational Algebra:**
possibility of deadlock.
The utility of Relational Algebra lies in its ability to provide a
Banker's Algorithm:
..Ensures that the system will not enter an unsafe state where deadlock
3. Enhanced
formal Concurrency
framework for expressing database queries. It allows
is possible users and database developers to:
..Techniques such as ensuring that at least one resource is held in a non- - Formulate
4. Optimized queries using
Disk I/O a standardized set of operations.
Operations
preemptible manner, thereby preventing circular wait. - Understand and reason about the behavior of queries in
Dijkstra's Algorithm: terms of set theory.
..This is another algorithm used for deadlock avoidance by ordering **SQL and Relational Algebra:**
resources and processes in a way that avoids circular waits. SQL (Structured Query Language) is the standard language
Priority-based Protocol: 5. Facilitates
used to manage Distribution and Scalability
and manipulate relational databases. SQL is
..Assigning priorities to processes such that a process holding a lower
based on Relational Algebra concepts but is a declarative
priority resource can be preempted by a higher priority process.
language
- Supportrather than procedural.
distribution SQL multiple
of data across abstractsnodes
many ordetails of
Ensures that resources are freed up and allocated to prevent deadlock.
Timeouts and Reclamation: how queries are executed,
servers in distributed systems. focusing instead on what data is
Differentiation between DBMS and RDBMS: desired. Despite these differences, SQL operations such as
DBMS (Database Management System):
Definition: DBMS is a software system that manages and organizes data in
SELECT, PROJECT (SELECT DISTINCT), and JOIN closely
- Enable efficient
correspond data replication
to operations and Algebra.
in Relational fault tolerance
databases.
Structure: It allows users to define, create, and manage databases, but it may
mechanisms.
**Operations in Relational Algebra:**
not necessarily support relationships between tables. 1. **Select (σ)**:
Flexibility: Data is typically stored in files, and DBMS provides mechanisms for
- Select operation is used to retrieve rows from a relation
data retrieval, manipulation, and storage.
Examples: FoxPro, IMS (Information Management System), and older versions (table) that satisfy
6. Supports a given and
Data Privacy condition.
Security
of Microsoft Access. - Example: Consider a relation `Students` with attributes
RDBMS (Relational Database Management System): `StudentID`, `Name`, and `Age`. To select students who are
Definition: RDBMS is a type of DBMS that organizes data into structured tables older than 20 years:
with rows and columns, and enforces relationships using primary keys and
foreign keys.
σ(Age > 20)(Students)
Structure: It uses SQL (Structured Query Language) for querying and
maintaining the database. 2. **Project (π)**:
Flexibility: It supports ACID (Atomicity, Consistency, Isolation, Durability) - Project operation is used to retrieve specific columns
properties, ensuring data reliability and transaction support. (attributes) from a relation, removing duplicates if necessary
Examples: MySQL, PostgreSQL, Oracle Database, SQL Server. (using `π DISTINCT`).
When to use a File-based System over a Database System: - Example: Consider a relation `Courses` with attributes
Small-scale Data: For very small amounts of data that do not require complex
querying or transactions, a simple file system can be easier to implement and `CourseID`, `CourseName`, and `Credits`. To project only
manage. `CourseID` and `CourseName`:
Limited Access: If only one user or a small number of users need to access the
data concurrently and there are no strict requirements for data integrity and π(CourseID, CourseName)(Courses)
security, a file-based system can suffice.
Simple Data Structure: When the data structure is simple and does not 3. **Join (⋈)**:
require complex relationships or constraints that are typical in relational
databases. - Join operation combines tuples from two relations based
Cost and Resources: File-based systems may require fewer resources (like
on a related attribute or condition.
memory and processing power) compared to full-fledged database
management systems, making them more cost-effective for very small
applications.
- Example: Consider two relations `Students` and `Grades`
Performance: In some cases, file systems might provide better performance
for specific types of operations, especially if data access patterns are
predictable and straightforward.

You might also like