Explore topic-wise MCQs in Structured Query Language (SQL).

This section includes 424 Mcqs, each offering curated multiple-choice questions to sharpen your Structured Query Language (SQL) knowledge and support exam preparation. Choose a topic below to get started.

351.

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
352.

Select ID, GPA from student grades order by GPA ____________ Inorder to give only 10 rank on the whole we should use :

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

Select __________ from instructor where dept name= ’Comp. Sci.’; Which of the following should be used to find the mean of the salary ?

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

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
355.

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
356.

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
357.

Which of the following function is a analytic window function ?

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

Code for creating an HTML report that lists the name of each service along with its status is :

A. Get-Ser | ConvertTo-HTML -Property Name, Status > C:\services.htm
B. Get-Service | Property Name, Status > C:\services.htm
C. Get-Service | ConvertTo-HTML -Property Name, Status > C:\services.htm
D. All of the mentioned
Answer» D. All of the mentioned
359.

Unrestricted execution policy can be set up in SQL Server can be done using :

A. Set-ExecutionPolicy Unrestricted
B. Set-Policy Unrestricted
C. Set-Policy Unrestricted
D. None of the mentioned
Answer» B. Set-Policy Unrestricted
360.

_________ convert object properties into CSV objects.

A. ConvertFrom-CSV
B. Convert-CSV
C. ConvertFromCSV
D. All of the mentioned
Answer» B. Convert-CSV
361.

The phrase “greater than at least one” is represented in SQL by ____

A. < all
B. < some
C. > all
D. > some
Answer» E.
362.

We can test for the nonexistence of tuples in a subquery by using the __________ construct.

A. Not exist
B. Not exists
C. Exists
D. Exist
Answer» C. Exists
363.

A Boolean data type that can take values true, false, and ___

A. 1
B. 0
C. Null
D. Unknown
Answer» E.
364.

__________ is stored only in the Master database.

A. Database-scoped Dynamic Management View
B. Complex View
C. Catalog View
D. None of the mentioned
Answer» E.
365.

Which is not a type of join in T-SQL?

A. Equi-join
B. Natural join
C. Outer join
D. Cartesian join
Answer» C. Outer join
366.

The following SQL is which type of join: SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,ORDER_T?

A. Equi-join
B. Natural join
C. Outer join
D. Cartesian join
Answer» E.
367.

How many tables may be included with a join ?

A. One
B. Two
C. Three
D. All of the Mentioned
Answer» E.
368.

Which of the following is one of the basic approaches for joining tables ?

A. Subqueries
B. Union Join
C. Natural join
D. All of the Mentioned
Answer» E.
369.

What type of join is needed when you wish to return rows that do have matching values ?

A. Equi-join
B. Natural join
C. Outer join
D. All of the Mentioned
Answer» E.
370.

The command to remove rows from a table ‘CUSTOMER’ is

A. DROP FROM CUSTOMER
B. UPDATE FROM CUSTOMER
C. REMOVE FROM CUSTOMER
D. DELETE FROM CUSTOMER WHERE
Answer» E.
371.

Find all the cities with temperature, condition and humidity whose humidity is in the range of 63 to 79.

A. SELECT * FROM weather WHERE humidity IN (63 to 79)
B. SELECT * FROM weather WHERE humidity NOT IN (63 AND 79)
C. SELECT * FROM weather WHERE humidity BETWEEN 63 AND 79
D. SELECT * FROM weather WHERE humidity NOT BETWEEN 63 AND 79
Answer» D. SELECT * FROM weather WHERE humidity NOT BETWEEN 63 AND 79
372.

Find all the tuples having temperature greater than ‘Paris’.

A. SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = ‘Paris’
B. SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = ‘Paris’)
C. SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city = ‘Paris’)
D. SELECT * FROM weather WHERE temperature > ‘Paris’ temperature
Answer» B. SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = ‘Paris’)
373.

Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70 .

A. SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70
B. SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70
C. SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70
D. SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70
Answer» D. SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70
374.

What is the meaning of LIKE ‘%0%0%’ ?

A. Feature begins with two 0’s
B. Feature ends with two 0’s
C. Feature has more than two 0’s
D. Feature has two 0’s in it, at any position
Answer» E.
375.

How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?

A. UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
B. MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
C. MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
D. UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
Answer» E.
376.

Which of the following command makes the updates performed by the transaction permanent in the database ?

A. ROLLBACK
B. COMMIT
C. TRUNCATE
D. DELETE
Answer» C. TRUNCATE
377.

Which SQL keyword is used to sort the result-set ?

A. ORDER BY
B. SORT
C. ORDER
D. SORT BY
Answer» B. SORT
378.

