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

This section includes 81 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.

51.

_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.
52.

_A command that lets you change one or more fields in a record is$?

A. Insert
B. Modify
C. Look-up
D. All of the above
Answer» C. Look-up
53.

_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
54.

_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
55.

_The SQL statementSELECT ROUND(45.926, -1) FROM DUAL;$?

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

_Which operator performs pattern matching?$?

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

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

The wildcard in a WHERE clause is useful when?$?

A. An exact match is necessary in a CREATE statement.
B. An exact match is necessary in a SELECT statement.
C. An exact match is not possible in a SELECT statement.
D. An exact match is not possible in a CREATE statement.
Answer» D. An exact match is not possible in a CREATE statement.
59.

The SQL keyword BETWEEN is used:$?

A. to limit the columns displayed.
B. for ranges.
C. as a wildcard.
D. None of these is correct.
Answer» C. as a wildcard.
60.

In an SQL SELECT statement querying a single table, according to the SQL-92 standard the asterisk (*) means that:$?

A. all columns of the table are to be returned.
B. all records meeting the full criteria are to be returned.
C. all records with even partial criteria met are to be returned.
D. None of the above is correct.
Answer» B. all records meeting the full criteria are to be returned.
61.

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;
62.

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 (
63.

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;
64.

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 (
65.

The SELECT statement SELECT 'Hi' FROM DUAL WHERE NULL = NULL; Outputs

A. Hi
B. FLASE
C. TRUE
D. Nothing
Answer» E.
66.

Which SQL statement is used to delete data FROM a database?

A. COLLAPSE
B. REMOVE
C. ALTER
D. DELETE
Answer» E.
67.

Which SQL keyword is used to retrieve a maximum value?

A. TOP
B. MOST
C. UPPER
D. MAX
Answer» E.
68.

Which of the following query finds the names of the sailors who have reserved at least one boat?

A. SELECT DISTINCT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid;
B. SELECT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid;
C. SELECT DISTINCT s.sname FROM sailors, reserves WHERE s.sid = r.sid;
D. None of These
Answer» B. SELECT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid;
69.

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')
70.

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

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

Which of the following SQL commands can be used to add data to a database table?

A. ADD
B. UPDATE
C. APPEND
D. INSERT
Answer» E.
72.

The result of a SQL SELECT statement is a ________ .

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

Which command undo all the updates performed by the SQL in the transaction?

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

Which of the following SQL query is correct for selecting the name of staffs from 'staffinfo' table where salary is 10,000 or 25,000?

A. SELECT name FROM staffinfo WHERE salary BETWEEN 10000 AND 25000;
B. SELECT name FROM staffinfo WHERE salary IN (10000, 25000);
C. Both A and B
D. None of the above
Answer» C. Both A and B
75.

Which of the following query finds the total rating of the sailors who have reserved boat "103"?

A. SELECT SUM(s.rating) FROM sailors s, reserves r AND r.bid = 103;
B. SELECT s.rating FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103
C. SELECT COUNT(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103
D. SELECT SUM(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103
Answer» E.
76.

Which SQL statement is used to update data in a database?

A. SAVE
B. UPDATE
C. SAVE AS
D. MODIFY
Answer» C. SAVE AS
77.

Which SQL keyword is used to retrieve only unique values?

A. DISTINCTIVE
B. UNIQUE
C. DISTINCT
D. DIFFERENT
Answer» D. DIFFERENT
78.

Find the name of cities with all entries whose temperature is in the range of 71 and 89

A. SELECT * FROM weather WHERE temperature NOT IN (71 to 89);
B. SELECT * FROM weather WHERE temperature NOT IN (71 and 89);
C. SELECT * FROM weather WHERE temperature NOT BETWEEN 71 to 89;
D. SELECT * FROM weather WHERE temperature BETWEEN 71 AND 89;
Answer» E.
79.

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

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;
80.

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

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

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

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