Interview Questions and answers - SQL Server Day 9

Question: What is the difference between char, nchar, varchar, and nvarchar in SQL Server?

nchar and nvarchar can store Unicode characters.
char and varchar cannot store Unicode characters.
char and nchar are fixed-length which will reserve storage space for the number of characters you specify even if you don't use up all that space.
varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar. For more details click here

Question: What is the Difference between @@CONNECTIONS and @@MAX_CONNECTIONS in SQL Server?

@@MAX_CONNECTIONS: @@MAX_CONNECTIONS returns the maximum number of synchronous user connections allowed. SQL Server allowed by default a maximum 32767 connections. To avoid many connections it can be configured at the server level.
Note: Maximum connections (32767) are depending on application and server hardware limits.

@@CONNECTIONS: @@CONNECTIONS returns number of connection attempts on SQL Server since SQL Server has been started.
SELECT [ConnectionAttempts] = @@CONNECTIONS,
       [MaximumAllowed] = @@MAX_CONNECTIONS
For more click here 

Question: What is the difference between DATEFIRST and @@DATEFIRST in SQL Server?

Answer: DATEFIRST keyword use to reset the first day of the week in SQL Server and @@DATEFIRST return the current value for the session of DATEFIRST.
For details click here 

Question: What is the Difference between a HAVING CLAUSE and a WHERE CLAUSE in SQL Server?

WHERE clause applies to individual rows. While the HAVING clause is like a WHERE clause, but applies only to groups as a whole.

The WHERE clause is applied first to the individual rows in the tables means WHERE clause is fetched data from the memory according to condition. The HAVING clause is applied to the rows in the result set, means first data is fetched from memory to result set then apply HAVING clause on the row of the result set.

We can use WHERE clause with the HAVING clause, but it applies before the GROUP BY clause. We can apply a HAVING clause only to columns that also appear in the GROUP BY clause or in an aggregate function. For more details click here 

NUnit : Introduction

There are several unit test tools in the market, but one of them is NUnit, the most popular tool for doing unit testing. So in this tutorial...