Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
19 views39 pages

Dbms

The document provides a comprehensive list of 152 DBMS interview questions and answers, organized in batches for effective learning. Each batch contains detailed explanations of key concepts such as DBMS, database schema, normalization, SQL commands, and various types of keys and relationships. The approach allows for easy revision and clarification of complex topics.
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)
19 views39 pages

Dbms

The document provides a comprehensive list of 152 DBMS interview questions and answers, organized in batches for effective learning. Each batch contains detailed explanations of key concepts such as DBMS, database schema, normalization, SQL commands, and various types of keys and relationships. The approach allows for easy revision and clarification of complex topics.
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/ 39

That's a comprehensive list of 152 DBMS interview questions — and it's great that you're

preparing thoroughly!

Since providing all answers in one message would be too large to process at once,
here’s the best way to proceed:

🔹 My Approach:
I will provide answers in batches of 15 questions per response. This way:

●​ You can revise effectively.​

●​ You can copy-paste or convert to PDF easily later.​

●​ It allows us to focus on the content (and clarify if needed).​

✅ Batch 1: Answers to Questions 1–15


1. What is DBMS?

A DBMS (Database Management System) is software that manages databases by


allowing users to store, retrieve, manipulate, and manage data efficiently. It serves as an
interface between the database and end-users or applications.

2. What is a database?

A database is an organized collection of data that can be easily accessed, managed, and
updated. It is structured in a way to facilitate data storage, retrieval, and manipulation.
3. What is a database system?

A database system includes the database, the DBMS software, and the applications or
tools used to access and manage the data. It ensures data consistency, security, and
integrity.

4. What are the advantages of DBMS over traditional file-based systems?

●​ Reduced data redundancy​

●​ Data integrity and consistency​

●​ Easy data access and querying​

●​ Data security​

●​ Concurrent access​

●​ Backup and recovery​

5. Explain the difference between DBMS and RDBMS.


Feature DBMS RDBMS

Structure File-based Table-based (Relational)

Relationship Not supported Supports relationships


s

Normalizatio Not enforced Follows normalization rules


n

Example XML DB, Hierarchical DB MySQL, PostgreSQL,


Oracle

6. What is a database schema?


A schema is the logical structure of a database, describing how the data is organized,
including tables, relationships, views, indexes, and more.

7. What is normalization, and why is it used?

Normalization is the process of organizing data to reduce redundancy and improve data
integrity. It involves dividing large tables into smaller, related tables and using keys to link
them.

8. What are the different types of keys in DBMS?

●​ Primary Key​

●​ Foreign Key​

●​ Candidate Key​

●​ Super Key​

●​ Composite Key​

●​ Surrogate Key​

●​ Unique Key​

9. Explain primary key, foreign key, and unique key.

●​ Primary Key: Uniquely identifies each row in a table. Cannot be NULL.​

●​ Foreign Key: A field in one table that refers to the primary key in another table.​

●​ Unique Key: Ensures all values in a column are different but allows one NULL.​

10. What is a composite key?


A composite key is a combination of two or more columns used together to uniquely
identify a row in a table.

11. What is a surrogate key?

A surrogate key is a system-generated unique identifier (like an auto-incremented


number) used as a primary key instead of a natural key.

12. What is a candidate key?

A candidate key is a column or set of columns that can qualify as a unique key in a table.
Each candidate key can uniquely identify a row.

13. What is the difference between a super key and a candidate key?

●​ Super Key: Any set of attributes that uniquely identifies rows in a table (may
include extra attributes).​

●​ Candidate Key: Minimal super key with no extra attribute.​

14. What is a relationship in DBMS, and what are the types of relationships?

A relationship defines how two tables are connected. Types:

●​ One-to-One (1:1)​

●​ One-to-Many (1:N)​

●​ Many-to-Many (M:N)​

15. What is an entity in DBMS?

An entity is any real-world object or concept that can have data stored about it in the
database, such as a person, place, or product.
Let me know if you want me to continue with Q16–Q30 in the next response!

You said:
yes
ChatGPT said:

Great! Here's the next batch of answers:

