| Which command is used to get back the privileges offered by the GRANT command in SQL Server? |
| REVOKE |
|
|
|
|
|
| What is the difference between TRUNCATE and DELETE commands ? |
1. TRUNCATE is a DDL command whereas DELETE is a DML command.
2. DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back. 3. WHERE clause can be used with DELETE and not with TRUNCATE. |
|
|
|
|
|
| SQL Server works on which protocol ? |
| TDS (Tabular Data Stream) Protocol is an application layer protocol, used to transfer data between a database server and a client. |
| Note: SQL Server is faster compare to oracle, because of using TDS Protocol only. |
|
|
|
|
| How many Columns per SELECT statement is possible in SQL Server? |
| 4096 |
|
|
|
|
|
| What is the difference between a primary key and a unique key? |
| Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique key creates a non-clustered index by default. Another major difference is that, primary key does not allow NULLs, but unique key allows one NULL only. |
|
|
|
|
|
| Write a SQL Query to find first week day of the month? |
| SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1, GETDATE())) AS FirstWeekDayofMonth |
|
|
|
|
|
| How to find nth highest salary from Employee table in SQL Server? |
| SELECT TOP 1 salary FROM (SELECT DISTINCT TOP n salary FROM employee ORDER BY salary DESC) a ORDER BY salary |
|
|
|
|
|