Technical Questions Based On Database Management System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Technical Questions based on Database Management System

• What is Database?
A database is an organized collection of structured information, or data, typically stored
electronically in a computer system. A database is usually controlled by a database
management system (DBMS). Together, the data and the DBMS, along with the
applications that are associated with them, are referred to as a database system, often
shortened to just database.

• What is DBMS?
Database Management Systems (DBMS) are software systems used to store, retrieve,
and run queries on data. A DBMS serves as an interface between an end-user and a
database, allowing users to create, read, update, and delete data in the database.

• What is a Database system?

A Database System is a combination of a database and a database management system


(DBMS) working together to provide an organized and efficient way to store, retrieve,
and manage data. It encompasses both the structure of the database, which defines how
the data is organized and related, and the software that allows users and applications to
interact with and manipulate that data.

• Explain the advantages of DBMS?


In short, the advantages of a Database Management System (DBMS) include:

1. **Data Integrity:** Ensures accuracy and consistency.


2. **Data Security:** Provides controlled access and user permissions.
3. **Data Independence:** Allows changes without affecting applications.
4. Concurrent Access and Transaction Control: Manages multiple users and ensures
data consistency.
5. Data Redundancy and Consistency: Minimizes redundancy, maintains uniformity.
6. Query Language and Reporting: Simplifies data retrieval and reporting tasks.
7. Data Backup and Recovery: Facilitates regular backups and system recovery.
8. Data Centralization: Centralizes storage for improved management.
9. Scalability: Handles large amounts of data and can scale with growth.
10. Efficient Data Retrieval and Performance Optimization: Optimizes data access for
better system performance.
11. Data Modeling and Database Design: Supports the design of complex data models.

• Explain the disadvantages of the File Processing System?


The disadvantages of File Processing Systems (FPS) include:

1. **Data Redundancy:** Duplicated data in multiple files.


2. **Data Inconsistency:** Changes in one file may not be reflected in others.
3. **Data Dependence:** Programs are highly dependent on file structures.
4. **Limited Data Sharing:** Challenges in sharing data between applications.
5. Program-Data Dependence:** Programs are tied to specific data formats.
6. Lack of Data Integrity: No centralized control for ensuring data accuracy.
7. Security Issues: Lack of robust security features.
8. Limited Concurrent Access: Difficulty in managing simultaneous data access.
9. Poor Data Retrieval: Inefficient data retrieval, lacking query language.
10. Difficult Data Maintenance: Labor-intensive updates and modifications.
11. Lack of Data Relationships: Challenges in establishing and maintaining data
relationships.

• Mention and describe the three levels of data abstraction?


In short, the three levels of data abstraction are:
1. Physical Level:
- Describes how data is physically stored and accessed at the hardware level.
2. Logical Level:
- Defines the logical structure of the database, including entities, attributes, and
relationships, without detailing physical storage details.
3. View Level (External Level):
- Represents the user interface, providing customized views of the data for specific
user needs without revealing the full database complexity.

• Define the "integrity rules"?


• Integrity rules are needed to inform the DBMS about certain constraints in the
real world.
• Specific integrity rules apply to one specific databas
• What is extension and intension?
Extension: It is the number of tuples present in a table at any instance. This is time dependent.

Intension: It is a constant value that gives the name, structure of table and the constraints laid

on it.

• What is System R? What are its two major subsystems?


It is a prototype and its purpose was to demonstrate that it is possible to build a
Relational System that can be used in a real life environment to solve real life
problems, with performance at least comparable to that of existing system. Its two
subsystems are: 1. Research Storage 2. System Relational Data System.

• How is the data structure of relational structure different from System R?


Relational systems in System R
1. Domains are not supported
2. Enforcement of candidate key uniqueness is optional
3. Enforcement of entity integrity is optional
4. Referential integrity is not enforced.

