TGViewer
Data Analytics Data Analytics @sqlspecialist · 111K subscribers
Post #2301 6.44K
✅ Top 10 SQL Interview Questions

1️⃣ What is SQL and its types? 
SQL (Structured Query Language) is used to manage and manipulate databases. 
Types: DDL, DML, DCL, TCL 
Example: CREATE, SELECT, GRANT, COMMIT

2️⃣ Explain SQL constraints. 
Constraints ensure data integrity:
⦁ PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK

3️⃣ What is normalization? 
It's organizing data to reduce redundancy and improve integrity (1NF, 2NF, 3NF…).

4️⃣ Explain different types of JOINs with example.
⦁ INNER JOIN: Returns matching rows
⦁ LEFT JOIN: All from left + matching right rows
⦁ RIGHT JOIN: All from right + matching left rows
⦁ FULL JOIN: All rows from both tables

5️⃣ What is a subquery? Give example. 
A query inside another query:
SELECT name FROM employees
WHERE department_id = (SELECT id FROM departments WHERE name='Sales');


6️⃣ How to optimize slow queries? 
Use indexes, avoid SELECT *, use joins wisely, reduce nested queries.

7️⃣ What are aggregate functions? List examples. 
Functions that perform a calculation on a set of values: 
SUM(), COUNT(), AVG(), MIN(), MAX()

8️⃣ Explain SQL injection and prevention. 
A security vulnerability to manipulate queries. Prevent via parameterized queries, input validation.

9️⃣ How to find Nth highest salary without TOP/LIMIT?
SELECT DISTINCT salary FROM employees e1
WHERE N-1 = (SELECT COUNT(DISTINCT salary) FROM employees e2 WHERE e2.salary > e1.salary);


🔟 What is a stored procedure? 
A precompiled SQL program that can be executed to perform operations repeatedly.

🔥 React for more! ❤️
  • ❤ 17
  • 🔥 2
More from @sqlspecialist
  1. Oct 14, 2026I could then categorize customers into groups such as Active, At Risk, and Inactive and su…
  2. Oct 14, 2026📊 Data Analyst Interview Series — Part 10 Guys, let's continue our Data Analyst Interview…
  3. Oct 13, 2026📊 Data Analyst Interview Series — Part 9 Guys, let's continue our Data Analyst Interview…
  4. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  5. Oct 12, 20268️⃣ You receive a dataset with inconsistent date formats. How would you clean it? Sample A…
  6. Oct 12, 2026📊 Data Analyst Interview Series — Part 7 Guys, let's continue our Data Analyst Interview…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →