Top 110 Most Asked SQL Interview Queries

Comprehensive collection of the most frequently asked SQL query interview questions. Covers SELECT operations, JOINs, subqueries, aggregations, window functions, and complex real-world scenarios. Each query is production-ready and commonly asked in technical interviews at top companies.

0%

Overall Progress

0/110

1.Select all records from a table

2.Select specific columns from a table

3.Filter records using WHERE clause
4.Sort records in ascending order
5.Sort records in descending order
6.Count total number of records in a table
7.Find the maximum salary
8.Find the minimum salary
9.Calculate the average salary
10.Find the sum of all salaries
11.Display the first 5 records in SQL
12.Find distinct values in a column
13.Filter records with multiple conditions using AND
14.Filter records with multiple conditions using OR
15.Find records where a column value is NULL
16.Find records where a column value is NOT NULL
17.Find records using the LIKE operator
18.Find records using the IN operator
19.Find records within a range using BETWEEN
20.Alias column names
21.Concatenate two columns
22.Convert text to uppercase
23.Convert text to lowercase
24.Get the current date
25.Get the length of a string
26.Round a number to 2 decimal places
27.Find employees with salary greater than 50000
28.Find the first name starting with 'A'
29.Sort by multiple columns
30.Use NOT operator
31.Find the number of employees in each department
32.Get the highest salary in each department
33.Find departments with more than 5 employees
34.Find duplicate emails in the Employee table
35.Display duplicate records with their count
36.Delete duplicate records from a table
37.Find employees without managers
38.Find employees joined in the last 3 months
39.Fetch the last 3 records in SQL
40.Fetch alternate rows (odd rows) from a table
41.Fetch even rows from a table
42.Find the second highest salary
43.Find the Nth highest salary
44.Find the highest salary without using MAX()
45.Swap two column values
46.Perform INNER JOIN between two tables
47.Perform LEFT JOIN
48.Perform RIGHT JOIN
49.Perform FULL OUTER JOIN
50.Perform SELF JOIN
51.Fetch common records from two tables without JOIN
52.Use UNION to combine results
53.Use UNION ALL
54.Find employees whose salary is above average
55.Find the department with the highest employee count
56.Create a copy of a table
57.Copy only structure (not data)
58.Insert data from one table to another
59.Update records based on a condition
60.Delete records based on a condition
61.Find employees with names containing 'an'
62.Find employees whose names start with A and end with N
63.Use CASE statement for conditional logic
64.Find employees hired in a specific year
65.Calculate age from date of birth
66.Get the day, month, and year from a date
67.Find records from the last 7 days
68.Add a new column to a table
69.Drop a column from a table
70.Rename a column
71.Use ROW_NUMBER() to rank employees by salary
72.Use RANK() function
73.Use DENSE_RANK() function
74.Find the top 3 salaries in each department
75.Use PARTITION BY in window functions
76.Calculate running total of salaries
77.Find the difference between current and previous row
78.Use LEAD() to get the next row value
79.Find employees earning more than their manager
80.Find employees with the same salary
81.Use CTE (Common Table Expression)
82.Use recursive CTE to show employee hierarchy
83.Pivot data (rows to columns)
84.Unpivot data (columns to rows)
85.Find employees with salary greater than all in HR department
86.Find employees with salary greater than any in HR department
87.Use EXISTS clause
88.Find departments with no employees
89.Find the median salary
90.Find the mode (most frequent value)
91.Calculate cumulative percentage
92.Find gaps in sequential numbers
93.Create a dense sequence of numbers
94.Find consecutive login dates
95.Calculate moving average
96.Find year-over-year growth
97.Implement full-text search
98.Find the longest streak of consecutive events
99.Implement pagination efficiently
100.Find overlapping date ranges
101.Find the top performing employee in each department
102.Calculate retention rate
103.Transpose rows into comma-separated values
104.Find customers who purchased both Product A and Product B
105.Calculate percentile rank
106.Find the first and last record in each group
107.Implement a cross join
108.Find employees with maximum experience in each department
109.Calculate the difference between max and min salary per department
110.Find all employees who report to the same manager

Sign in with Google to unlock all 110 SQL interview queries and track your progress.