Interview Question of the Week #025 – How to Implement Paging in SQL Server?

Here is a very popular question when SQL Server interview consists of live coding example. Question: How to implement paging in SQL Server? Explain with the help of script. Answer: Here is the script to implemented paging in SQL Server 2005. USE AdventureWorks GO DECLARE @StartRow INT DECLARE @EndRow INT…
Read More

Interview Question of the Week #024 – What is the Best Recovery Model?

Here is one of the most popular questions I often see people asking on the internet. Question: What is the best recovery model for my database? Answer: Every situation is different and each situation has different needs for the recovery model. SQL Server offers three recovery models: full recovery, simple recovery and…
Read More

Interview Question of the Week #021 – Difference Between Index Seek and Index Scan (Table Scan)

Question: What is the difference between Index Seek and Index Scan? Answer: Index Scan retrieves all the rows from the table. Index Seek retrieves selective rows from the table. Index Scan: Since a scan touches every row in the table whether or not it qualifies, the cost is proportional to the…
Read More

Interview Question of the Week #020 – What is the Difference Between DISTINCT and GROUP BY?

Question: What is the Difference Between DISTINCT and GROUP BY? Answer: A DISTINCT and GROUP BY usually generate the same query plan, so performance should be the same across both query constructs. GROUP BY should be used to apply aggregate operators to each group. If all you need is to remove duplicates,…
Read More