• Explain 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.
1. Logical Data Independence:
- Changes in conceptual schema don't affect external schema.
- Occurs at the user interface level.
2. Physical Data Independence:
- Changes in internal schema don't affect conceptual schema.
- Occurs at the logical interface level.
• What is a view? Explain its relation with data independence?
A "view" in the realm of databases is essentially a virtual table derived from the result
of a SELECT query. Unlike physical tables, views don't store the data themselves;
rather, they offer a dynamic and abstracted representation of data from one or more
underlying tables. Views serve various purposes, including simplifying complex queries,
encapsulating intricate logic, and enhancing security by restricting access to specific
data subsets.

The relation between views and data independence is twofold. Firstly, views contribute
to logical data independence by allowing users to interact with data in a higher-level
manner, shielding them from the complexities of changes in the underlying table
structures. If alterations occur, such as adding or removing columns, the view definition
can be adjusted without affecting user interactions.

Secondly, views support physical data independence by providing a layer of abstraction


between users and the actual storage of data. Changes to the physical storage—such as
reorganization or migration to a different storage system—can be implemented without
disrupting applications using the views. As long as the view definition remains intact,
applications can seamlessly access the data, showcasing the role of views in ensuring
both logical and physical data independence in database management.

• What is a Data Model?


A data model determines the structure of data elements within an information system.
A data model documents the relationships between data elements and how data is
retrieved and stored. Data models often display the flow of data through a graph or
data model diagram.

• What is an E-R model?


An Entity–relationship model (ER model) describes the structure of a database with the
help of a diagram, which is known as Entity Relationship Diagram (ER Diagram). An
ER model is a design or blueprint of a database that can later be implemented as a
database.
• What is Object Oriented model?
The Object-Oriented Model in DBMS or OODM is the data model where data is stored
in the form of objects. This model is used to represent real-world entities. The data and
data relationship is stored together in a single entity known as an object in the Object
Oriented Model.

• What is an Entity?
An "entity" in the context of databases is a distinct object or concept about which data
is stored. It serves as a fundamental building block in database modeling, represented
as a table with rows for specific instances and columns for attributes. Entities help
organize and structure data in a relational database, defining the types of information
that can be stored and their relationships with other entities.

• What is an Entity type?


The entity type is the fundamental building block for describing the structure of data
with the Entity Data Model (EDM). In a conceptual model, an entity type represents the
structure of top-level concepts, such as customers or orders.

• What is an Entity set?


An entity set is a logical container for instances of an entity type and instances of any
type derived from that entity type.

• What is an Extension of entity type?


The entity set that consists of a collection of entities of a particular entity type is
referred as extension of the entity type.

• What is Weak Entity set?


The entity sets which do not have sufficient attributes to form a primary key are known
as weak entity sets and the entity sets which have a primary key are known as strong
entity sets.

• What is an attribute?
In DBMS, we have entities, and each entity contains some property about their behavior
which is also called the attribute.
• What is a Relation Schema and a Relation?
In the context of databases, a "relation schema" refers to the blueprint or structure that
defines the design of a relational database table. It outlines the attributes or fields that
make up the table, along with their data types and any constraints. The relation schema
provides a high-level description of the table's organization and serves as a guide for
creating instances of the table.

A "relation," on the other hand, is the actual table or set of tuples (rows) that conform
to the specified relation schema. Each tuple in the relation represents a specific record
or instance, and each attribute within the tuple corresponds to a field defined in the
relation schema. In simpler terms, a relation is an instance of the relation schema,
containing actual data organized in a tabular format.

• What is Relationship?
A "relationship" in databases refers to the association between different entities. It
describes how data in one entity is connected to data in another. Relationships are
essential for structuring databases and come in types like one-to-one, one-to-many,
many-to-one, and many-to-many, each defining the connection patterns between
records in different tables. Keys, such as primary and foreign keys, are used to establish
and maintain these relationships, promoting data integrity and efficient data retrieval.

• What is Relationship set?


A "relationship set" in databases refers to a set of relationships of the same type
between entities. It represents a collection of relationships, each involving entities from
specified entity sets. The relationship set captures the connections or associations
between instances of these entities.

• What is Relationship type?


A Relationship Type is a type of association that can exist between two different (or
same) entity types.
• What is degree of Relationship type?
The degree of relationship can be defined as the number of occurrences in one entity
that is associated with the number of occurrences in another entity. There is the three
degree of relationship: One-to-one (1:1) One-to-many (1:M) Many-to-many (M:N).

• What is DDL (Data Definition Language)?


Data Definition Language (DDL) is used to create and modify the structure of objects in
a database using predefined commands and a specific syntax. These database objects
include tables, sequences, locations, aliases, schemas and indexes.

• What is VDL (View Definition Language)?


The View Definition Language (VDL) is a markup language designed to allow views to
be authored using an XML notation. Markup tags are provided to define basic page
structure and to incorporate and configure components such as tables and forms.

• What is SDL (Storage Definition Language)?


Storage definition languages (SDL) are used to define the physical storage structure of a
database. They are used to specify the internal schema of the database, including the
layout of the data on disk, the size of the data, and the type of data. They are not used to
insert, delete, or update data.

• What is Data Storage - Definition Language?


There are many different technologies used to store data, with new methods being
created all the time. Some store data temporarily, and some for long periods of time.
Many stay inside a computer or device, while others are portable and can be used on
different devices or kept in other locations.

• What is DML (Data Manipulation Language)?


A data manipulation language (DML) is a family of computer languages including
commands permitting users to manipulate data in a database. This manipulation
involves inserting data into database tables, retrieving existing data, deleting data from
existing tables and modifying existing data. DML is mostly incorporated in SQL
databases.
• What is DML Compiler?
DML compiler translates DML statements in a query language into a low-level
instruction and the generated instruction can be understood by Query Evaluation
Engine.

• What is Query evaluation engine?


The query evaluation plan is also referred to as the query execution plan. A query
execution engine is responsible for generating the output of the given query. It takes the
query execution plan, executes it, and finally makes the output for the user query.

• What is DDL Interpreter?


It interprets the DDL (Data Definition Language) Instructions and stores the record in
a data dictionary.

• What is Record-at-a-time?
Record-at-a-time, also known as row-at-a-time, refers to a database processing
technique that retrieves or processes one record (row) at a time. In other words, the
database engine fetches each row individually and processes it before moving on to the
next row.

• What is Set-at-a-time or Set-oriented?


The High level or Non-procedural DML can specify and retrieve many records in a
single DML statement. This retrieve of a record is said to be Set-at-a-time or Set-
oriented.

• What is Relational Algebra?


Relational algebra refers to a procedural query language that takes relation instances as
input and returns relation instances as output. It performs queries with the help of
operators. A binary or unary operator can be used. They take in relations as input and
produce relations as output.

• What is Relational Calculus?


Relational calculus is a non-procedural query language. In the non-procedural query
language, the user is concerned with the details of how to obtain the end results.
• How does Tuple-oriented relational calculus differ from domain-oriented relational calculus?
Relational calculus is a non-procedural query language. In the non-procedural query
language, the user is concerned with the details of how to obtain the end results.

• What is normalization?
Normalization is the process of organizing data in a database. It includes creating tables
and establishing relationships between those tables according to rules designed both to
protect the data and to make the database more flexible by eliminating redundancy and
inconsistent dependency.

• What is Functional Dependency?


The functional dependency is a relationship that exists between two attributes. It
typically exists between the primary key and non-key attribute within a table.
X → Y
The left side of FD is known as a determinant, the right side of the production is known
as a dependent.

• Explain Lossless join property?


Lossless-join decomposition is a process in which a relation is decomposed into two or
more relations. This property guarantees that the extra or less tuple generation problem
does not occur and no information is lost from the original relation during the
decomposition.

• What is 1 NF (Normal Form)?


• A relation will be 1NF if it contains an atomic value.
• It states that an attribute of a table cannot hold multiple values. It must hold
only single-valued attribute.
• First normal form disallows the multi-valued attribute, composite attribute, and
their combinations.

• Explain Fully Functional dependency?


