Module 1 : The Foundations (Focus: Basics, Data Types, and Constraints)
Module 2 : Intermediate Concepts (Focus: Transactions, Stored Procs, and Logic)
Module 3 : Essential Foundations
Module 4 : Altering/Deleting Tables, Schema Design, and Popular Database Tools.
Module 5 : SQL Functions – Interview Questions
Module 6: GROUP BY and HAVING
Module 7: SQL JOINS
Module 8: Subqueries
Module 9: Views
Module 10: Indexes
Module 11: Constraints and Keys
Module 12: Normalization
Module 13: Transactions and ACID
Module 14: Stored Procedures and Functions
SQL Interview Mastery – Real Questions with Simple Answers
SQL Live Mock Interview – Real Interview Simulation
SQL Expert Mock Interview – Scenario Based Practice
What is a database and why is it used in real applications?
What is SQL and where is it used in real-world systems?
What is the difference between data and database?
You have customer data stored in Excel. Why would you move it to a database?
If a company has millions of users, why can’t it store data in files instead of databases?
What happens in the backend when you search for a product on an e commerce website?
Why do we use tables instead of storing everything in one place?
What does SELECT star mean and when should you avoid using it?
What will happen if you run a SELECT query without specifying a table?
What is RDBMS and how is it different from a normal database?
Can you give examples where relational databases are preferred?
Why is structured data important in databases?
You are working in a bank system. Why is database accuracy important?
What problems can occur if data is not stored properly?
If two users have the same data, how would database handle it?
Why do companies use tools like MySQL or PostgreSQL?
What is the role of SQL tools like DBeaver or SSMS?
How database improves performance vs flat files?
What are the key responsibilities of a database management system in a production system?
How does structured data help in querying and reporting compared to unstructured data?
What would happen if a system stores all data in a single table instead of multiple tables?
Explain how databases help maintain consistency when multiple users access data at the same time?
A company stores customer data in Excel files across multiple systems. What challenges can arise and how would a database solve them?
You are building a login system. What type of data would you store and how would a database help manage it?
An application is slow while retrieving user data. What database-related factors could be responsible?
If two users try to update the same data at the same time, how does a database handle it?
What is the difference between retrieving all columns and retrieving only required columns?
Why should SELECT star be avoided in production systems?
What will happen if the table name is incorrect in a query?
If data retrieval is slow, what basic checks would you perform at database level?
What could go wrong if data is not stored in a structured format?
What are SQL functions and why are they used?
What is the difference between aggregate functions and scalar functions?
Can you give examples of common aggregate functions?
What is the difference between COUNT star and COUNT column name?
What is the difference between NOW and CURRENT_DATE?
How are aggregate functions used with GROUP BY?
Can you use aggregate functions in WHERE clause? Why or why not?
What is a Primary Key?
What is a Foreign Key?
What is a Unique Constraint?
What is the difference between DELETE and TRUNCATE?
What are Joins in SQL?
What is an Inner Join?
What is a Left Join?
What is a Right Join?
What is a Self Join?
What is the difference between UNION and UNION ALL?
What is the difference between WHERE and HAVING?
What is a Subquery?
What is an Index?
What is Data Integrity?
What is the BETWEEN operator?
What is the LIKE operator?
What is a View in SQL?
What is the difference between NULL and zero or a blank space?
What is the COALESCE function?
What is an Alias in SQL?
What are ACID properties?
What is Normalization?
What is Denormalization?
What is a Stored Procedure?
What is the difference between a Function and a Stored Procedure?
What is a CTE (Common Table Expression)?
What is the difference between RANK() and DENSE_RANK()?
What is Data Redundancy?
What is a Transaction?
What is the DISTINCT keyword?
What is the difference between a Table Scan and an Index Scan?
What is a “Deadlock”?
What are Window Functions?
Explain LAG() and LEAD().
What is a Recursive CTE?
What is the difference between EXISTS and IN?
What is a Data Warehouse?
What are Fact Tables and Dimension Tables?
Explain PARTITION BY.
What is an “Identity” column?
What is the difference between a Database and a Schema?
What is Row-Level Security (RLS)?
What is “Vertical Scaling” vs “Horizontal Scaling”?
What is a Surrogate Key?
What is “Garbage Collection” in a database?
What is the MERGE statement?
Explain the difference between CHAR and VARCHAR.
What is “ETL”?
What is a “Slowly Changing Dimension” (SCD)?
What is the DBCC command?
What is “Data Masking”?
What is the TOP (or LIMIT) keyword?
What is a “Non-Deterministic” function?
What is “Database Replication”?
What is the most important part of SQL performance?
Scenario: A bug in the frontend caused a “Users” table to have duplicate rows for the same email. How do you find and remove them while keeping only the one with the lowest ID?
Scenario: You have an Employees table. How do you find the 3rd highest salary without using TOP or LIMIT?
Scenario: You have an Orders table and a Customers table. Your manager wants a list of all customers who have never placed an order.
Scenario: You need to move $500 from Account A to Account B. How do you ensure that if the power goes out mid-way, the money isn’t lost or doubled?
Scenario: A retail manager wants to see a report of daily sales, but also a column that shows the “Total Sales to Date” (Running Total).
Scenario: You have a log of user logins. How do you find users who logged in for 3 days in a row?
Scenario: A report that used to take 2 seconds now takes 2 minutes. What is the first thing you check?
Scenario: You have one table with EmployeeID, Name, and ManagerID. How do you produce a report showing “Employee Name” next to their “Manager Name”?
Scenario: Find the name of the top-paid employee in every department.
Scenario: You have millions of login rows. You only want to see the very last login for each user.
Scenario: A customer moves to a new city. You need to keep their old address for historical sales reports, but use the new address for current shipping. How do you design this?
Scenario: Your Power BI dashboard is slow because it has to calculate millions of rows of sales every time it refreshes. How do you fix this in the database?
Scenario: A client wants to store customer feedback which can be a short sentence, a long paragraph, or even a JSON object. Which SQL data type do you use?
Scenario: A junior dev accidentally deleted half the Products table. You have a backup from 2:00 AM, but it’s now 10:00 AM. How do you recover the data without losing the morning’s new sales?
Question: In what order does the SQL engine actually process a query? (Is it SELECT first?)
Scenario: You need to show every employee’s salary and, in the next column, the average salary of their specific department.
Scenario: You have an index, but the query is still slow. You notice the data is modified (Inserted/Deleted) thousands of times a day. What’s wrong?
Scenario: You are searching for a UserID in a WHERE clause. The column is a VARCHAR, but you passed the ID as a number (e.g., WHERE UserID = 123). Why is it slow?
Scenario: How do you find all the subordinates of a CEO in a company with 10 levels of management?
Scenario: Your query is updating 100,000 rows. Suddenly, other users can’t even read a single row from that table. What happened?
Scenario: You need to show every employee’s name and salary, and in the next column, the average salary of their specific department.
Scenario: You have an index, but the query is still slow. You notice the data is modified (Inserted/Deleted) thousands of times a day. What’s wrong?
What is the difference between a Star Schema and a Snowflake Schema?
What are “Junk Dimensions”?
When should you use a Composite Primary Key?
What is a “Natural Key” vs. a “Surrogate Key”?
What is a “Self-Referencing” table?
What is an “OLTP” vs. an “OLAP” system?
What is “Database Partitioning”?
What is an “ER Diagram” (ERD)?
Scenario: You have a Sales table. Your manager wants a report showing the top 3 best-selling products for every single category.(The “Top N per Group” Use Case)
Scenario: A travel app wants to find “Loyalty Streaks.” How do you find users who have logged in for 5 or more consecutive days?(The “Gaps and Islands” Use Case)
Scenario: A warehouse has items coming in and out. They need to know which specific items have been sitting on the shelf for more than 90 days (FIFO – First In, First Out).
Scenario: You are merging two companies. Both have a Customers table. How do you find customers who exist in both tables but have different phone numbers?
Scenario: You have a web log. You need to find the percentage of users who Added to Cart but DID NOT Purchase within the same session.
Scenario: You are building a hotel booking system. How do you write a query to prevent a room from being booked if the dates overlap with an existing booking?
Scenario: Your boss wants to know exactly who changed the price of a product and what the price was before the change.
Scenario: A massive “Black Friday” sale is happening. Your database is locking up because too many people are reading the “Product Stock” at the same time others are updating it.
Scenario: You are building a search page where a user can filter by Name, City, or Date. Sometimes they fill in all three, sometimes only one. How do you write one query for this?
Scenario: You have a 500GB table that needs a new column added. If you run ALTER TABLE, the database will go offline for hours. How do you do it?
Scenario: You have a Sales table. Your manager wants a report showing the top 3 best-selling products for every single category.
Scenario: A travel app wants to find “Loyalty Streaks.” How do you find users who have logged in for 5 or more consecutive days?
Scenario: A warehouse has items coming in and out. They need to know which specific items have been sitting on the shelf for more than 90 days (First In, First Out).
Scenario: You are merging two companies. Both have a Customers table. How do you find customers who exist in both tables but have different phone numbers?
Scenario: You need to find the percentage of users who Added to Cart but DID NOT Purchase within the same session.
Scenario: You are building a hotel booking system. How do you ensure a room isn’t booked if the dates overlap with an existing booking?
Scenario: Your boss wants to know exactly who changed a price and what the price was before the change.
What is the difference between “Logical Scan” and “Physical Scan”?
What is a “Covering Index” and how does it prevent “Key Lookups”?
Explain the difference between a “Scan” and a “Seek” in an execution plan.
What is the “Halloween Problem” in database updates?
What is “Index Fragmentation” and when should you Rebuild vs. Reorganize?
What are “Filtered Indexes” and when are they better than standard indexes?
How do “Statistics” help the Query Optimizer?
What is the purpose of a “Columnstore Index” in a Data Warehouse?
What is “Include Columns” in a non-clustered index?
Explain the “Fill Factor” setting and its impact on Page Splits.
What is “Database Federation”?
How do you handle “Many-to-Many” relationships?
“Soft Delete” vs. “Hard Delete”?
What is “Point-in-Time Recovery”?
What are “Temporal Tables”?
What is “In-Memory OLTP”?
What is “Database Collation”?
How do “Recursive CTEs” work?
RANK() vs. DENSE_RANK() vs. ROW_NUMBER()?
CROSS APPLY vs. OUTER APPLY?
Temp Table (#) vs. Table Variable (@)?