2 266
✅ *Core SQL Interview Questions With Answers - Part 4* 🖥️
31 What are SQL Views
- Virtual tables based on query results
- Simplify complex queries
- Example: CREATE VIEW high_earners AS SELECT * FROM employees WHERE salary > 50000;
32 What is a Stored Procedure
- Pre-compiled SQL code block
- Reusable, reduces network traffic
- Example: CALL GetEmployeeReport(1001);
33 What are SQL Triggers
- Auto-execute on events (INSERT, UPDATE, DELETE)
- Enforce business rules automatically
- Example: Trigger to log salary changes;
34 Difference between DELETE and TRUNCATE
- DELETE removes specific rows, logs each
- TRUNCATE removes all rows, faster, no logging
- DELETE can use WHERE; TRUNCATE cannot;
35 What is ACID property
- Atomicity: All or nothing
- Consistency: Valid state always
- Isolation: Transactions independent
- Durability: Committed data persists;
36 What is Normalization
- Organize data to reduce redundancy
- 1NF, 2NF, 3NF levels
- Example: Split customer and address tables;
37 What is Denormalization
- Add redundancy for read performance
- Used in data warehouses
- Trade-off: faster queries vs storage;
38 What are Transactions
- Group of operations as single unit
- BEGIN TRANSACTION, COMMIT, ROLLBACK
- Example: Bank transfer (deduct + credit);
39 What is an Index Scan vs Seek
- Scan: reads entire index/table
- Seek: directly finds rows (faster)
- Use covering indexes for best performance;
40 Interview tip you must remember
- Draw ER diagrams for relationships
- Always mention when to use views vs temp tables
- Practice EXPLAIN ANALYZE for query optimization
*Double Tap ❤️ For Part 5*
04 4月, 23:18