A full functional dependency is a functional dependency where the dependent attributes
are determined by the determinant attributes.
• What is 2NF?
2NF is a fundamental concept of database normalization that helps remove partial
dependencies in your relational database.

• What is 3NF?
A relation is in the third normal form, if there is no transitive dependency for non-
prime attributes as well as it is in the second normal form.

• What is BCNF (Boyce-Codd Normal Form)?


• BCNF is the advance version of 3NF. It is stricter than 3NF.
• A table is in BCNF if every functional dependency X → Y, X is the super key of
the table.
• For BCNF, the table should be in 3NF, and for every FD, LHS is super key.

• What is 4NF?
• A relation will be in 4NF if it is in Boyce Codd normal form and has no multi-
valued dependency.
• For a dependency A → B, if for a single value of A, multiple values of B exists,
then the relation will be a multi-valued dependency.

• What is 5NF?
• A relation is in 5NF if it is in 4NF and not contains any join dependency and
joining should be lossless.
• 5NF is satisfied when all the tables are broken into as many tables as possible in
order to avoid redundancy.
• 5NF is also known as Project-join normal form (PJ/NF).

• What is Domain-Key Normal Form?


Domain-key normal form (DK/NF or DKNF) is a normal form used in database
normalization which requires that the database contains no constraints other than
domain constraints and key constraints.
• What are partial, alternate, artificial, compound and natural keys?
In database design:
1. Primary Key: Uniquely identifies records within a table.
2. Foreign Key: Links tables by referencing the primary key of another table.
3. Composite Key: Uses a combination of columns to uniquely identify records.
4. Natural Key: Derives from inherent data characteristics, providing meaning.
5. Surrogate Key (Artificial Key): System-assigned identifier without inherent meaning.
6. Alternate Key: Candidate key not chosen as the primary key.
7. Partial Key: Set of attributes forming part of a candidate key but not unique on its
own.
These keys play vital roles in ensuring data uniqueness, integrity, and relationships in a
database.

• What is indexing? What are the different kinds of indexing?


Indexing in databases is a technique to enhance data retrieval efficiency. Different kinds
of indexing include:
1. Single-Level Index: Basic mapping of key values to record locations.
2. Multi-Level Index: Hierarchical indexing structure for faster data access.
3. Clustered Index: Determines physical data order based on the indexed column.
4. Non-Clustered Index: Separately stores index structure pointing to data locations.
5. Unique Index: Ensures uniqueness in indexed column(s), preventing duplicates.
6. Composite Index: Indexing on multiple columns for queries involving multiple
conditions.
7. Covering Index: Includes all columns required by a query to avoid accessing the
actual data.
8. Bitmap Index: Uses bitmap vectors for efficient indexing of low-cardinality columns.
Choosing the appropriate index type depends on data characteristics and the types of
queries to be optimized.

• What is system catalog or catalog relation? What is it better known as?


The "system catalog" or "catalog relation" is better known as the "data dictionary." It
is a crucial component of a database system, storing metadata about the database
structure, including tables, columns, indexes, and constraints. The data dictionary used
by the database management system to manage and organize the database effectively.
• Explain query optimization.
Query optimization is of great importance for the performance of a relational database,
especially for the execution of complex SQL statements. A query optimizer decides the
best methods for implementing each query.

• What does durability in DBMS mean?


Durability in databases is the property that ensures transactions are saved
permanently and do not accidentally disappear or get erased, even during a database
crash. This is usually achieved by saving all transactions to a non-volatile storage
medium.
Durability is part of the ACID acronym, which stands for atomicity, consistency,
isolation and durability. ACID is a set of properties guaranteeing the reliability of all
database transactions.

• What do you mean by: atomicity and aggregation?


Atomicity is the condition where either all the actions of the transaction are performed
or none. So, this means that, when there is an incomplete transaction, the database
management system itself will undo the effects done by the incomplete transaction.

Aggregation is the concept of expressing the relationship with the collection of entities
and their relationships.

• Explain Phantom Deadlock?


