SQL_Server_Interview_QA
SQL_Server_Interview_QA
A: SQL Server is a relational database management system (RDBMS) developed by Microsoft that stores and retrieves
A: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN, SELF JOIN.
A: A primary key uniquely identifies each record in a table and does not allow NULL values.
A: Clustered index sorts and stores rows in table; non-clustered index stores pointers to rows.
1NF: Atomic columns, 2NF: Remove partial dependencies, 3NF: Remove transitive dependencies, BCNF: Stronger
3NF.
Q: What is a CTE?
A: A Common Table Expression (CTE) is a temporary result set defined within the execution scope of a query.
SQL Server Interview Questions and Answers
A: Indexes improve read performance but may slow down write operations.
A: A deadlock is when two sessions wait on each other's resources. Resolve by optimizing queries and minimizing
locking.
A: RAISERROR is older, THROW is newer (SQL 2012+), simpler and preferred for error handling.
A: Temp tables support transactions and statistics; table variables are scoped and lightweight.
A: Read Uncommitted, Read Committed, Repeatable Read, Serializable, Snapshot - control transaction visibility.
A: Triggers are automatic responses to events. Types: DML (AFTER, INSTEAD OF), DDL.
A: Partitioning splits a large table into smaller parts for better performance.
A: Use execution plans, avoid SELECT *, use indexing, simplify queries, reduce subqueries.