Technical Questions Based On Database Management System
Technical Questions Based On Database Management System
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.
Intension: It is a constant value that gives the name, structure of table and the constraints laid
on it.
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.
• 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 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 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 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 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 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).
Aggregation is the concept of expressing the relationship with the collection of entities
and their relationships.
• What is a query?
A query is a request for data or information from a database table or combination of
tables.
SELECT
UPDATE
DELETE
• 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.
• 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.
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.
Conventional Languages:
- General-purpose programming for various applications.
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.
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.
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.
Concurrency Control:
- Implements mechanisms to control concurrent data access.
- Manages locks and transactions for isolation and atomicity.
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.
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.
- 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.
- Definition: Simultaneous updating occurs when multiple instances update the same data
concurrently.