With SQL, how can you return the number of not null records in the “Persons” table ?

A. SELECT COUNT() FROM Persons
B. SELECT COLUMNS() FROM Persons
C. SELECT COLUMNS(*) FROM Persons
D. SELECT COUNT(*) FROM Persons
Answer» B. SELECT COLUMNS() FROM Persons
379.

With SQL, how can you return all the records from a table named “Persons” sorted descending by “FirstName” ?

A. SELECT * FROM Persons SORT BY ‘FirstName’ DESC
B. SELECT * FROM Persons ORDER FirstName DESC
C. SELECT * FROM Persons SORT ‘FirstName’ DESC
D. SELECT * FROM Persons ORDER BY FirstName DESC
Answer» E.
380.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a” ?

A. SELECT * FROM Persons WHERE FirstName=’a’
B. SELECT * FROM Persons WHERE FirstName LIKE ‘a%’
C. SELECT * FROM Persons WHERE FirstName LIKE ‘%a’
D. SELECT * FROM Persons WHERE FirstName=’%a%’
Answer» D. SELECT * FROM Persons WHERE FirstName=’%a%’
381.

What does DML stand for ?

A. Different Mode Level
B. Data Model Language
C. Data Mode Lane
D. Data Manipulation language
Answer» E.
382.

What is the purpose of the SQL AS clause ?

A. The AS SQL clause is used change the name of a column in the result set or to assign a name to a derived column
B. The AS clause is used with the JOIN clause only
C. The AS clause defines a search condition
D. All of the mentioned
Answer» B. The AS clause is used with the JOIN clause only
383.

Which of the following statement is true ?

A. DELETE does not free the space containing the table and TRUNCATE free the space containing the table
B. Both DELETE and TRUNCATE free the space containing the table
C. Both DELETE and TRUNCATE does not free the space containing the table
D. DELETE free the space containing the table and TRUNCATE does not free the space containing the table
Answer» B. Both DELETE and TRUNCATE free the space containing the table
384.

If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default

A. ASC
B. DESC
C. There is no default value
D. None of the mentioned
Answer» B. DESC
385.

_______________ is not a category of SQL command .

A. TCL
B. SCL
C. DCL
D. DDL
Answer» C. DCL
386.

_______________ is not a category of SQL command.

A. TCL
B. SCL
C. DCL
D. DDL
Answer» C. DCL
387.

Built in Functions in SQL Server is categorized in to how many category ?

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

______________ returns the rank of rows within the partition of a result set, without any gaps in the ranking

A. RANK
B. NTILE
C. DENSE_RANK
D. ROW_NUMBER
Answer» D. ROW_NUMBER
389.

Text and Image Functions are ______

A. nondeterministic
B. deterministic
C. table valued
D. All of the mentioned
Answer» B. deterministic
390.

__________ are used for supporting encryption, decryption, digital signing and their validation .

A. Cryptographic functions
B. Cursor functions
C. Configuration functions
D. None of the mentioned
Answer» B. Cursor functions
391.

_____________ function returns current date and time.

A. SET DATEFIRST
B. SYSDATETIME
C. Cert_ID
D. GETDATE
Answer» E.
392.

Which of the data type has storage size of 8 bytes ?

A. timestamp
B. uniqueidentifier
C. real
D. smallmoney
Answer» B. uniqueidentifier
393.

_____________ is monetary data type in SQL Server.

A. Smallmoney
B. sql_variant
C. Cursor
D. None of the Mentioned
Answer» B. sql_variant
394.

________ is a spatial data type .

A. geometry
B. sql_variant
C. cursor
D. all of the mentioned
Answer» C. cursor
395.

________ is a spatial data type.

A. geometry
B. sql_variant
C. cursor
D. all of the mentioned
Answer» C. cursor
396.

Exact Numeric data type is ______

A. bigint
B. int
C. smallmoney
D. all of the mentioned
Answer» E.
397.

The _________ database is used by SQL Server Agent for scheduling alerts and jobs, and recording operators.

A. model
B. msdb
C. master
D. temp
Answer» C. master
398.

_____________ is schematic drawing used for representing relationships in database.

A. Trigger
B. Database Diagrams
C. Table designer
D. Query Editor
Answer» C. Table designer
399.

Which of the following is used to build sql statements without writing code ?

A. Registered Servers
B. Query Designer
C. Template Explorer
D. Context Explorer
Answer» C. Template Explorer
400.

__________menu allows user to set up some keyboard shortcuts.

A. Edit
B. File
C. Tools
D. None of the Mentioned
Answer» D. None of the Mentioned