Phantom deadlocks arise when these logical dependencies cause processes to wait
indefinitely even if there is no blocking of resources as seen in deadlocks. It is crucial to
identify these patterns using techniques such as the WFG (Wait for Graph) to
understand and address deadlocks effectively in distributed systems.

• What is a checkpoint? When does it occur?


A checkpoint is one of several points in the eukaryotic cell cycle at which the progression of
a cell to the next stage in the cycle can be halted until conditions are favourable.
• Write the begin_checkpoint record into a log.
• Collect checkpoint data in stable storage.
• Write the end_checkpoint record into a log.
• What are the different phases of a transaction?
The most important to know are: non-distributed transactions, distributed transactions,
online transactions, batch transactions, two-step transactions, flat transactions, and
nested transactions.

• What is flat file database?


A flat file database is basically a giant collection of data in which the tables and records
have no relation between any other tables.

• What is "transparent DBMS"?


A DBMS that keeps its physical structure hidden from the user is known as a
transparent DBMS. A DBMS may provide a various· levels of transparency. However,
they all participate in the same overall objective: to make the use of the distributed
database, equivalent to that of a centralized database.

• What is a query?
A query is a request for data or information from a database table or combination of
tables.

• What do we mean by Correlated subquery?


A correlated subquery uses the values of the outer or main query. This query is
dependent on the outer one and hence cannot be executed in an independent manner.
The main query can be in the form of the following:

SELECT
UPDATE
DELETE

• Mention the primitive operations common to all record management systems?


Primitive operations common to all record management systems include creating
(inserting), reading (retrieving/selecting), updating, and deleting records. Additionally,
searching, navigating, sorting, and joining are essential for accessing, organizing, and
manipulating data within a database. These fundamental operations form the basis for
various database activities.
• Name the buffer in which all the commands that are typed in are stored?
The buffer in which all the commands that are typed in are stored is commonly known
as the "command buffer" or "input buffer." This buffer temporarily holds the
commands or statements entered by the user before they are processed or executed by
the system. The input buffer allows users to enter multiple commands sequentially, and
the system processes them one at a time from the buffer.

• List the unary operations in Relational Algebra?


Unary operations in relational algebra include:
1. Selection (σ): Picks rows based on a specified condition.
2. Projection (π): Extracts specified columns to create a new relation.
3. Renaming (ρ): Renames attributes in a relation.
4. Duplicate Elimination (δ): Removes duplicate rows.
5. Union (∪): Combines two relations, keeping distinct tuples.
6. Intersection (∩): Retrieves common tuples from two relations.
7. Difference (-): Creates a new relation with tuples from the first relation not present in
the second.

• Are the resulting relations of PRODUCT and JOIN operation the same?

PRODUCT Operation:
• The PRODUCT operation, also known as the Cartesian Product, combines every
row from one relation with every row from another relation.
• The result contains all possible combinations of rows from both relations.
• The number of rows in the result is the product of the number of rows in the two
original relations.

JOIN Operation
• The JOIN operation is used to combine rows from two or more tables based on a
related column between them.
• The result of a JOIN operation contains only the rows where there is a match
between the specified columns in the joined tables.
• Unlike the PRODUCT operation, the result of a JOIN is more selective and only
includes rows that satisfy the specified condition.
• What is RDBMS KERNEL?
In general, an RDBMS (Relational Database Management System) consists of several
components, including the kernel, which is the core software that manages database
operations, transactions, and interactions with the underlying hardware. The kernel is
responsible for tasks such as query processing, transaction management, and data
integrity enforcement.

If "RDBMS KERNEL" is a term used in a specific software or context, I recommend


checking the documentation or resources associated with that specific system or context
for accurate and up-to-date information.

• Name the sub-systems of an RDBMS.


the subsystems of an RDBMS include:

Storage Manager: Manages data storage and retrieval.


Query Processor: Interprets and executes SQL queries.
Transaction Manager: Ensures transactional properties (ACID).
Data Dictionary Manager: Stores metadata about the database structure.
Concurrency Control Manager: Manages concurrent access to prevent conflicts.
Backup and Recovery Manager: Handles database backups and recovery.
Authorization and Authentication Manager: Manages user access and permissions.
Database Utilities: Tools for maintenance tasks like data loading and export.

• Which part of the RDBMS takes care of the data dictionary? How?
In short, the Data Dictionary Manager in an RDBMS takes care of storing metadata,
defining the database schema, enforcing data integrity through constraints, managing
access control and security, and providing information used by the query optimizer for
efficient query execution. It serves as a central repository for crucial details about the
database structure and properties.
• What is the job of the information stored in data dictionary?
The information stored in the data dictionary of an RDBMS defines the database
structure, enforces data integrity, aids in query optimization, manages access control
and security, tracks dependencies, acts as documentation, and supports dynamic
queries about the database schema. It plays a crucial role in maintaining the integrity,
security, and efficiency of the database.

• How do you communicate with an RDBMS?


Certainly, here are the key points in bullet form:
SQL Queries:
- Use SQL statements for interactions.
Database Connection:
- Establish a connection to the database.
- Provide connection details (server, username, password, database name).
Query Execution:
- Execute SQL queries through the connection.
Programming Languages:
- Utilize languages like Python, Java, or PHP.
- Use database-specific libraries or connectors.
ODBC/JDBC:
- Use standardized interfaces like ODBC or JDBC.
ORM (Object-Relational Mapping):
- Use frameworks abstracting database interactions.
Stored Procedures:
- Create and execute precompiled queries on the server.
- **Database APIs:**
- Utilize database-specific APIs provided by the RDBMS vendor.

The choice depends on factors like programming language, RDBMS features, and
application requirements.
• Define SQL and state the differences between SQL and other conventional programming
Languages.
SQL (Structured Query Language):
- Designed for managing and querying relational databases.
- Primarily focuses on database operations, data manipulation, and retrieval.

Differences between SQL and Conventional Programming Languages:

1. Purpose and Domain:


SQL:
- Specialized for interacting with databases.
- Manipulates and retrieves data.

Conventional Languages:
- General-purpose programming for various applications.

2. Declarative vs. Procedural:


SQL:
- Declarative language, describing desired results.
- Database engine determines the process.

Conventional Languages:
- Procedural and imperative, giving explicit instructions.

3. Set-Based Operations:
SQL:
- Focuses on set-based operations for efficient data manipulation.

Conventional Languages:
- Often involves operating on individual elements or iterating through collections.

4. Data-Centric vs. Process-Centric:


SQL:
- Data-centric, emphasizing data manipulation.
Conventional Languages:
- Process-centric, focusing on algorithm execution.

5. Static vs. Dynamic Typing:


SQL:
- Typically uses static typing for database schema definition.

Conventional Languages:
- Can have both static and dynamic typing.

6. Transaction Management:
- SQL:
- Emphasizes transactional operations for ACID properties.

Conventional Languages:
- Transaction handling varies based on the application and paradigm.

• Name the three major set of files on disk that compose a database in Oracle.
In Oracle, a database is composed of three major sets of files on disk:

1. Datafiles:
- Store actual data, including tables and indexes.
2. Control Files:
- Contain metadata about the database and track transactions for recovery.
3. Redo Log Files:
- Record changes made to the database, crucial for durability and recovery.

• What is database Trigger?


A database trigger is an automatic set of instructions that responds to specific events,
like data changes in a table. It enforces rules, maintains data integrity, logs
modifications, or automates tasks. Triggers can execute before or after events and are
implemented using procedural languages like PL/SQL or T-SQL. They offer a way to
enforce consistency and automate actions within the database.
• What are stored-procedures? And what are their advantages?
Stored procedures are precompiled, reusable sets of SQL statements or procedural logic
stored in a database. Their advantages include modularity, improved performance,
enhanced security, easier maintenance, transaction management, reduced network
traffic, database independence, caching, and ease of debugging. They contribute to
efficient and secure database-driven applications.