✅ Batch 2: Answers to Questions 16–30


16. What is an attribute in DBMS?

An attribute is a property or characteristic of an entity. For example, for the entity


"Student", attributes can be Name, RollNo, and Age.

17. What is a tuple in DBMS?

A tuple represents a single row in a table. It is an ordered set of values corresponding to


attributes of a relation (table).

18. What is the difference between primary key and unique constraints?
Feature Primary Key Unique
Constraint

Null Not Allowed One NULL


Allowed? allowed

Per Table Only one Multiple allowed

Uniqueness Enforced Enforced

19. What is the purpose of normalization in DBMS?


●​ To eliminate data redundancy​

●​ To ensure data integrity​

●​ To organize data efficiently​

●​ To improve query performance​

20. What is the difference between a database schema and a database state?

●​ Schema: The structure/design of the database (fixed, logical).​

●​ State: The actual data stored in the database at a given time (dynamic, changes
with operations).​

21. What is the concept of sub-query in terms of SQL?

A sub-query is a query nested within another query. It can return data used by the main
query. Example:

sql
CopyEdit
SELECT * FROM Employees WHERE Salary > (SELECT AVG(Salary) FROM
Employees);

22. What is the use of the DROP command, and what are the differences
between DROP, TRUNCATE, and DELETE commands?

●​ DROP: Deletes the table and its structure permanently.​

●​ TRUNCATE: Deletes all rows but keeps the table structure.​

●​ DELETE: Deletes selected rows, can use WHERE clause, and can be rolled back.​
23. What is the main difference between UNION and UNION ALL?

●​ UNION: Combines results of two queries and removes duplicates.​

●​ UNION ALL: Combines all results including duplicates.​

24. What is Correlated Subquery in DBMS?

A correlated subquery refers to columns of the outer query and is executed once for
every row processed by the outer query.

Example:

sql
CopyEdit
SELECT e1.Name FROM Employees e1
WHERE Salary > (SELECT AVG(Salary) FROM Employees e2 WHERE
e1.Dept = e2.Dept);

25. Explain Entity, Entity Type, and Entity Set in DBMS.

●​ Entity: A real-world object (e.g., Student).​

●​ Entity Type: A collection of similar entities (e.g., all Students).​

●​ Entity Set: A group of entities that share the same attributes.​

26. What are the different levels of abstraction in the DBMS?

1.​ Physical Level – How data is stored.​

2.​ Logical Level – What data is stored and relationships.​

3.​ View Level – User interaction with data (subset of logical).​


27. What integrity rules exist in the DBMS?

●​ Entity Integrity: No primary key can be NULL.​

●​ Referential Integrity: Foreign key must refer to a valid primary key or be NULL.​

28. What is the E-R model in DBMS?

The Entity-Relationship model is a high-level data model that defines data elements and
relationships for a specified system using entities, attributes, and relationships.

29. What is a functional dependency in DBMS?

A functional dependency is a relationship where one attribute uniquely determines


another.​
Notation: A → B means B is functionally dependent on A.

30. What is 1NF in DBMS?

First Normal Form (1NF) ensures that:

●​ All columns contain atomic (indivisible) values.​

●​ Each record is unique.​

Let me know to continue with Q31–Q45 in the next batch!

You said:
yes
ChatGPT said:

Awesome! Here's the next set:


✅ Batch 3: Answers to Questions 31–45
31. What is 2NF in DBMS?

Second Normal Form (2NF):

●​ Must be in 1NF​

●​ No partial dependency (i.e., no non-prime attribute depends only on part of a


composite primary key)​

32. What is 3NF in DBMS?

Third Normal Form (3NF):

●​ Must be in 2NF​

●​ No transitive dependency (non-prime attribute depends on another non-prime


attribute)​

33. What is BCNF in DBMS?

Boyce-Codd Normal Form (BCNF):

●​ A stronger version of 3NF​

●​ For every functional dependency X → Y, X must be a super key​

34. What is a CLAUSE in SQL?

A clause is a component of SQL statements used to specify conditions and control the
output. Examples: WHERE, GROUP BY, HAVING, ORDER BY.
35. What is the difference between a database and a schema?

