TGViewer
Data Analytics Data Analytics @sqlspecialist ยท 111K subscribers
Post #2462 8.83K
Top SQL Interview Questions with Answers: Part-2 ๐Ÿง 

11. How do you remove duplicate records? ๐Ÿ—‘๏ธ
Use DISTINCT or ROW_NUMBER() with a CTE to delete duplicates.
SELECT DISTINCT * FROM table_name;
Or:sql
WITH Ranked AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY col1, col2 ORDER BY id) AS rn
FROM table_name
)
DELETE FROM Ranked WHERE rn > 1;


12. What is normalization? Explain its types. ๐Ÿงฑ
Normalization reduces redundancy and improves data integrity.
- 1NF: Atomic columns (no repeating groups)
- 2NF: 1NF + no partial dependency
- 3NF: 2NF + no transitive dependency
- BCNF: Advanced version of 3NF

13. What is denormalization?
The process of combining tables to improve read speed by introducing redundancy. Used for reporting and faster queries. โšก

14. What is a stored procedure?
A saved set of SQL statements that can be reused. ๐Ÿ’พ
CREATE PROCEDURE GetUsers AS
BEGIN
SELECT * FROM users;
END;


15. What are indexes and why are they used?
Indexes speed up query performance by allowing quick data lookup. Useful on columns used in WHERE or JOIN clauses. ๐ŸŽ๏ธ

16. What is the difference between clustered and non-clustered index?
- Clustered: Sorts actual table data. Only one per table. (Physical Order)
- Non-clustered: Separate structure that references data. Can have many. (Logical Order)

17. What is a transaction?
A group of operations treated as a single unit. It follows ACID principles to maintain data integrity.

18. ACID properties in SQL
- Atomicity: All or none of the operations run (All-or-Nothing)
- Consistency: Data stays valid before/after transaction โš–๏ธ
- Isolation: Transactions donโ€™t interfere ๐Ÿง
- Durability: Changes remain after success โœ…

19. Difference between DELETE, TRUNCATE, and DROP
- DELETE: Removes rows, can be rolled back (logged). โช
- TRUNCATE: Removes all rows, faster, less logging. ๐Ÿ—‘๏ธ
- DROP: Deletes table structure and data entirely. ๐Ÿ’ฅ

20. What is a NULL value in SQL?
NULL represents missing or unknown data. It's different from 0 or an empty string. (Unknown, not Zero.)

๐Ÿ’ฌ Double Tap โค๏ธ For Part-3
  • โค 35
  • ๐Ÿ‘ 1
More from @sqlspecialist
  1. Oct 12, 20268๏ธโƒฃ You receive a dataset with inconsistent date formats. How would you clean it? Sample Aโ€ฆ
  2. Oct 12, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 7 Guys, let's continue our Data Analyst Interviewโ€ฆ
  3. Oct 12, 2026๐Ÿš€ ๐—ช๐—ต๐—ถ๐—ฐ๐—ต ๐—ง๐—ฒ๐—ฐ๐—ต ๐—ฆ๐—ธ๐—ถ๐—น๐—น ๐—ช๐—ถ๐—น๐—น ๐—ฌ๐—ผ๐˜‚ ๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ? Want to builโ€ฆ
  4. Oct 9, 2026โ€œHere, the data is sorted by the second column in descending order and the first five rowsโ€ฆ
  5. Oct 9, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 6 Guys, let's continue our Data Analyst Interviewโ€ฆ
  6. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
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 โ†’