• What is Storage Manager?


The Storage Manager is a crucial component of a database management system
(DBMS) responsible for handling the storage and retrieval of data on physical storage
devices. Its primary functions include managing data files, indexes, and buffers to
ensure efficient and reliable storage operations. Key responsibilities of the Storage
Manager include:
Data File Management:
- Organizes and manages data files storing actual data.
- Allocates space for data files on disk.

Index Management:
- Manages index structures for efficient data retrieval.
- Creates, updates, and deletes indexes based on data changes.

Buffer Management:
- Uses a buffer pool to cache frequently accessed data.
- Minimizes disk I/O by keeping data in the buffer pool.

File Organization:
- Determines organization and layout of data within data files.
- Coordinates logical-to-physical data mapping.

Space Allocation and Deallocation:


- Allocates space for new data and releases space from deleted or modified data.
- Manages free space within data files.

Concurrency Control:
- Implements mechanisms to control concurrent data access.
- Manages locks and transactions for isolation and atomicity.

Data Integrity Enforcement:


- Enforces integrity constraints like primary keys and foreign keys.
- Validates data modifications to adhere to specified rules.

Backup and Recovery:


- Collaborates with backup and recovery manager.
- Performs database backups and aids in data recovery after failures.

• What is Buffer Manager?


The Buffer Manager is a component of a database management system (DBMS)
responsible for managing the buffer pool, which is an area of memory used to cache
frequently accessed data from the database. Key responsibilities of the Storage Manager
include:
Buffer Pool Management:
- Manages a pool of memory (buffer pool) for storing data pages.
- Controls buffer allocation and deallocation.

Page Replacement Policies:


- Implements policies for replacing data pages in the buffer pool.
- Common algorithms include LRU and FIFO.

Caching Frequently Accessed Data:


- Monitors access patterns and caches frequently used data pages.
- Reduces the need for disk I/O, improving query performance.

Synchronization and Concurrency Control:


- Manages concurrent access to the buffer pool.
- Implements locks and latches for control.
Read and Write Operations:
- Handles read operations by checking and fetching data from disk if necessary.
- Manages write operations, updating both in-memory and disk copies.

Dirty Page Management:


- Tracks changes made to data pages in the buffer pool.
- Ensures modified data is eventually written to disk.

Optimizing Disk I/O:


- Minimizes disk I/O by storing frequently used data in memory.
- Improves overall system performance.

• What is Transaction Manager?


The Transaction Manager in a database management system (DBMS):

- Ensures ACID properties (Atomicity, Consistency, Isolation, Durability) of


transactions.
- Manages atomic execution, rolling back failed transactions to maintain consistency.
- Enforces integrity constraints and isolation to prevent interference between
concurrent transactions.
- Guarantees durability by making committed transaction changes permanent.
- Implements transaction control statements (COMMIT, ROLLBACK).
- Handles concurrency control to prevent conflicts between transactions.
- Maintains transaction logs for recovery after system failures.
- Detects and resolves deadlocks, ensuring smooth transaction execution.

• What is Authorization and Integrity manager?


Authorization Manager:
- Manages user access to the database and its objects.
- Grants or denies access privileges.
- Enforces security policies and verifies user identity.
Integrity Manager:
- Maintains data integrity in the database.
- Enforces constraints (e.g., primary key, foreign key).
- Performs validation checks for data consistency.

• What are stand-alone procedures?


Stand-alone procedures, often referred to as standalone stored procedures, are
procedures that are not associated with a specific schema or table in a relational
database. Unlike stored procedures that are defined within a specific schema or tied to a
particular table, stand-alone procedures are independent and can be called or executed
separately.

Key characteristics of stand-alone procedures:

1. Independence:
- Stand-alone procedures are not bound to a specific schema or table.
- They are not directly associated with the manipulation of data within a particular
database structure.

2. Reusability:
- Stand-alone procedures are designed to be reusable across different parts of an
application or even across multiple applications.
- They encapsulate a specific set of actions or logic that can be invoked wherever
needed.

