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.

1.

NULL is

A. the same as 0 for integer
B. the same as blank for character
C. the same as 0 for integer and blank for character
D. not a value
Answer» E.
2.

Which of the following is a valid SQL type?

A. CHARACTER
B. NUMERIC
C. FLOAT
D. All of the above
Answer» E.
3.

............. joins two or more tables based on a specified column value not equaling a specified column value in another table.

A. EQUIJOIN
B. NON-EQUIJOIN
C. OUTER JOIN
D. NATURAL JOIN
Answer» C. OUTER JOIN
4.

'AS' clause is used in SQL for

A. Selection operation.
B. Rename operation.
C. Join operation.
D. Projection operation.
Answer» C. Join operation.
5.

In SQL, which command is used to change a table's storage characteristics?

A. ALTER TABLE
B. MODIFY TABLE
C. CHANGE TABLE
D. None of these
Answer» B. MODIFY TABLE
6.

Select the right statement to insert values to the student table.

A. INSERT student VALUES (
B. INSERT VALUES (
C. INSERT INTO student VALUES (
D. INSERT VALUES INTO student (
Answer» D. INSERT VALUES INTO student (
7.

How to select all data from student table starting the name from letter 'r'?

A. SELECT * FROM student WHERE name LIKE 'r%';
B. SELECT * FROM student WHERE name LIKE '%r%';
C. SELECT * FROM student WHERE name LIKE '%r';
D. SELECT * FROM student WHERE name LIKE '_r%';
Answer» B. SELECT * FROM student WHERE name LIKE '%r%';
8.

Which of the following query is correct for using comparison operators in SQL?

A. SELECT name, course_name FROM student WHERE age>50 and <80;
B. SELECT name, course_name FROM student WHERE age>50 and age <80;
C. SELECT name, course_name FROM student WHERE age>50 and WHERE age<80;
D. None of these
Answer» C. SELECT name, course_name FROM student WHERE age>50 and WHERE age<80;
9.

The result of a SQL SELECT statement is a ________.

A. file
B. report
C. table
D. form
Answer» D. form
10.

Which of the following join is also called as an 'inner-join'?

A. Non-Equijoin
B. Self-Join
C. Equijoin
D. None of these
Answer» D. None of these
11.

Table employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE. The SQL statement SELECT COUNT(*) FROM employee WHERE SALARY > ALL (SELECT SALARY FROM EMPLOYEE); prints

A. 10
B. 9
C. 5
D. 0
Answer» E.
12.

Let the statement SELECT column1 FROM myTable; return 10 rows. The statement SELECT ALL column1 FROM myTable; will return

A. less than 10 rows
B. more than 10 rows
C. exactly 10 rows
D. None of these
Answer» D. None of these
13.

If a query involves NOT, AND, OR with no parenthesis

A. NOT will be evaluated first; AND will be evaluated second; OR will be evaluated last.
B. NOT will be evaluated first; OR will be evaluated second; AND will be evaluated last.
C. AND will be evaluated first; OR will be evaluated second; NOT will be evaluated last.
D. The order of occurrence determines the order of evaluation.
Answer» B. NOT will be evaluated first; OR will be evaluated second; AND will be evaluated last.
14.

Which of the following query finds the name of the sailors who have reserved at least two boats?

A. SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND r1.sid = r2.sid AND r1.bid ≠ r2.bid
B. SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND COUNT(r1.bid) > r2.bid
C. SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND r1.sid = r2.sid AND r1.bid <> r2.bid
D. All of these
Answer» D. All of these
15.

What does the following query find? (SELECT DISTINCT r.sid FROM boats b, reserves r WHERE b.bid = r.bid AND b.color = 'red') MINUS (SELECT DISTINCT r.sid FROM boats b, reserves r WHERE b.bid = r.bid AND b.color = 'green')

A. Find the sailor IDs of all sailors who have reserved red boats but not green boats
B. Find the sailor IDs of at least one sailor who have reserved red boats but not green boats
C. Find the sailor Ids of atmost one sailor who have reserved red boats but not green boats
D. None of These
Answer» B. Find the sailor IDs of at least one sailor who have reserved red boats but not green boats
16.

Which of the following query finds colors of boats reserved by "Dustin"?

A. SELECT DISTINCT b.color FROM boats b, sailors s WHERE s.sname = 'Dustin' AND s.sid = b.sid
B. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid AND r.bid = b.bid;
C. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid
D. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND r.bid = b.bid
Answer» C. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid
17.

Find the name of all cities with their temperature, humidity and countries.

A. SELECT city, temperature, humidity, country FROM location;
B. SELECT weather.city, temperature, humidity, country FROM weather, location;
C. SELECT weather.city, temperature, humidity, country FROM weather, location WHERE weather.city = location.city;
D. SELECT weather.city, temperature, humidity FROM weather SELECT country FROM location WHERE weather.city = location.city;
Answer» D. SELECT weather.city, temperature, humidity FROM weather SELECT country FROM location WHERE weather.city = location.city;
18.

Find the names of the countries whose condition is sunny.

A. SELECT country FROM location WHERE condition = 'sunny';
B. SELECT country FROM location WHERE city IN (SELECT city FROM weather WHERE condition = sunny');
C. SELECT country FROM location WHERE city NOT IN (SELECT city FROM weather WHERE condition = 'sunny');
D. SELECT country FROM location WHERE city UNION (SELECT city FROM weather WHERE condition = 'sunny');
Answer» C. SELECT country FROM location WHERE city NOT IN (SELECT city FROM weather WHERE condition = 'sunny');
19.

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

Find all the cities whose humidity is 89

A. SELECT city WHERE humidity = 89;
B. SELECT city FROM weather WHERE humidity = 89;
C. SELECT humidity = 89 FROM weather;
D. SELECT city FROM weather;
Answer» C. SELECT humidity = 89 FROM weather;
21.

The SQL statement SELECT ROUND(45.926, -1) FROM DUAL;

A. is illegal
B. prints garbage
C. prints 045.926
D. prints 50
Answer» E.
22.

The SQL statement SELECT SUBSTR('abcdefghij', INSTR('123321234', '2', 3, 2), 2) FROM DUAL; prints

A. gh
B. 23
C. bc
D. ab
Answer» B. 23
23.

Which of the following must be enclosed in double quotes?

A. Dates
B. Column Alias
C. Strings
D. All of the above
Answer» C. Strings
24.

Table Employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE. The SQL statement SELECT COUNT(*) FROM Employee WHERE SALARY > ANY (SELECT SALARY FROM EMPLOYEE); prints

A. 10
B. 9
C. 5
D. 0
Answer» C. 5
25.

The SQL statement SELECT SUBSTR('123456789', INSTR('abcabcabc', 'b'), 4) FROM DUAL;

A. 6789
B. 2345
C. 1234
D. 456789
Answer» C. 1234
26.

Which of the following group functions ignore NULL values?

A. MAX
B. COUNT
C. SUM
D. All of the above
Answer» E.
27.

Which of the following is a SQL aggregate function?

A. LEFT
B. AVG
C. JOIN
D. LEN
Answer» C. JOIN
28.

What is a view?

A. A view is a special stored procedure executed when certain event occurs.
B. A view is a virtual table which results of executing a pre-compiled query. A view is not part of the physical database schema, while the regular tables are.
C. A view is a database diagram.
D. None of these
Answer» C. A view is a database diagram.
29.

Which of the following SQL commands is used to retrieve data?

A. DELETE
B. INSERT
C. SELECT
D. JOIN
Answer» D. JOIN
30.

The FROM SQL clause is used to...

A. specify what table we are selecting or deleting data FROM
B. specify range for search condition
C. specify search condition
D. None of these
Answer» B. specify range for search condition
31.

Which operator performs pattern matching?

A. BETWEEN operator
B. LIKE operator
C. EXISTS operator
D. None of these
Answer» C. EXISTS operator
32.

The _________ database stores basic configuration information for the server.

A. Master
B. Msdb
C. Tempdb
D. Model
Answer» B. Msdb
33.

Which of the following system database occupies more space and memory?

A. Master
B. Msdb
C. Tempdb
D. Model
Answer» B. Msdb
34.

The supported storage types for data files are :

A. RAM
B. Hard Storage
C. SMB File Share
D. None of the mentioned
Answer» D. None of the mentioned
35.

Which is minimum processor speed for SQL Server 2012 ?

A. 1.4 GHz
B. 2.4 GHz
C. 3.4 GHz
D. 4.4 GHz
Answer» B. 2.4 GHz
36.

Which of the following component is not installed by SQL Server setup 2012 required by the product ?

A. .NET Framework 3.5 SP11
B. Named Pipes
C. SQL Server Setup support files
D. All of the mentioned
Answer» C. SQL Server Setup support files
37.

Which of the following operating system is supported by SQL Server 2014?

A. Windows Server 2012
B. Windows 8 RTM
C. Windows Vista SP2
D. All of the mentioned
Answer» E.
38.

Which of the following is a feature of SQL Server 2014 ?

A. Column oriented database
B. Support for 32-bit and 64-bit processors
C. In memory database
D. All of the mentioned
Answer» E.
39.

Which of the following is a feature of SQL Server 2012 R2 Enterprise ?

A. In memory database
B. Hot-add RAM
C. Database partitioning
D. All of the mentioned
Answer» E.
40.

Which components of SQL Server 2014 require 1182 Mb ?

A. SSIS
B. SSAS
C. Client components
D. SSRS
Answer» D. SSRS
41.

What is SQL Server 2012 R2 Hard Disk Space Requirement for database engine ?

A. 811 Mb
B. 711 Mb
C. 611 Mb
D. 511 Mb
Answer» B. 711 Mb
42.

Which is minimum processor speed for SQL Server 2008 ?

A. 1.4 GHz
B. 2.4 GHz
C. 3.4 GHz
D. 4.4 GHz
Answer» B. 2.4 GHz
43.

The main memory requirements for SQL Server 2008 includes :

A. Minimum:512 MB
B. Minimum:1 GB
C. Maximum:252 MB
D. Maximum:512 MB
Answer» B. Minimum:1 GB
44.

The _________ wizard helps you build a classification model based on existing data in an Excel table.

A. Associate
B. Classify
C. Estimate
D. Aggregate
Answer» C. Estimate
45.

In order to use the Analyze in Excel feature, you must have ___________ installed on the system.

A. SSDT
B. SSMS
C. SSMA
D. None of the mentioned
Answer» B. SSMS
46.

Scenario Analysis tool allows you to model _______ types of scenarios.

A. 2
B. 3
C. 4
D. 5
Answer» B. 3
47.

__________ analyzes the patterns in data that have the strongest influence on a certain outcome.

A. Analyze Key Influencers
B. Detect Categories
C. Fill From Example
D. None of the mentioned
Answer» B. Detect Categories
48.

___________ allows you to analyze your spreadsheet data in powerful ways.

A. Data Mining Templates for Visio
B. Table Analysis Tools for Excel
C. Data Mining Client for Excel
D. All of the mentioned
Answer» C. Data Mining Client for Excel
49.

____________ for Office is a lightweight set of tools for predictive analytics.

A. SQL Server 2008 Data Mining Add-ins
B. SQL Server 2012 Data Mining Add-ins
C. SQL Server 2014 Data Mining Add-ins
D. SQL Server 2012 Data Mining Excel
Answer» C. SQL Server 2014 Data Mining Add-ins
50.

Which of the following statement is used to retrieve rows from the view ExecutionLog3 ?

A. select * from ExecutionLog3 order by TimeStart DESC
B. select * from ExecLog3 order by TimeStart DESC
C. select * from ExecutionLog4 order by TimeStart DESC
D. None of the mentioned
Answer» B. select * from ExecLog3 order by TimeStart DESC