SQL Server Interview Questions for DBA professionals

SQL Server Interview Questions for DBA professionals

SQL Server is a Relational Database Management System designed by Microsoft Corporation. To store data SQL Server is used in many Desktop & Web Applications. If you are a SQL server professional looking to meet Interviewer for better career growth, I can suggest you to go through the below most asked SQL Server Interview Questions.

What is Clustered & Non-Clustered Index in SQL?

Clustered index is a physically rearrangement of data used in your table. It is like the index of a book. One Cluster index is possible for table. Non-Clustered Index are like pointers to the data that is stored in the data page. It is like the reference page of a book.

What is the Difference between Truncate and Delete?

Using SQL Delete we can remove rows from a SQL Table but index is as remain. Truncate delete the rows as well re-index the SQL Table.

What Primary key and Unique key?

Primary key not allows null value. It can be used using foreign key as a referral. Unique key constraints allows nulls value.

How to change Database name in SQL Server?

SQL Server 2005 & for higher versions of SQL Server 2005 we can use Alter database T-SQL statement to rename a database. For lower versions of SQL 2005 we can use exec sp_renamedb stored procedure. Look at the below examples.

SQL Server 2000 & 2005
exec sp_renamedb "TempDatabase", "SampleDatabase"

SQL Server 2005 and later version
ALTER Database "TempDatabase" Modify Name="SampleDatabase"

How to Display current date using SQL Query?

SQL Server has a in-built function called GetDate() which returns current timestamp.

How can we delete duplicate records from a table with no primary key?

It can be done using SET ROWCOUNT command. If you had 2 duplicate rows you can issue SET ROWCOUNT 1, then your DELETE command and finally SET ROWCOUNT 0.

For more Common SQL interview question please refer https://www.deskbright.com/sql/sql-interview-questions/