Common MSSQL Interview Question for Developers-Part 1/2

Here are top MSSQL interview questions and answers which are common and asked almost in all interviews, the MSSQL interview question useful to both Freshers and experienced developers

MSSQL interview Question : 1

What is Database

Database is a collection of data, stored and retrieved digitally from remote or local computer system

MSSQL interview Question : 2

What is SQL?

Structured Query Language (SQL) is a programming language for accessing and manipulating Relational Database Management Systems (RDBMSs). SQL is widely used in popular RDBMSs such as SQL Server, Oracle, and MySQL

MSSQL interview Question : 3

What is RDMS?

RDBMS or Relational Database Management Systems are database management systems that maintain data in the form of tables and relationships.

MSSQL interview Question : 4

Which TCP/IP port does SQL Server run on?

By default, SQL Server runs on port 1433

MSSQL interview Question : 5

What are constraints in SQL?

                  Constraints are used to specify rules concerning data in SQL. They can be applied to single or multiple columns in Tables, during creating or altering table.

MSSQL interview Question : 6

What is common type of constraints?

  • Not Null
  • Check
  • Default
  • Index
  • Unique
  • Primary Key
  • Foreign Key

MSSQL interview Question : 7

What is Not Null Constraint?

Not Null Constructor Restrict null values in Column

MSSQL interview Question : 8

What is Check Constraint?

Check Constraints verify all values in a field satisfy a condition.

E.g. Check (age>18)

MSSQL interview Question : 9

What is Default Constraint?

      Default constraints assign default value to the field incase value is not provided

MSSQL interview Question : 10

What is Unique Constraint?

     Unique Constraints ensure only unique value is added to the field.

MSSQL interview Question : 11

What is Index Constraint?

     Index Constraints provide fast retrieval of data if field id used in where condition

MSSQL interview Question : 12

What is Primary Key Constraint?

Primary Key Constraints provide a unique identification for the row.

MSSQL interview Question : 13

What is Foreign Key Constraint?

Provide a referential integrity to row in another table

MSSQL interview Question : 14

What is view in SQL?

  View is a virtual table created based on a result of SQL query, it uses no memory space as data is generated when called and not stored anywhere.

MSSQL interview Question : 15

What are Materialized views in SQL Server.

     Materialized or Indexed views are also virtual tables created based on the result of a select query, but the data is saved on disk for easy availability. means memory is used to store data and is faster than normal view.

MSSQL interview Question : 16

What is Offset in SQL Server?

      Offset is used to skip some rows in the select query result 

 

e.g.  select * from employee order by [join date] desc offset 5 rows

--this query will bring all employees list except last five joiners

MSSQL interview Question : 17

What is Fetch in SQL Server?

                  Fetch specifies the number of rows to be returned after offset is applied.

e.g.  select * from employee order by [join date] desc offset 5 rows fetch 10 rows only

--this query will bring only 10 employees list after excluding last five joiners

MSSQL interview Question : 18

How will you find the 5th highest salary of an employee table?     

Select basicsalary from tblEmployeemaster  order by basicsalary desc offsel 4 rows fetch 1 row only;

MSSQL interview Question : 19

What is Over clause in SQl Server?

      Over clause is a window function in SQL Server and is added to Aggregate functions in the Query, and Over function can use partition to determine condition for window

MSSQL interview Question : 20

What is Dynamic SQL in SQL Server?

Dynamic SQL is an sql statement that is constructed and executed  at runtime,  means the statements are created at runtime as string and then executed using EXEC or sp_executesql

E.g. declare @sqlstring varchar(1000)

       Set  @sqlstring=’select * from employees’;

       Exec (@sqlstring);

    

MSSQL interview Question : 21

What is CTE in SQL Server?

     Common Table Expression is a temporary result set which you can query (insert, update or delete) , it help you to store result set from complex queries and reuse them. It is defined using WITH statement

 

WITH CTE_NAME(columns..)

As (

 Actual query…….

) Select* from  CTE_NAME

 

Show All Cards

 

Comments


Commented by : {{x.userName}} {{new Date( x.addedDate).toString().split(' ').splice(0, 5).join(' ') }}

{{x.commentDesc}}

Other Free Training Materials Available

Free Kerala PSC Exam Training Online
Way4job - Free Kerala PSC training online with previous question papers and free mock exams

Free Kerala PSC training provide notes, Free Online daily Mock test, Previous Questions and answers in english and malayalam. Practice previous years question answers in exam mode will help you success.

Study Now
Free DHA Training
Free DHA Training for Nurses ,Doctors and other medical persons. Sample Questions and Mock test

Study and Practise DHA

Study Now
Free Online PMP Training based on PMBOK
Best Free Online PMP Training based on PMBOK

Best Free Online PMP Training based on PMBOK and PMI guidelines,Sample questions,Exam Simulators and PMP Notes and Flashcards makes you understand the concepts clearly and pass PMP exam at first attempt

Study Now
Free Microsoft Certification Trainings Material
Free Microsoft Training

Study Now
Currently viewing : 5