●​ Database: A collection of data organized in tables, views, procedures, etc.​

●​ Schema: A blueprint or logical structure within the database defining tables,


relationships, and constraints.​

36. What is the purpose of SQL?

SQL (Structured Query Language) is used to:

●​ Query and retrieve data​

●​ Insert, update, and delete data​

●​ Define and manage database structures​

●​ Control access (via DCL)​

37. What are the main differences between Primary Key and Unique Key?
Feature Primary Key Unique Key

NULL Not allowed One NULL


values allowed

Per table Only one Can be multiple

Uniqueness Enforced Enforced

38. What is the difference between a database and a filesystem?

●​ Database: Organized, queryable data; supports relationships and constraints.​

●​ Filesystem: Stores unstructured data in files/folders; lacks querying capabilities


and ACID compliance.​
39. What is the purpose of the CASE statement in SQL?

CASE allows conditional logic in SQL, similar to if-else.

Example:

sql
CopyEdit
SELECT Name,
CASE
WHEN Marks >= 90 THEN 'A'
WHEN Marks >= 75 THEN 'B'
ELSE 'C'
END AS Grade
FROM Students;

40. What is the difference between a database and a blockchain?


Feature Database Blockchain

Structure Centralized or Decentralized


distributed

Data Allowed (CRUD) Immutable once added


Modification

Performance Faster Slower due to consensus


mechanism

Use-case General data storage Trustless systems, ledgers

41. What is SQL?

SQL (Structured Query Language) is the standard language used to communicate with
relational databases for data querying, manipulation, and management.

42. Explain the difference between DDL, DML, and DCL.

●​ DDL (Data Definition Language): Defines structure (CREATE, DROP, ALTER)​


●​ DML (Data Manipulation Language): Manages data (INSERT, UPDATE, DELETE)​

●​ DCL (Data Control Language): Manages access (GRANT, REVOKE)​

43. What is the difference between DELETE and TRUNCATE?


Feature DELETE TRUNCATE

WHERE Allowed Not allowed


clause

Rollback Yes No
(transaction-safe) (autocommit)

Performance Slower Faster

44. What is the difference between WHERE and HAVING?

●​ WHERE: Used to filter rows before grouping.​

●​ HAVING: Used to filter groups after aggregation.​

45. What is a JOIN? Explain different types of JOINs.

A JOIN combines rows from two or more tables based on related columns.

Types:

●​ INNER JOIN: Returns only matching rows.​

●​ LEFT JOIN: All rows from the left table, matched or not.​

●​ RIGHT JOIN: All rows from the right table, matched or not.​

●​ FULL OUTER JOIN: All rows from both tables.​

●​ SELF JOIN: Joining a table with itself.​


Shall I continue with Q46–Q60 next?

You said:
yes
ChatGPT said:

Great! Let's continue.

✅ Batch 4: Answers to Questions 46–60


46. What is a subquery?

A subquery is a query nested inside another query. It provides intermediate results used
by the outer/main query.

Example:

sql
CopyEdit
SELECT name FROM Employees
WHERE salary > (SELECT AVG(salary) FROM Employees);

47. What is a view in SQL? How to create a view?

A view is a virtual table based on the result of a SQL query.

Syntax:

sql
CopyEdit
CREATE VIEW view_name AS
SELECT column1, column2
FROM table_name
WHERE condition;
48. What are the uses of a view?

●​ Hides complexity of queries​

●​ Provides data security​

●​ Simplifies reporting​

●​ Can represent aggregated or derived data​

49. What is an index? Explain different types of indexes.

An index improves the speed of data retrieval in a table.

Types:

●​ Clustered Index: Alters the table’s physical order.​

●​ Non-Clustered Index: Separate from table data.​

●​ Unique Index: Ensures all values are unique.​

●​ Composite Index: On multiple columns.​

50. What is a stored procedure?

A stored procedure is a saved collection of SQL statements that perform a task. It's
stored in the database and can be reused.

Example:

