SQL Server Interview Questions [SQL Tutorial] VOL.-1

Looking for SQL server interview questions?

If yes the you have landed on the right page. Here we are giving most important SQL server interview questions frequently asked during project viva or interview. So lets go ahead for Important SQL server interview questions.

Q. 1 Define Primary Key?

Ans:  The primary key is the columns used to uniquely identify each row of a table.A table can have only one primary key. A primary key value can not appear in more than one row in the table.

Q.2  Define Unique Key?

Ans:  Unique key is a one or more column that must be unique for each row of the table.It is similar to primary key. Primary key column will not accept a null. Whereas the unique key column will accept a null values.

Q. 3 Define Foreign Key?

Ans:  A foreign Key is a combination of columns with value is based on the primary key values from another table. A foreign key constraint also known as Referential Integrity Constraint.

Q.4  How do you add a column to a existing table? Give an example.


Q.5  Define View?

Ans:  A View is a database object that is a logical representation of a table.

A view does not represent any physical data.
It is derived from a table but it has no longer of its own and often may be used in the same manner as a table.
A view is a virtual table that has columns as in a table.

Q.6  Can one drop a column from a table?If yes give an example

Ans:  YES, to delete a column in a table, use  ALTER TABLE table_name DROP COLUMN column_name

Click Here for More SQL Server Interview Questions


Q.7  Compare and contrast TRUNCATE and DELETE commands for a table.

Ans:  Both the command have the common outcome of getting rid of all rows in a table. The difference between these two command is that the “truncate” command is a DDL operation and it just moves high water mark and produce a now

Q.8  What is cursors?

Ans: Cursor is a database object used by applications for manipulating data in a set on a row-by-row basis, instead of typical SQL commands which operate on all the rows in set at one time.

Q.9  What’s the difference between a primary key and a unique key? Explain.

Ans:  Both primary key and unique enforce uniqueness of column on which they are defined. But by default primary key creates a clustered index on column, while unique creates a non-clustered index by default. Major difference is that, primary key does not allow NULLs while unique key allows one NULL only.

Q.10 What are Joins?

Ans: A Join combines columns and data from two or more tables (and in some cases, of one table with itself).

Q.11  How will you define SQL?

Ans:  Structured query language(SQL) is the standard command set used for communicating with the relational database management system(RDBMS).

Q.12  Define DBMS?

Ans:  A Database Management system(DBMS) consists of a collection of interrelated data and set of programs for accessing that data.

Q.13  What is the different between Security and Integrity? Explain it.

Ans:  Security is a protection from malicious attempts to modify or steal data.While the integrity constraints guard against any accidental damage to database, by ensuring that authorized changes to database will not result in a loss of data consistency.

Hope these question and answers will increase your knowledge in SQL.

Click Here for More SQL Server Interview Questions


Related Posts