⭐ Q1. What is DBMS?
Answer
DBMS (Database Management System) is software used to store, organize,
retrieve, and manage data efficiently. It allows multiple users to access and
update data securely while maintaining consistency and reducing
redundancy.
Example: A college management system stores student details, attendance,
and marks in a DBMS so they can be accessed and updated easily.
⭐ Q2. Why do we use DBMS?
Answer
We use a DBMS to store data in an organized way, reduce data duplication,
improve security, maintain data consistency, and allow multiple users to
access the data at the same time.
⭐ Q3. What is the difference between DBMS and File System?
Answer
DBMS File System
Stores data in
Stores data in tables
files
More duplicate
Reduces redundancy
data
Better security Less security
Supports multiple
Limited support
users
Searching is
Easy to query data
difficult
⭐ Q4. What is Data Redundancy?
Answer
Data redundancy means storing the same data in multiple places. It wastes
storage space and can lead to inconsistent data if one copy is updated and
another is not.
Example: If the same customer address is stored in multiple files, updating
only one copy can create incorrect records.
⭐ Q5. What is Data Integrity?
Answer
Data integrity means ensuring that data is accurate, consistent, and reliable
throughout its lifecycle. It prevents invalid or incorrect data from being
stored.
Example: A student ID should uniquely identify one student and should not
be duplicated.
⭐ Q6. What is a Primary Key?
Answer
A Primary Key is a column or a combination of columns that uniquely
identifies each record in a table. It cannot contain duplicate values or NULL
values.
Example: Employee ID in an employee table.
⭐ Q7. What is a Foreign Key?
Answer
A Foreign Key is a column in one table that refers to the Primary Key of
another table. It is used to establish a relationship between two tables.
Example: In an Orders table, CustomerID can be a foreign key that refers to
the Customer table.
⭐ Q8. Difference between Primary Key and Foreign Key?
Answer
Primary Key Foreign Key
Uniquely identifies a
Creates a relationship between tables
record
Cannot contain NULL Can contain NULL values (unless
values restricted)
One primary key per
Multiple foreign keys are possible
table
⭐ Q9. What is a Candidate Key?
Answer
A Candidate Key is a column or set of columns that can uniquely identify a
record. One candidate key is selected as the Primary Key, while the others
become Alternate Keys.
⭐ Q10. What is a Composite Key?
Answer
A Composite Key is a key formed by combining two or more columns to
uniquely identify a record when a single column is not sufficient.
Example: In a StudentCourse table, the combination of StudentID and
CourseID uniquely identifies each enrollment.
⭐ Q11. What is Normalization?
Answer
Normalization is the process of organizing data in a database to reduce
duplicate data and improve data consistency. It divides large tables into
smaller related tables, making the database easier to maintain.
Example: Instead of storing student and department details repeatedly in
one table, we can keep them in separate tables and link them using a key.
⭐ Q12. Why do we need Normalization?
Answer
We use normalization to reduce data redundancy, avoid data inconsistency,
save storage space, and make updating or deleting data easier.
⭐ Q13. What are the different Normal Forms?
Answer
The main normal forms are:
1NF (First Normal Form) – Removes repeating groups and ensures
each column contains only one value.
2NF (Second Normal Form) – Removes partial dependency.
3NF (Third Normal Form) – Removes transitive dependency.
BCNF (Boyce-Codd Normal Form) – A stronger version of 3NF that
handles certain dependency cases.
⭐ Q14. What is First Normal Form (1NF)?
Answer
A table is in 1NF if each column contains only a single value and there are no
repeating groups or multiple values in one column.
Example: Instead of storing "Java, Python" in one column, store each course
in a separate row.
⭐ Q15. What is Second Normal Form (2NF)?
Answer
A table is in 2NF if it is already in 1NF and every non-key column depends on
the entire primary key, not just part of it.
⭐ Q16. What is Third Normal Form (3NF)?
Answer
A table is in 3NF if it is already in 2NF and non-key columns depend only on
the primary key, not on other non-key columns.
⭐ Q17. What is Denormalization?
Answer
Denormalization is the process of combining tables to improve read
performance. It reduces the number of joins but may increase data
redundancy.
Example: In reporting systems where data is read much more often than
updated, denormalization can improve query speed.
⭐ Q18. What are ACID Properties?
Answer
ACID properties ensure that database transactions are reliable and
consistent.
Atomicity – Either the entire transaction happens or none of it
happens.
Consistency – The database remains in a valid state before and after
the transaction.
Isolation – Multiple transactions do not interfere with each other.
Durability – Once a transaction is committed, the data is permanently
saved.
⭐ Q19. Explain Atomicity.
Answer
Atomicity means a transaction is treated as a single unit. If any part of the
transaction fails, the entire transaction is rolled back.
Example: During a bank transfer, if money is deducted from one account
but cannot be added to the other account, the deduction is cancelled.
⭐ Q20. Explain Consistency.
Answer
Consistency ensures that every transaction leaves the database in a valid
state by following all rules and constraints.
Example: If a bank has ₹10,000 before a transfer, the total money in the
system remains ₹10,000 after the transfer.
⭐ Q21. Explain Isolation.
Answer
Isolation ensures that multiple transactions running at the same time do not
affect each other. Each transaction behaves as if it is running independently.
Example: If two users try to book the same seat at the same time, the
database ensures only one booking succeeds.
⭐ Q22. Explain Durability.
Answer
Durability means that once a transaction is committed, the data is
permanently stored, even if the system crashes immediately afterward.
Example: Once an online payment is marked as successful, the transaction
remains saved even if the server restarts.
⭐ Q23. What is a Transaction?
Answer
A transaction is a sequence of one or more database operations performed
as a single unit of work. It follows the ACID properties to ensure reliable data
processing.
Example: Transferring money from one bank account to another is a
transaction because both debit and credit operations must succeed together.
⭐ Q24. What is COMMIT?
Answer
COMMIT permanently saves all the changes made during a transaction to the
database.
⭐ Q25. What is ROLLBACK?
Answer
ROLLBACK cancels all changes made during the current transaction and
restores the database to its previous state.
⭐ Q27. What is Indexing?
Answer
Indexing is a technique used to improve the speed of data retrieval from a
database. It creates a separate structure that helps the database find
records quickly without scanning the entire table.
Example: Like the index in a book helps you find a chapter quickly without
reading every page.
⭐ Q28. Why do we use Indexing?
Answer
We use indexing to improve the performance of SELECT queries. It reduces
the time required to search for records, especially in large tables.
⭐ Q29. Does Indexing improve INSERT operations?
Answer
No. Indexing mainly improves read operations (SELECT). It can slightly
slow down INSERT, UPDATE, and DELETE operations because the index
also needs to be updated.
⭐ Q30. What is a Join?
Answer
A Join is used to combine data from two or more tables based on a related
column. It helps retrieve meaningful information stored across multiple
tables.
Example: To display a customer's name along with their order details, we
join the Customer and Orders tables.
⭐ Q31. What are the different types of Joins?
Answer
The main types of joins are:
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL OUTER JOIN
SELF JOIN
CROSS JOIN
⭐ Q32. What is an INNER JOIN?
Answer
INNER JOIN returns only the records that have matching values in both
tables.
Example: If a customer has placed an order, INNER JOIN returns that
customer along with the order details.
⭐ Q33. What is a LEFT JOIN?
Answer
LEFT JOIN returns all records from the left table and only the matching
records from the right table. If there is no match, the right-side columns
contain NULL values.
⭐ Q34. Difference between INNER JOIN and LEFT JOIN?
Answer
INNER JOIN returns only matching records from both tables.
LEFT JOIN returns all records from the left table, even if there is no matching
record in the right table.
⭐ Q35. What is a SELF JOIN?
Answer
A SELF JOIN is a join where a table is joined with itself. It is useful when
comparing rows within the same table.
Example: An employee table where each employee has a manager, and the
manager is also stored in the same employee table.
⭐ Q36. What is a View?
Answer
A View is a virtual table created using the result of a SQL query. It does not
store data itself but displays data from one or more tables.
Example: A company can create a view that shows only employee names
and departments without exposing salary details.
⭐ Q37. Why do we use Views?
Answer
We use views to simplify complex queries, improve security by hiding
sensitive columns, and provide customized data to different users.
⭐ Q38. What is a Stored Procedure?
Answer
A Stored Procedure is a pre-written SQL program stored in the database. It
can be executed whenever needed, improving code reuse and performance.
Example: A payroll calculation that runs every month can be written as a
stored procedure.
⭐ Q39. What are the advantages of Stored Procedures?
Answer
Stored procedures improve performance, reduce code duplication, increase
security, and make database logic easier to maintain.
⭐ Q40. What is a Trigger?
Answer
A Trigger is a special database program that automatically executes when an
event such as INSERT, UPDATE, or DELETE occurs on a table.
Example: Whenever a new employee is added, a trigger can automatically
create an entry in an audit table.
⭐ Q41. Difference between Trigger and Stored Procedure?
Answer
A Stored Procedure runs only when it is called manually or by an
application.
A Trigger runs automatically when a specified database event occurs.
⭐ Q42. What is a Cursor?
Answer
A Cursor is a database object used to process query results one row at a
time. It is useful when each row requires individual processing.