sql
CopyEdit
CREATE PROCEDURE GetStudents
AS
SELECT * FROM Students;
51. What is a trigger?

A trigger is a special procedure that automatically executes in response to certain events


on a table (like INSERT, UPDATE, DELETE).

52. What is the difference between UNION and UNION ALL?

●​ UNION: Combines results and removes duplicates.​

●​ UNION ALL: Combines all results including duplicates (faster).​

53. What is the difference between INNER JOIN and OUTER JOIN?

●​ INNER JOIN: Returns only matching rows.​

●​ OUTER JOIN: Returns all rows from one or both tables, with NULLs for
non-matches (LEFT, RIGHT, FULL).​

54. What is a self-join?

A self-join is a regular join where a table is joined with itself.

Example:

sql
CopyEdit
SELECT A.name, B.name
FROM Employees A, Employees B
WHERE A.manager_id = B.emp_id;

55. What is a correlated subquery?

A correlated subquery depends on the outer query. It runs once for each row processed
by the outer query.
56. What is the difference between GROUP BY and ORDER BY?

●​ GROUP BY: Groups rows for aggregation (e.g., SUM, COUNT).​

●​ ORDER BY: Sorts the result set by specified columns.​

57. What is the purpose of the DISTINCT keyword?

DISTINCT removes duplicate rows from the result set.

Example:

sql
CopyEdit
SELECT DISTINCT department FROM Employees;

58. What is the difference between CHAR and VARCHAR data types?
Type CHAR VARCHAR

Storag Fixed-length Variable-length


e

Paddin Padded with spaces No padding


g

Speed Slightly faster for Efficient for varied


fixed lengths

59. What is the purpose of the LIMIT clause?

LIMIT restricts the number of rows returned by a query.

Example:

sql
CopyEdit
SELECT * FROM Employees LIMIT 10;
60. What is the difference between a database and a table?

●​ Database: A collection of related data and objects (tables, views, procedures).​

●​ Table: A structure within a database that stores rows and columns of data.​

Ready for the next? Shall I continue with Q61–Q75?

You said:
yes
ChatGPT said:

Perfect! Here’s the next batch:

✅ Batch 5: Answers to Questions 61–75


61. What is the purpose of the EXISTS clause?

EXISTS checks whether a subquery returns any result. It returns TRUE if the subquery
has at least one row.

Example:

sql
CopyEdit
SELECT name FROM Employees
WHERE EXISTS (SELECT 1 FROM Departments WHERE Employees.dept_id
= Departments.id);

62. How to print duplicate rows in a table?

You can use GROUP BY and HAVING to find duplicates:


sql
CopyEdit
SELECT column_name, COUNT(*)
FROM table_name
GROUP BY column_name
HAVING COUNT(*) > 1;

63. What is Identity?

An Identity column auto-generates unique values (like auto-increment). Commonly used


for primary keys.

Example (in SQL Server):

sql
CopyEdit
CREATE TABLE Students (
ID INT IDENTITY(1,1) PRIMARY KEY,
Name VARCHAR(100)
);

64. What is the difference between Trigger and Stored Procedure?


Feature Trigger Stored Procedure

Executio Automatic (event-driven) Manually called


n

Use case Enforce rules on data changes Execute business


logic

Called by INSERT/UPDATE/DELETE events EXEC command

65. What is the purpose of the WITH clause in SQL?

The WITH clause defines Common Table Expressions (CTEs) for better query readability
and reusability.

Example:
sql
CopyEdit
WITH HighSalary AS (
SELECT * FROM Employees WHERE salary > 50000
)
SELECT * FROM HighSalary;

66. How can you get the alternate records from the table in SQL?

Use ROW_NUMBER() or MOD():

sql
CopyEdit
SELECT * FROM (
SELECT *, ROW_NUMBER() OVER (ORDER BY id) AS rn FROM Employees
) AS temp
WHERE MOD(rn, 2) = 1;

67. How is pattern matching done in SQL?

Using LIKE, %, and _:

●​ % matches any number of characters​

●​ _ matches a single character​

Example:

