Explore topic-wise MCQs in SQL Server.

This section includes 45 Mcqs, each offering curated multiple-choice questions to sharpen your SQL Server knowledge and support exam preparation. Choose a topic below to get started.

1.

The below query is equivalent to ____________

A. Select * from student inner join takes using (ID);
B. Select * from student outer join takes using (ID);
C. Select * from student left outer join takes using (ID);
D. All of the mentioned
Answer» B. Select * from student outer join takes using (ID);
2.

The following query can be replaced by which one of the following?

A. SELECT name,course_id
B. SELECT name, course_id
C. SELECT name ,course_id
D. SELECT course_id
Answer» C. SELECT name ,course_id
3.

The query given below will give an error. Which one of the following has to be replaced to get the desired output?

A. _Order
B. 2Order
C. 3Order
D. Instructor
Answer» B. 2Order
4.

The query given below will not give an error. Which one of the following has to be replaced to get the desired output?

A. Salary*1.1
B. ID
C. Where
D. Instructor
Answer» D. Instructor
5.

In the query given below which one of the following is a temporary relation?

A. Budget
B. Department
C. Value
D. Max_budget
Answer» E.
6.

Which of the following fields are displayed as output for following query?

A. Salary, dept_id
B. Employee
C. Salary
D. All the field of employee relation
Answer» E.
7.

In the given query which of the keyword has to be inserted?

A. Table
B. Values
C. Relation
D. Field
Answer» C. Relation
8.

Which of the clause is not mandatory?

A. OVER clause
B. ORDER BY clause
C. PARTITION BY clause
D. All of the mentioned
Answer» D. All of the mentioned
9.

Which of the following function is used when you want all tied rows to have the same ranking?

A. RANK
B. NTILE
C. ROW_NUMBER
D. None of the mentioned
Answer» B. NTILE
10.

Select ________ dept_name from instructor;

A. All
B. From
C. Distinct
D. Name
Answer» D. Name
11.

Which is a duplicate copy of a file program that is stored on a different storage media than the original location?

A. Concurrency
B. Deadlock
C. Backup
D. Recovery
Answer» D. Recovery
12.

Which of the following is an aggregate function?

A. Average
B. Sum
C. With
D. Minimum
Answer» C. With
13.

Select __________ from instructor where dept name= ’Comp. Sci.’;

A. Mean(salary)
B. Avg(salary)
C. Sum(salary)
D. Count(salary)
Answer» C. Sum(salary)
14.

Which server can join the indexes when only multiple indexes combined can cover the query?

A. SQL
B. DBMS
C. RDBMS
D. All of the mentioned
Answer» B. DBMS
15.

Which of the following is not a ranking function?

A. RANK
B. NTILE
C. ROW_NUMBER
D. All of the mentioned
Answer» E.
16.

Which of the following constraint does not enforce uniqueness?

A. UNIQUE
B. Primary key
C. Foreign key
D. None of the mentioned
Answer» D. None of the mentioned
17.

Which of the following will not raise error if not used?

A. OVER clause
B. ORDER BY clause
C. PARTITION BY clause
D. All of the mentioned
Answer» D. All of the mentioned
18.

Which is the duplication of computer operations and routine backups to combat any unforeseen problems?

A. Concurrency
B. Deadlock
C. Backup
D. Recovery
Answer» E.
19.

The EXISTS keyword will be true if ____________

A. Any row in the subquery meets the condition only
B. All rows in the subquery fail the condition only
C. Both of these two conditions are met
D. Neither of these two conditions is met
Answer» B. All rows in the subquery fail the condition only
20.

Which of the following foreign key constraint specifies that the deletion fails with an error?

A. NO ACTION
B. CASCADE
C. SET NULL
D. All of the mentioned
Answer» B. CASCADE
21.

Constraints can be applied on ___________

A. Column
B. Table
C. Field
D. All of the mentioned
Answer» E.
22.

How many types of constraints are present in SQL Server?

A. 4
B. 5
C. 6
D. 7
Answer» D. 7
23.

Purpose of foreign key constraint in SQL Server is __________

A. FOREIGN KEY constraints identify and enforce the relationships between tables
B. A foreign key in one table points to a candidate key in another table
C. You cannot insert a row with a foreign key value, except NULL, if there is no candidate key with that value
D. None of the mentioned
Answer» B. A foreign key in one table points to a candidate key in another table
24.

