SQL Questions
SQL Interview Questions Only (Organized for Preparation)
Beginner Level (20 Questions)
-
What is SQL?
-
What are the different types of SQL commands?
-
What is the difference between DDL and DML?
-
What is a Primary Key?
-
What is a Foreign Key?
-
What is a Unique Key?
-
What is the difference between WHERE and HAVING clause?
-
What is a NULL value in SQL?
-
What is a constraint?
-
What are indexes in SQL?
-
How to fetch unique records from a table?
-
What is the difference between DELETE and TRUNCATE?
-
What is the purpose of the GROUP BY clause?
-
What is a View in SQL?
-
What is normalization?
-
What are the types of normalization?
-
What is the use of the ORDER BY clause?
-
What are aggregate functions in SQL?
-
What is a default constraint?
-
What are aliases in SQL?
Intermediate Level (20 Questions)
-
What are the types of JOINs in SQL?
-
Explain INNER JOIN with an example.
-
Explain LEFT JOIN with an example.
-
Explain RIGHT JOIN with an example.
-
Explain FULL JOIN with an example.
-
What is a subquery?
-
What is a correlated subquery?
-
What is the difference between UNION and UNION ALL?
-
What are stored procedures?
-
What are functions in SQL?
-
What is a trigger in SQL?
-
What are transactions in SQL?
-
Explain COMMIT and ROLLBACK.
-
What is a savepoint in transactions?
-
What are window functions in SQL?
-
What is the purpose of the RANK() function?
-
How do you handle duplicate data in SQL?
-
What is the EXISTS operator?
-
What is a materialized view?
-
Explain the concept of self-join.
Advanced Level (20 Questions)
-
What is query optimization?
-
What are common techniques for SQL query optimization?
-
What is a clustered index vs non-clustered index?
-
How does indexing improve query performance?
-
What are ACID properties in SQL?
-
What are Isolation levels in SQL transactions?
-
What is deadlock in SQL and how to prevent it?
-
How to perform database backup and restore?
-
What is database sharding?
-
What is partitioning in SQL?
-
How to find the second highest salary using SQL?
-
What is the COALESCE() function?
-
What is the CASE WHEN statement?
-
What is recursive query? (CTE)
-
What is a CROSS JOIN?
-
What is the difference between DELETE, TRUNCATE, and DROP?
-
What is the difference between CHAR and VARCHAR?
-
How to check database performance in SQL?
-
What is the EXPLAIN plan in MySQL?
-
How do you handle large databases with millions of rows?
Key Topics for SQL
-
SQL Basics (DDL, DML, DCL, TCL, DQL)
-
Tables and Keys (Primary, Foreign, Composite)
-
Basic Queries (SELECT, WHERE, ORDER BY, GROUP BY, HAVING)
-
Joins (INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN)
-
Subqueries
-
Constraints (NOT NULL, UNIQUE, CHECK, DEFAULT)
-
Normalization (1NF, 2NF, 3NF)
-
Indexes (Clustered, Non-Clustered)
-
Transactions (COMMIT, ROLLBACK, SAVEPOINT)
-
Views
-
Stored Procedures, Functions, Triggers
-
Optimization Techniques
-
Window Functions (ROW_NUMBER, RANK, DENSE_RANK)
-
Backup and Restore
-
Functions (COALESCE, CASE WHEN)
Bonus Tips for SQL
-
Practice SQL queries daily on LeetCode or W3Schools SQL editor.
-
Create a mini project like "Library Management System."
-
Write subqueries and joins regularly.
-
Learn indexing and optimization tricks.
-
Revise important definitions and functions.
-
Explain queries out loud to yourself for practice.
-
Understand Execution Plan (EXPLAIN keyword).
End of SQL Questions PDF
Comments
Post a Comment