sql
CopyEdit
SELECT * FROM Employees WHERE name LIKE 'A%';

68. What are the different types of joins in SQL?

●​ INNER JOIN: Matching rows only​


●​ LEFT JOIN: All from left + matches from right​

●​ RIGHT JOIN: All from right + matches from left​

●​ FULL OUTER JOIN: All rows from both tables​

●​ SELF JOIN: Join table with itself​

●​ CROSS JOIN: Cartesian product​

69. What is the difference between HAVING and WHERE clauses?


Feature WHERE HAVING

Filter Before After grouping (with GROUP BY)


grouping

Used Rows Groups


with

70. What is the purpose of the DROP command?

DROP permanently removes a database object like a table, view, or database along with
all its data.

Example:

sql
CopyEdit
DROP TABLE Students;

71. What is a transaction?

A transaction is a group of SQL operations that execute as a single unit of work,


ensuring data consistency and integrity.

72. Explain ACID properties.


●​ Atomicity: All-or-nothing execution​

●​ Consistency: Database remains valid​

●​ Isolation: Transactions don’t interfere​

●​ Durability: Changes persist after commit​

73. What is a deadlock?

A deadlock occurs when two or more transactions are waiting for each other to release
locks, resulting in a standstill.

74. What is concurrency control?

Concurrency control manages simultaneous operations without conflicting, ensuring data


integrity and isolation.

75. Explain the difference between optimistic and pessimistic locking.


Type Description

Optimistic Assumes low conflict; checks for conflicts at commit.

Pessimisti Locks resources before transaction starts to prevent


c conflicts.

Ready for Q76–Q90? Shall I continue?

You said:
yes
ChatGPT said:

Great! Let’s move on.


✅ Batch 6: Answers to Questions 76–90
76. What is a rollback?

A rollback undoes all changes made by a transaction before it was committed, restoring
the database to its previous stable state.

sql
CopyEdit
ROLLBACK;

77. What is a savepoint?

A savepoint is a marker within a transaction to which you can roll back without affecting
the entire transaction.

sql
CopyEdit
SAVEPOINT sp1;
-- some queries
ROLLBACK TO sp1;

78. What is the difference between a transaction and a batch?

●​ Transaction: A logical unit of work that follows ACID properties.​

●​ Batch: A collection of one or more SQL statements submitted together, not


necessarily forming a transaction.​

79. What is a dirty read in DBMS?

A dirty read occurs when a transaction reads uncommitted changes from another
transaction.
80. What is a phantom read in DBMS?

A phantom read happens when a transaction re-executes a query and sees new rows
(phantoms) that weren’t visible previously due to another committed transaction.

81. What is a non-repeatable read in DBMS?

A non-repeatable read occurs when a transaction reads the same row twice and sees
different values due to updates by another transaction.

82. What is two-phase locking (2PL)?

2PL is a concurrency control method with two phases:

●​ Growing phase: Transaction acquires all the locks.​

●​ Shrinking phase: Transaction releases the locks (no more acquiring).​

This ensures serializability.

83. What is the difference between serializable and repeatable read isolation
levels?
Isolation Level Description

Serializable Highest level; prevents phantom reads

Repeatable Prevents dirty and non-repeatable reads but not phantom


Read reads

84. What is a log file in DBMS?

A log file records all database modifications, including start/commit/rollback of


transactions. It is used for recovery in case of failure.

85. What is the purpose of the COMMIT statement?


COMMIT saves all the changes made during the transaction to the database permanently.

sql
CopyEdit
COMMIT;

86. What is a Live Lock?

A live lock occurs when two or more transactions continuously change their states in
response to each other without making progress, unlike deadlock which is a complete
halt.

87. What is the difference between a shared lock and an exclusive lock?
Lock Type Description

Shared Lock Allows multiple transactions to read the data

Exclusive Lock Only one transaction can read/write; others are


blocked

88. What is database partitioning?

Partitioning is dividing a large table into smaller, manageable pieces for better
performance and scalability. Each partition can be accessed and managed separately.

89. What is database sharding?

Sharding is a type of partitioning that distributes data horizontally across multiple