Which of the function provides consecutive numbering except in the case of a tie?

A. RANK
B. NTILE
C. ROW_NUMBER
D. None of the mentioned
Answer» B. NTILE
25.

Select ID, GPA from student grades order by GPA ____________

A. Limit 10
B. Upto 10
C. Only 10
D. Max 10
Answer» B. Upto 10
26.

Which of the following is not a class of constraint in SQL Server?

A. NOT NULL
B. CHECK
C.
D. UNIQUE
Answer» D. UNIQUE
27.

Which of the following error message will be displayed if ORDER CLAUSE is not mentioned in ROW NUMBER function?

A. “The ranking function “ROW_NUMBER” must have an ORDER BY clause.”
B. “The ranking function “ROW_NUMBER” must have an OVER BY clause.”
C. “The ranking function “ROW_NUMBER” must have an PARTITION BY clause.”
D. All of the mentioned
Answer» B. “The ranking function “ROW_NUMBER” must have an OVER BY clause.”
28.

The UNION SQL clause can be used with ____________

A. SELECT clause only
B. DELETE and UPDATE clauses
C. UPDATE clause only
D. All of the mentioned
Answer» B. DELETE and UPDATE clauses
29.

Which of the constraint can be enforced one per table?

A. Primary key constraint
B. Not Null constraint
C. Foreign Key constraint
D. Check constraint
Answer» B. Not Null constraint
30.

Which of the following is the simplest ranking function?

A. RANK
B. NTILE
C. ROW_NUMBER
D. None of the mentioned
Answer» D. None of the mentioned
31.

Which of the following functions are similar?

A. RANK and NTILE
B. RANK and DENSE_RANK
C. DENSE_RANK and NTILE
D. None of the mentioned
Answer» C. DENSE_RANK and NTILE
32.

_______________ joins are SQL server default.

A. Outer
B. Inner
C. Equi
D. None of the Mentioned
Answer» C. Equi
33.

Suppose we are given a view tot credits (year, num credits) giving the total number of credits taken by students in each year.The query that computes averages over the 3 preceding tuples in the specified sort order is _________

A. SELECT YEAR, avg(num credits)
B. SELECT YEAR, avg(num credits)
C. SELECT YEAR, MIN(num credits)
D. SELECT YEAR, SUM(num credits)
Answer» B. SELECT YEAR, avg(num credits)
34.

To alter a database ___________ command is used.

A. ALTER database database_name
B. ALTER database_name
C. ALTER database database_name
D. ALTER database_name
Answer» B. ALTER database_name
35.

Which of the following is not a foreign key constraint?

A. NO ACTION
B. CASCADE
C. SET NULL
D. All of the mentioned
Answer» C. SET NULL
36.

To delete a database ___________ command is used.

A. Delete database database_name
B. Delete database_name
C. drop database database_name
D. drop database_name
Answer» D. drop database_name
37.

Which of the function is not a ranking window function?

A. RANK
B. NTILE
C. ROW_NUMBER
D. None of the mentioned
Answer» B. NTILE
38.

Which of the following is not a type of window function?

A. Ranking window function
B. Associate window function
C. Analytic window functions
D. All of the mentioned
Answer» C. Analytic window functions
39.

How many types of window functions are present in SQL Server?

A. 3
B. 4
C. 5
D. 6
Answer» B. 4
40.

Point out the wrong statement related to window function.

A. They are used to provide details of a backup plans
B. They are used to provide details of an aggregation
C. They are used to provide details of an aggregation
D. None of the mentioned
Answer» C. They are used to provide details of an aggregation
41.

Windowing function was added in which of the following versions of SQL Server?

A. 2003
B. 2005
C. 2008
D. None of the mentioned
Answer» D. None of the mentioned
42.

Which is the most important benefit of window function?

A. Aggregation
B. Association
C. Generalization
D. All of the mentioned
Answer» B. Association
43.

Which of the following function is an analytic window function?

A. LAG
B. LEAD
C. FIRST_VALUE
D. None of the mentioned
Answer» C. FIRST_VALUE
44.

Which of the following is a set function?

A. RANK
B. NTILE
C. Window
D. All of the mentioned
Answer» E.
45.

LAST_VALUE comes in the category of _____________

A. Ranking window function
B. Associate window function
C. Analytic window functions
D. All of the mentioned
Answer» D. All of the mentioned