Table of
Contents
01 Basics Of SQL
02 SQL Operators
03 SQL Functions
04 Grouping and Aggregation
05 SQL Joins
06 Subqueries
07 Indexes
08 Views
09 Transactions
10 Common Table Expressions (CTEs)
11 Window Functions
12 Performance Optimization
13 Advanced SQL Concepts
14 Real-World Scenarios
15 Database Design and Security
16 SQL in Cloud Databases & Big Data Systems
17 Behavioral and Conceptual Questions
18 Rapid-Fire Quiz
19 Final Challenges
20 References and Further Learning
BASICS OF SQL
SL NO QUESTIONS LINK
01 What is SQL? Explain its importance
02 What are the differences between SQL and NoSQL?
Explain the types of SQL commands
03 (DDL, DML, DCL, TCL).
04 What is a database? How is it different from a table?
What are the primary data types in SQL
05 (e.g., INT, VARCHAR, DATE)?
06 What is the difference between CHAR and VARCHAR?
How do you retrieve all records from a table using a
07 SELECT statement?
08 How do you filter records using the WHERE clause?
What is the use of logical operators (AND, OR, NOT)?
09 Provide examples.
What is the difference between NULL and an empty
10 string?
01
SQL Operators
SL NO QUESTIONS LINK
What are SQL comparison operators?
01 Provide examples.
02 How do LIKE and ILIKE operators differ?
03 Explain the use of BETWEEN and IN operators.
04 What is the difference between UNION and UNION ALL?
Explain the difference between the DISTINCT and
05 GROUP BY clauses.
02
SQL Functions
SL NO QUESTIONS LINK
What are aggregate functions? Explain COUNT, SUM,
01 AVG, MIN, and MAX.
What are scalar functions? Provide examples like LEN,
02 UPPER, LOWER, and SUBSTRING.
03 How do you extract the current date and time in SQL?
04 Explain the COALESCE function with an example.
05 How do you use CASE statements in SQL?
How do you use the ISNULL function, and how is it
06 different from COALESCE?
03
Grouping and
Aggregation
SL NO QUESTIONS LINK
What is the difference between WHERE and HAVING
01 clauses?
02 How do you use GROUP BY in SQL? Provide an example.
03 Explain the ROLLUP and CUBE operations in SQL.
How can you filter aggregated data using the HAVING
04 clause?
04
SQL Joins
SL NO QUESTIONS LINK
01 What are joins in SQL? Why are they used?
Explain the differences between INNER JOIN and
02 OUTER JOIN.
What is the difference between LEFT JOIN, RIGHT JOIN,
03 and FULL OUTER JOIN?
04 What is a SELF JOIN? Provide an example use case.
05 Explain the CROSS JOIN and when to use it.
05
Subqueries
SL NO QUESTIONS LINK
01 What is a subquery in SQL? Where can it be used?
What is the difference between a correlated subquery
02 and a non-correlated subquery?
03 How do you use a subquery in the SELECT clause?
04 Explain how EXISTS and NOT EXISTS work in SQL.
What are some performance considerations for
05 subqueries?
06
Indexes
SL NO QUESTIONS LINK
01 What is an index in SQL, and why is it important?
Explain the difference between clustered and
02 non-clustered indexes.
03 What are the downsides of using too many indexes?
04 How do you create and drop an index in SQL?
Views
SL NO QUESTIONS LINK
01 What are views in SQL, and how are they used?
What is the difference between a view and a
02 materialized view?
03 How do you update data through a view?
Can you create an indexed view? Explain with an
04 example.
07
Transactions
SL NO QUESTIONS LINK
01 What are ACID properties in a database?
How do you start, commit, and rollback a transaction
02 in SQL?
Explain the difference between SAVEPOINT and
03 ROLLBACK.
What is transaction isolation, and what are the different
04 levels?
05 Provide an example of a deadlock situation in SQL.
08
Common Table
Expressions (CTEs)
SL NO QUESTIONS LINK
01 What is a CTE in SQL? Provide an example.
02 How do recursive CTEs work? Provide a use case.
What are the advantages of using CTEs over
03 subqueries?
Window Functions
SL NO QUESTIONS LINK
01 What are window functions in SQL? Provide examples.
Explain ROW_NUMBER(), RANK(), and DENSE_RANK()
02 functions.
What is the difference between PARTITION BY and
03 GROUP BY?
04 How do LEAD and LAG functions work in SQL?
09
Performance
Optimization
SL NO QUESTIONS LINK
What are some common SQL query optimization
01 techniques?
02 How do you analyze a query execution plan?
What are the pros and cons of using indexes for
03 performance?
How can you reduce the performance overhead of
04 joins?
What are table partitions, and how do they improve
05 performance?
10
Advanced SQL
Concepts
SL NO QUESTIONS LINK
What are stored procedures, and how do they differ
01 from functions?
02 How do you pass parameters to a stored procedure?
Explain the difference between an IN parameter and
03 an OUT parameter in stored procedures.
What are stored functions, and how do they differ
04 from stored procedures?
05 How do you call a stored function in a query?
06 Explain triggers in SQL and their use cases.
What is the difference between BEFORE and AFTER
07 triggers?
08 How do you handle errors in stored procedures?
Explain the concept of database normalization. What
09 are the normal forms?
10 What is denormalization, and when should it be used?
11
Real-World
Scenarios
SL NO QUESTIONS LINK
01 Write a query to find duplicate records in a table.
How do you delete duplicate records while retaining
02 one?
Write a query to find the second-highest salary in a
03 table.
Write a query to find employees who earn more than
04 their managers
05 How do you fetch the top-N rows from a table?
12
Database Design
and Security
SL NO QUESTIONS LINK
01 What are primary keys and foreign keys?
What are unique constraints, and how do they differ
02 from primary keys?
03 What is a composite key? Provide an example.
How do you ensure database security through user
04 roles and permissions?
05 What is SQL injection, and how can it be prevented?
13
SQL in Cloud
Databases &
Big Data Systems
SL NO QUESTIONS LINK
How does SQL differ in cloud databases like AWS RDS
01 or Azure SQL?
What is the difference between SQL and HiveQL in Big
02 Data systems?
03 Explain how Spark SQL is used for Big Data processing.
Behavioral and
Conceptual Questions
SL NO QUESTIONS LINK
01 Have you ever optimized a slow SQL query? How?
What challenges have you faced with SQL in a
02 real-world project?
How do you approach debugging a complex SQL
03 query?
14
Rapid-Fire Quiz
SL NO QUESTIONS LINK
01 What is the default sorting order in SQL?
Can you use an aggregate function in the WHERE
02 clause?
03 How do you retrieve unique rows from a table?
04 Can a table have multiple primary keys?
What is the difference between DELETE and
05 TRUNCATE?
06 How do you rename a table in SQL?
What is the purpose of the AUTO_INCREMENT
07 property?
What is the difference between CROSS JOIN and FULL
07
08 OUTER JOIN?
09 Can you perform a join on multiple tables? How?
10 How do you calculate the running total in SQL?
11 What is the purpose of the SQL LIMIT clause?
12 Explain the purpose of the DEFAULT constraint in SQL.
15
Final Challenges
SL NO QUESTIONS LINK
Write a query to find the most frequently occurring
01 value in a column.
02 Write a query to pivot data from rows to columns.
Write a query to calculate the difference between
03 consecutive rows.
Write a query to rank products by sales within each
04 region.
Write a query to merge data from two tables with
05 matching and non-matching rows.
Write a query to calculate the cumulative percentage
06 of sales by product.
16
References and
Further Learning
SL NO QUESTIONS LINK
01 Official SQL Documentations
02 Interactive SQL Learning Platforms
03 SQL Performance Optimization
04 SQL Interview Preparation
05 Big Data SQL & Cloud Databases
17
Thank you
Follow us
Aimerz Aimerz
Aimerz DS Aimerz FSD
Vishwa Mohan Vishwa Mohan
[Link] Vishwa Mohan