# Question Companies Difficulty Type Frequency
Section A – SQL Basics
1 What are the different types of SQL commands (DDL, DML, DCL, TCL)? Infosys, TCS Easy Theory Most frequent
2 Difference between SQL and NoSQL databases. Amazon, Google Medium Theory Normal
3 Explain difference between DELETE, TRUNCATE, and DROP. Microsoft, Accenture Easy Theory Most frequent
4 What are primary keys and foreign keys? TCS, Cognizant Easy Theory Most frequent
5 Difference between CHAR, VARCHAR, and TEXT. Amazon, Flipkart Easy Theory Normal
6 What are constraints in SQL? Explain with examples. Infosys, Wipro Easy Theory Most frequent
7 What is the difference between UNION and UNION ALL? Google, Meta Medium Theory + Practical Most frequent
8 Explain NULL in SQL and how it is handled in comparisons. Amazon, Microsoft Medium Theory Most frequent
9 Difference between IN and EXISTS. Flipkart, TCS Medium Both Normal
10 What is a subquery? Give types. Amazon, Wipro Medium Theory + Practical Most frequent
Section B – Joins
11 Difference between INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN. Amazon, Microsoft Medium Both Most frequent
12 What is a SELF JOIN? Provide use case. Infosys, TCS Medium Practical Normal
13 Difference between CROSS JOIN and FULL OUTER JOIN. Google, Accenture Medium Theory Normal
14 How to find unmatched records using joins? Amazon, Flipkart Medium Practical Most frequent
15 Explain natural join and its risks. Infosys, Cognizant Medium Theory Medium
Section C – Aggregations & Grouping
16 Difference between COUNT(*) and COUNT(column). Amazon, Microsoft Easy Theory Most frequent
17 What is the HAVING clause? How is it different from WHERE? Google, Infosys Medium Both Most frequent
18 Explain GROUP BY with example. Amazon, Flipkart Easy Practical Most frequent
19 How do you calculate median in SQL? Microsoft, Meta Hard Practical Normal
20 Difference between RANK, DENSE_RANK, and ROW_NUMBER. Amazon, Google Medium Practical Most frequent
Section D – Window Functions
21 What are window functions in SQL? Google, Microsoft Medium Theory Most frequent
22 Difference between PARTITION BY and GROUP BY. Amazon, Meta Medium Both Most frequent
23 How to calculate running totals using SQL? Flipkart, Infosys Medium Practical Normal
24 What is LAG and LEAD in SQL? Amazon, Microsoft Medium Practical Most frequent
25 How to calculate moving averages in SQL? Google, TCS Medium Practical Normal
Section E – Indexing & Optimization
26 What are indexes in SQL? Why are they used? Amazon, Google Medium Theory Most frequent
27 Difference between clustered and non-clustered index. Microsoft, Infosys Medium Theory Most frequent
28 What is a composite index? Amazon, Flipkart Medium Theory Normal
29 What is index selectivity? Google, Meta Hard Theory Normal
30 How would you identify slow queries? Amazon, Microsoft Hard Both Normal
Section F – Data Types & Functions
31 Difference between DATE, DATETIME, and TIMESTAMP. Infosys, TCS Medium Theory Most frequent
32 How to extract year, month, and day from a DATE column? Amazon, Google Easy Practical Most frequent
33 Difference between CAST and CONVERT. Microsoft, Accenture Medium Both Normal
34 How to round, truncate, and format numbers in SQL? Infosys, Wipro Easy Practical Most frequent
35 Difference between CHARINDEX and PATINDEX. Amazon, TCS Medium Practical Medium
36 What are string functions in SQL? Flipkart, Microsoft Easy Practical Most frequent
37 How do you concatenate strings in SQL? Infosys, Cognizant Easy Practical Most frequent
38 How to split strings in SQL? Amazon, TCS Medium Practical Normal
39 How to find length of string and trim spaces? Microsoft, Infosys Easy Practical Most frequent
40 How to replace substrings in SQL? Google, Amazon Easy Practical Most frequent
Section G – Normalization & Schema Design
41 What is database normalization? Why is it needed? Infosys, TCS Medium Theory Most frequent
42 Explain 1NF, 2NF, 3NF, and BCNF. Amazon, Google Medium Theory Most frequent
43 Difference between denormalization and normalization. Microsoft, Flipkart Medium Theory Normal
44 What is a surrogate key vs natural key? Infosys, Cognizant Medium Theory Normal
45 What is data redundancy and how to handle it? Amazon, TCS Medium Theory Normal
Section H – Transactions
46 What is ACID property in databases? Amazon, Infosys Easy Theory Most frequent
47 Explain transaction isolation levels. Google, Microsoft Hard Theory Most frequent
48 Difference between COMMIT and ROLLBACK. Infosys, TCS Easy Practical Most frequent
49 What is a savepoint? Microsoft, Wipro Medium Practical Normal
50 Difference between pessimistic and optimistic locking. Amazon, Google Hard Theory Medium
Section I – Advanced Queries
51 What is a CTE (Common Table Expression)? Amazon, Microsoft Medium Theory + Practical Most frequent
52 Difference between CTE and Subquery. Google, Infosys Medium Theory Normal
53 What are recursive CTEs? Amazon, TCS Hard Practical Medium
54 Difference between temporary table and table variable. Microsoft, Cognizant Medium Both Normal
55 What is a materialized view? Amazon, Google Hard Theory Medium
56 Difference between View and Table. Infosys, TCS Medium Theory Most frequent
57 What are stored procedures? Microsoft, Wipro Medium Theory + Practical Most frequent
58 Difference between functions and stored procedures. Amazon, Infosys Medium Both Most frequent
59 What are triggers in SQL? Google, Flipkart Medium Both Normal
60 Difference between AFTER and INSTEAD OF triggers. Microsoft, Amazon Hard Theory Medium
Section J – Performance Tuning
61 How do you use EXPLAIN or EXPLAIN PLAN? Amazon, Google Medium Practical Normal
62 How to optimize a slow query? Microsoft, Infosys Hard Both Most frequent
63 What are query execution plans? Amazon, Wipro Medium Theory Normal
64 Difference between OLAP and OLTP. Google, Accenture Medium Theory Most frequent
65 What are database partitions? Microsoft, Infosys Hard Theory Normal
66 Difference between horizontal and vertical partitioning. Amazon, Flipkart Medium Theory Medium
67 What are sharding and replication? Google, Meta Hard Theory Medium
68 What is indexing strategy for large tables? Amazon, Microsoft Hard Theory Medium
69 How do you detect deadlocks? Infosys, TCS Hard Both Normal
70 How do you resolve locking issues? Microsoft, Amazon Hard Both Normal
Section K – Security & Access
71 What is SQL injection? How to prevent it? Google, Microsoft Medium Theory Most frequent
72 Difference between user and role in SQL. Infosys, TCS Medium Theory Normal
73 How to grant and revoke permissions in SQL? Amazon, Wipro Easy Practical Normal
74 What are database roles and privileges? Google, Microsoft Medium Theory Normal
75 How to audit changes in a database? Amazon, Infosys Hard Practical Medium
Section L – Miscellaneous
76 Difference between OLAP cube and relational DB. Microsoft, Infosys Hard Theory Medium
77 How do you pivot rows into columns in SQL? Amazon, Flipkart Medium Practical Most frequent
78 How do you unpivot columns into rows? Google, TCS Medium Practical Normal
79 What is the difference between RDBMS and DBMS? Infosys, Cognizant Easy Theory Most frequent
80 Difference between SQL and PL/SQL. Oracle, TCS Medium Theory Normal
81 What are SQL window frames? Amazon, Google Hard Theory Normal
82 What are recursive queries used for? Microsoft, Flipkart Hard Practical Medium
83 How do you create hierarchical queries? Oracle, Infosys Hard Practical Medium
84 What is query caching? Google, Amazon Medium Theory Normal
85 What are JSON functions in SQL? Microsoft, Amazon Medium Practical Normal
86 How to store unstructured data in SQL databases? Google, Infosys Medium Theory Medium
87 Difference between normalized and star schema. Amazon, TCS Medium Theory Most frequent