Q31. What is Normalization in SQL?
Answer:
Normalization is the process of organizing data to minimize redundancy and improve data integrity.
Q32. What are the different Normal Forms?
Answer:
-
1NF (First Normal Form): Atomic columns
-
2NF (Second Normal Form): No partial dependency
-
3NF (Third Normal Form): No transitive dependency
Q33. What is Denormalization?
Answer:
Denormalization is the process of combining tables to reduce the complexity of queries and improve read performance.
Q34. What is the difference between DELETE and TRUNCATE?
Answer:
DELETE | TRUNCATE |
---|---|
Removes selected rows | Removes all rows |
Can have WHERE clause | Cannot have WHERE clause |
Slower | Faster |
Example:
Q35. What is a Stored Procedure?
Answer:
A Stored Procedure is a collection of SQL statements that can be executed repeatedly.
Example: CREATE PROCEDURE GetEmployees
AS
SELECT * FROM Employees;
Q36. What is a Trigger?
Answer:
A Trigger automatically executes in response to certain events on a table (like INSERT, UPDATE, DELETE).
Example:
CREATE TRIGGER after_update
AFTER UPDATE ON Employees
FOR EACH ROW
BEGIN
INSERT INTO audit_table(EmployeeID, UpdatedDate) VALUES (NEW.EmployeeID, NOW());
END;
Q37. What is a Cursor?
Answer:
A Cursor allows row-by-row processing of query results.
Example: DECLARE cursor_name CURSOR FOR
SELECT Name FROM Employees;
Q38. What is a Transaction in SQL?
Answer:
A Transaction is a unit of work that is performed against a database. It must be either fully completed or fully failed (rollback).
Q39. What are ACID properties?
Answer:
-
Atomicity: All operations must succeed or fail together
-
Consistency: Database remains in a valid state
-
Isolation: Transactions do not interfere
-
Durability: Changes are permanent after commit
Q40. What is the BETWEEN operator?
Answer:BETWEEN
selects values within a range.
Example: SELECT * FROM Products WHERE Price BETWEEN 10 AND 50;
Top 50 Intermediate SQL Interview Questions You Must Practice [With Examples]
Top 50 Advanced SQL Questions asked in Top Companies (with Answers + Examples)
2 thoughts on “Top 50 Basic Level SQL Interview Questions – Beginners Guide”