3. Modularity:
- The design of stand-alone procedures follows a modular approach, focusing on
specific tasks or functionalities.
- This modularity enhances code organization and makes it easier to maintain and
update the procedures.

4. Encapsulation:
- Stand-alone procedures encapsulate a set of instructions or actions within a self-
contained unit.
- They hide the implementation details, allowing users to interact with the procedure
without needing to know the internal workings.

5. Flexibility:
- Since stand-alone procedures are not tied to specific database objects, they offer
flexibility in terms of where and how they can be used.
- They can be called from different parts of an application or integrated into various
database-related processes.

6. Callability:
- Stand-alone procedures are typically called explicitly from within application code
or by other stored procedures.
- They are invoked based on specific triggers or events in the application's logic.

Example (using SQL syntax, specific to certain database systems):


-- Creating a stand-alone procedure
CREATE PROCEDURE CalculateTotalPrice (IN quantity INT, IN unitPrice
DECIMAL(10, 2), OUT totalPrice DECIMAL(10, 2))
BEGIN
-- Logic to calculate total price
SET totalPrice = quantity * unitPrice;
END;

In the example above, the procedure `CalculateTotalPrice` is a stand-alone procedure


that performs a specific calculation. It can be called from different parts of the
application to calculate the total price based on the provided quantity and unit price.

• What are cursors. Give different types of cursors?


Cursors:
A cursor in a database context is a mechanism used to navigate and manipulate sets of
rows in a result set. It provides a way for applications to traverse the rows returned by a
query, enabling operations such as fetching, updating, and deleting data in a controlled
manner.
Types of Cursors:
Implicit Cursor:
- Automatically created for each SQL statement.
- Limited control, suitable for simple queries.

Explicit Cursor:
- Created explicitly using `DECLARE CURSOR`.
- Provides more control, especially for complex queries.

Forward-Only Cursor:
- Allows sequential forward traversal.
- Suitable for one-way data access.

Scrollable Cursor:
- Permits bidirectional traversal.
- Useful for navigating both forward and backward.

Dynamic Cursor:
- Reflects changes in the result set in real-time.
- Suitable when underlying data can change.

Static Cursor:
- Represents a snapshot of the result set at cursor open.
- Changes to data do not affect the cursor.

Keyset-Driven Cursor:
- Uses unique identifiers (keysets) for efficient navigation.
- Useful for large result sets.

Insensitive Cursor:
- Similar to a static cursor.
- Changes to data do not affect the cursor.
Insensitive Keyset-Driven Cursor:
- Combines features of insensitive and keyset-driven cursors.
- Provides a stable result set with efficient navigation.

• In case of Oracle, what is cold backup and hot backup?


Cold Backup in Oracle:
- Definition: A cold backup is performed when the Oracle database is offline or shut
down.
- Procedure: Database files are copied to a backup location while the database is not
actively running.
- Advantages: Simplicity and consistency in capturing a snapshot of the entire database.
- Disadvantages: Downtime is required as the database needs to be offline during the
backup.

Hot Backup in Oracle:


- Definition:A hot backup is performed while the Oracle database is online and actively
serving transactions.
- Procedure: Utilizes mechanisms like Oracle Recovery Manager (RMAN) to create a
backup without disrupting normal database operations.
- Advantages: No downtime, continuous availability during backup.
- Disadvantages:Complexity in managing an online backup process, potential impact on
system performance.

• What is meant by Proactive, Retroactive and Simultaneous Update


Proactive Update:

- Definition: Proactive updating involves modifying data in anticipation of future events or


changes.

- Example: Adjusting product prices before an official announcement to align with market
conditions.

Retroactive Update:

- Definition: Retroactive updating involves modifying past data to reflect changes or corrections.

- Example: Correcting an error in customer records to accurately represent historical information.


Simultaneous Update:

- Definition: Simultaneous updating occurs when multiple instances update the same data
concurrently.

- Example:Multiple users updating inventory levels in a database simultaneously, with


mechanisms to handle conflicts.

You might also like