machines (shards), improving scalability and availability.

90. Explain CAP theorem.

The CAP Theorem states that a distributed system can guarantee only two out of three
properties:
●​ Consistency (every node sees the same data)​

●​ Availability (every request receives a response)​

●​ Partition Tolerance (system works despite network failures)​

Let me know if I should continue with Q91–Q105!

You said:
yes
ChatGPT said:

Awesome! Here’s the next batch:

✅ Batch 7: Answers to Questions 91–105


91. What is NoSQL?

NoSQL (Not Only SQL) refers to non-relational databases that store data in formats like
documents, key-value pairs, graphs, or wide-columns. It’s designed for scalability and
flexibility.

92. Explain the difference between SQL and NoSQL.


Feature SQL (Relational DB) NoSQL (Non-relational DB)

Schema Fixed schema Dynamic schema

Structure Tables with Document, key-value, graph,


rows/columns etc.

Scalabilit Vertical Horizontal


y

ACID Fully supported May support BASE instead

Examples MySQL, PostgreSQL MongoDB, Cassandra, Redis


93. What is a distributed database?

A distributed database is a collection of multiple, logically interrelated databases


distributed across different physical locations. It appears as a single database to users.

94. What is database replication?

Replication involves copying and maintaining database objects (like tables) in multiple
locations to improve availability and performance.

95. What is a materialized view?

A materialized view stores the actual data of the query results (unlike normal views). It is
periodically refreshed and used to improve performance.

96. What is database indexing, and how does it work?

Indexing is a technique to speed up data retrieval. It creates a data structure (like B-tree
or hash) that allows fast search access on table columns.

97. What is a B-tree index?

A B-tree (Balanced Tree) index is a self-balancing tree data structure that maintains
sorted data and allows searches, sequential access, insertions, and deletions in
logarithmic time.

98. What is a hash index?

A hash index uses a hash function to map search keys to buckets. It provides very fast
lookups for exact matches but not for range queries.

99. What is the difference between horizontal and vertical partitioning?


Partition Description
Type

Horizontal Divides table by rows (e.g., by region or year)

Vertical Divides table by columns (e.g., separate frequently used


columns)

100. What is a database cluster?

A database cluster is a group of databases that work together for high availability,
redundancy, and load balancing (e.g., PostgreSQL clusters).

101. What is a database trigger, and how is it different from a stored procedure?
Feature Trigger Stored Procedure

Executio Automatic (on table event) Manual (by user or


n app)

Use-case Enforce rules on data Reusable business


changes logic

Events INSERT, UPDATE, DELETE Called with EXEC

102. What is a cursor in DBMS?

A cursor is a control structure used to traverse and manipulate records returned by a


SQL query, row by row.

103. What is Denormalization?

Denormalization is the process of introducing redundancy into a database for the sake
of performance improvement, usually done by merging tables.

104. What is QBE (Query By Example)?


QBE is a method of querying a database by filling out a form-like structure to define the
query, used in visual tools (e.g., MS Access).

105. Why are cursors necessary in embedded SQL?

In embedded SQL (like in application programming), cursors are used to fetch one row
at a time from a result set, especially when dealing with multi-row queries in a
procedural language.

Shall we continue with Q106–Q120 in the next batch?

You said:
yes
ChatGPT said:

Excellent! Let’s proceed.

✅ Batch 8: Answers to Questions 106–120


106. What is the main goal of RAID technology?

RAID (Redundant Array of Independent Disks) enhances data reliability, redundancy,


and performance by distributing data across multiple hard drives using techniques like
mirroring, striping, and parity.

107. What is a checkpoint in DBMS?

A checkpoint is a point in time where all previous changes in memory are written to
disk. It helps in minimizing recovery time during a crash or failure.

108. When does a checkpoint occur in DBMS?

Checkpoints are triggered:


●​ Periodically by the system​

●​ When buffer pool fills up​

●​ On transaction commits or system-defined events​

109. What do you mean by transparent DBMS?

A transparent DBMS hides implementation details from users, such as:

●​ Data storage​

●​ Data distribution​

