Complete SQL Technical Interview Question Bank
(20+ Pages)
SECTION 1
SECTION 1 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 2
SECTION 2 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 3
SECTION 3 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 4
SECTION 4 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 5
SECTION 5 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 6
SECTION 6 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 7
SECTION 7 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 8
SECTION 8 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 9
SECTION 9 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 10
SECTION 10 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 11
SECTION 11 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 12
SECTION 12 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 13
SECTION 13 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 14
SECTION 14 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 15
SECTION 15 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 16
SECTION 16 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 17
SECTION 17 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 18
SECTION 18 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 19
SECTION 19 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;
SECTION 20
SECTION 20 – SQL Interview Questions and Answers
Explain SQL concepts in detail.
What are DDL, DML, DCL, TCL commands?
Difference between DELETE, TRUNCATE, DROP.
Explain Primary Key, Foreign Key, Unique Key.
What is Normalization? Explain 1NF, 2NF, 3NF with examples.
Explain all types of JOINS with examples.
SELECT e.emp_name, d.dept_name FROM Employee e INNER JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e RIGHT JOIN Department d ON e.dept_id = d.dept_id;
SELECT * FROM Employee e FULL JOIN Department d ON e.dept_id = d.dept_id;
Explain GROUP BY and HAVING with examples.
SELECT department, SUM(salary) FROM Employee GROUP BY department HAVING SUM(salary) > 100000;
Explain Subqueries and Correlated Subqueries.
SELECT * FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee);
Explain Window Functions (RANK, DENSE_RANK, ROW_NUMBER).
SELECT emp_name, salary, RANK() OVER (ORDER BY salary DESC) FROM Employee;
Explain Indexing and Performance tuning techniques.
What are ACID properties?
BEGIN; UPDATE Employee SET salary = salary + 1000 WHERE emp_id = 1; COMMIT;
Explain Stored Procedures and Triggers.
Real-time scenario: Find Nth highest salary.
SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;