●​ Access paths​
This enables data independence.​

110. What are the unary operations in Relational Algebra?

Unary operations work on one relation:

●​ SELECT (σ): Filters rows​

●​ PROJECT (π): Filters columns​

●​ RENAME (ρ): Renames relations or attributes​

111. What is Relational Algebra?

Relational algebra is a procedural query language used to manipulate and retrieve data
in a relational database using operations like:

●​ Select, Project​

●​ Union, Intersection, Set Difference​


●​ Cartesian Product, Join​

112. What is Relational Calculus?

Relational calculus is a non-procedural query language that specifies what to retrieve


rather than how to retrieve it. Two types:

●​ Tuple Relational Calculus (TRC)​

●​ Domain Relational Calculus (DRC)​

113. What do you understand by query optimization?

Query optimization refers to choosing the most efficient way to execute a query by
evaluating multiple execution plans and selecting the one with the lowest cost.

114. What do you mean by durability in DBMS?

Durability ensures that once a transaction is committed, its changes are permanently
saved, even if a system crash occurs immediately after.

115. What is System R? How many of its two major subsystems?

System R is an experimental RDBMS developed by IBM in the 1970s.​


It has two main subsystems:

1.​ Research Storage System (RSS) – Handles physical data storage.​

2.​ System Relational Data System (RDS) – Manages SQL processing.​

116. What is Data Independence?


Data independence is the ability to change the schema at one level without affecting
other levels:

●​ Logical independence: Change in logical schema doesn’t affect applications.​

●​ Physical independence: Change in storage doesn’t affect logical schema.​

117. What are the three levels of data abstraction?

1.​ Physical level: How data is stored physically.​

2.​ Logical level: What data is stored and relationships.​

3.​ View level: How users see the data.​

118. How do you optimize a SQL query?

●​ Use indexes​

●​ Avoid SELECT *​

●​ Use joins instead of subqueries where appropriate​

●​ Analyze execution plan​

●​ Use LIMIT, WHERE, and HAVING wisely​

●​ Avoid unnecessary columns or nested queries​

119. What is a query execution plan?

It’s a step-by-step breakdown of how a query will be executed by the database. It helps
identify performance bottlenecks and optimization opportunities.
120. What are the common performance issues in databases?

●​ Poor indexing​

●​ Complex joins​

●​ Full table scans​

●​ Lock contention​

●​ Lack of query optimization​

●​ Insufficient memory/buffer allocation​

Shall I continue with the next and final batch: Q121–Q152?

You said:
yes
ChatGPT said:

Great! Let’s complete your list.

✅ Final Batch: Answers to Questions 121–152


121. How do you handle slow-running queries?

●​ Check and optimize the execution plan​

●​ Use indexes appropriately​

●​ Avoid SELECT *, use needed columns only​

●​ Break complex queries into smaller subqueries​

●​ Archive old data​


●​ Use caching and connection pooling​

122. What is database caching?

Database caching stores frequently accessed data in memory to reduce access time,
improve performance, and decrease load on the database.

123. What is the difference between a clustered and a non-clustered index?


Type Clustered Index Non-Clustered Index

Data storage Alters the table’s Stored separately from the


order data

Count per One per table Many per table allowed


table

Performance Faster for range Better for point queries


queries

124. What is query optimization?

Query optimization is the process of improving query performance by selecting the best
execution strategy based on factors like indexes, joins, filters, and table statistics.

125. What is the purpose of indexing in databases?

Indexing speeds up data retrieval by reducing the number of disk accesses required to
locate a row.

126. How do you identify and resolve deadlocks?

●​ Use DB logs or monitoring tools to identify blocked sessions​

●​ Apply timeouts or deadlock detection algorithms​


●​ Use locking hierarchies and consistent access order​

●​ Keep transactions short and fast​

127. What is the role of the database buffer pool?

The buffer pool caches data pages in memory, reducing disk I/O and improving
read/write performance.

128. What is database security?

Database security involves protecting data from unauthorized access, corruption, or


loss using encryption, access controls, firewalls, and auditing.

129. What is SQL injection?

A malicious technique where an attacker injects harmful SQL code into a query via input
fields to manipulate the database.

130. How do you prevent SQL injection?

●​ Use prepared statements / parameterized queries​

●​ Validate and sanitize input​

●​ Use ORM frameworks​

●​ Limit database user privileges​

131. What is database encryption?

Encryption encodes data at rest or in transit to prevent unauthorized access. Commonly


used methods:
●​ TDE (Transparent Data Encryption)​

●​ Column-level encryption​

132. What is role-based access control?

It grants permissions based on user roles (e.g., admin, editor, viewer) to ensure principle
of least privilege.

133. What is the difference between authentication and authorization?


Concep Authentication Authorization
t

Meanin Verifies identity Verifies access rights


g

Exampl Username + password Accessing specific database


e login tables

134. What is database auditing?

Auditing tracks user actions and changes in the database to ensure accountability,
detect anomalies, and meet compliance requirements.

135. What is data masking?

Data masking hides sensitive data by replacing it with fake but realistic values, used in
testing and analytics.

136. What is a firewall in the context of database security?

A firewall controls network traffic to/from the database to prevent unauthorized access
or attacks.
137. What is the purpose of SSL/TLS in database connections?

SSL/TLS encrypts the connection between client and server to ensure secure data
transmission and prevent eavesdropping.

138. What is a data warehouse?

A data warehouse is a centralized repository designed for analytics and reporting,


storing historical data from multiple sources.

139. What is OLAP and OLTP?


Type OLAP (Analytics) OLTP (Transactions)

Usage Reporting, analysis Day-to-day


operations

Data Large, historical Small, current


size

Queries Complex, Simple, write-heavy


read-heavy

140. Explain the difference between a data lake and a data warehouse.
Feature Data Lake Data Warehouse

Data Structured + Structured only


Type Unstructured

Storage Raw data Processed, cleaned


data

Use Big data, AI/ML BI and analytics

141. What is ETL?

ETL stands for Extract, Transform, Load – the process of:


●​ Extracting data from sources​

●​ Transforming it into a usable format​

●​ Loading into the data warehouse​

142. What is a database trigger?

A trigger is a procedure that automatically executes in response to a table event like


INSERT, UPDATE, or DELETE.

143. What is the difference between a database and a data warehouse?


Database Data Warehouse

Real-time Historical
operations analysis

OLTP OLAP

Normalized Denormalized

144. What is the purpose of a data dictionary?

A data dictionary stores metadata—information about the structure of the database,


such as tables, columns, types, and relationships.

145. What is the difference between a fact table and a dimension table?
Featur Fact Table Dimension Table
e

Stores Numerical, measurable Descriptive, categorical


data data

Keys Foreign keys to Primary keys


dimensions
146. What is a star schema?

A star schema is a data warehouse design with a central fact table connected to multiple
dimension tables.

147. What is a snowflake schema?

A snowflake schema is a normalized version of the star schema, where dimension tables
are further broken down into sub-dimensions.

148. What is the purpose of the WITH clause in SQL?

The WITH clause defines a Common Table Expression (CTE) that can be referenced
later in the same query for readability and reuse.

149. What is the difference between a database and a blockchain?


Database Blockchain

Centralized or Decentralized and immutable


distributed

CRUD operations Append-only

Fast and efficient Slower due to consensus


mechanisms

150. What is the difference between logical database design and physical
database design?
Type Logical Design Physical Design

Focu Entity relationships, File structure, indexing,


s constraints partitioning

151. What are temporary tables? When are they useful?


Temporary tables store intermediate results for the duration of a session or transaction,
useful in complex queries or data transformations.

sql
CopyEdit
CREATE TEMPORARY TABLE temp_table (...);

152. Explain different types of failures that occur in the Oracle database.

●​ User errors (e.g., accidental deletes)​

●​ Statement failures (e.g., syntax issues)​

●​ Process failures (e.g., session crashes)​

●​ Instance failures (e.g., database shutdowns)​

●​ Media failures (e.g., disk corruption)​

●​ Network failures (connectivity issues)​

You might also like