

MCQOPTIONS
Saved Bookmarks
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.
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. |
Count function in SQL returns the number of%! |
A. | values. |
B. | distinct values. |
C. | groups. |
D. | columns. |
Answer» B. distinct values. | |
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. |
Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy%! |
A. | SELECT city, temperature, condition FROM weather WHERE condition NOT IN ('sunny', 'cloudy'); |
B. | SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny', 'cloudy'); |
C. | SELECT city, temperature, condition FROM weather WHERE condition IN ('sunny', 'cloudy'); |
D. | SELECT city, temperature, condition FROM weather WHERE condition BETWEEN ('sunny', 'cloudy'); |
Answer» B. SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny', 'cloudy'); | |
6. |
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%'; | |
7. |
What is an SQL virtual table that is constructed from other tables?%! |
A. | view |
B. | A relation |
C. | Just another table |
D. | Query results |
Answer» B. A relation | |
8. |
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. | |
9. |
The SQL keyword(s) ________ is used with wildcards.%! |
A. | NOT IN only |
B. | LIKE only |
C. | IN only |
D. | IN and NOT IN |
Answer» C. IN only | |
10. |
Which of the following do you need to consider when you make a table in SQL?%! |
A. | Data types |
B. | Primary keys |
C. | Default values |
D. | All of the above. |
Answer» E. | |
11. |
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 | |
12. |
Which of the following group functions ignore NULL values?%! |
A. | MAX |
B. | COUNT |
C. | SUM |
D. | All of the above |
Answer» E. | |
13. |
Which of the following is a SQL aggregate function?%! |
A. | LEFT |
B. | AVG |
C. | JOIN |
D. | LEN |
Answer» C. JOIN | |
14. |
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 | |
15. |
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 | |
16. |
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; | |
17. |
Let the statementSELECT column1 FROM myTable;return 10 rows. The statementSELECT 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 | |
18. |
*$_Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy? |
A. | SELECT city, temperature, condition FROM weather WHERE condition NOT IN ('sunny', 'cloudy'); |
B. | SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny', 'cloudy'); |
C. | SELECT city, temperature, condition FROM weather WHERE condition IN ('sunny', 'cloudy'); |
D. | SELECT city, temperature, condition FROM weather WHERE condition BETWEEN ('sunny', 'cloudy'); |
Answer» B. SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny', 'cloudy'); | |
19. |
*/*_Let the statementSELECT column1 FROM myTable;return 10 rows. The statementSELECT 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 | |
20. |
*/*_Which of the following group functions ignore NULL values?? |
A. | MAX |
B. | COUNT |
C. | SUM |
D. | All of the above |
Answer» E. | |
21. |
*/*_Which of the following is a SQL aggregate function?? |
A. | LEFT |
B. | AVG |
C. | JOIN |
D. | LEN |
Answer» C. JOIN | |
22. |
*/*_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 | |
23. |
*/*_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 | |
24. |
*/*_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; | |
25. |
*/*_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 | |
26. |
*/*_In SQL, which command(s) is(are) used to change a table's storage characteristics?? |
A. | ALTER TABLE |
B. | MODIFY TABLE |
C. | CHANGE TABLE |
D. | All of the above |
Answer» B. MODIFY TABLE | |
27. |
*/*_What is an SQL virtual table that is constructed from other tables?? |
A. | view |
B. | A relation |
C. | Just another table |
D. | Query results |
Answer» B. A relation | |
28. |
*/*_The SQL keyword(s) ________ is used with wildcards.? |
A. | NOT IN only |
B. | LIKE only |
C. | IN only |
D. | IN and NOT IN |
Answer» C. IN only | |
29. |
*/*_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. | |
30. |
*/*_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%'; | |
31. |
*/*_Which of the following do you need to consider when you make a table in SQL?? |
A. | Data types |
B. | Primary keys |
C. | Default values |
D. | All of the above. |
Answer» E. | |
32. |
%_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. | |
33. |
_ 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 | |
34. |
_ 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. | |
35. |
_ The SQL statementSELECT SUBSTR('123456789', INSTR('abcabcabc', 'b'), 4) FROM DUAL;$? |
A. | 6789 |
B. | 2345 |
C. | 1234 |
D. | 456789 |
Answer» C. 1234 | |
36. |
_ Which of the following SQL commands is used to retrieve data?$? |
A. | DELETE |
B. | INSERT |
C. | SELECT |
D. | JOIN |
Answer» D. JOIN | |
37. |
_ Which of the SQL statements is correct?$? |
A. | SELECT Username AND Password FROM Users |
B. | SELECT Username, Password FROM Users |
C. | SELECT Username, Password WHERE Username = 'user1' |
D. | None of these |
Answer» C. SELECT Username, Password WHERE Username = 'user1' | |
38. |
_ What does the following query find?(SELECT DISTINCT r.sidFROM boats b, reserves rWHERE b.bid = r.bidAND b.color = 'red')MINUS(SELECT DISTINCT r.sidFROM boats b, reserves rWHERE b.bid = r.bidAND 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 | |
39. |
_ 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'); | |
40. |
_ 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 | |
41. |
_ What operator tests column for the absence of data?$? |
A. | EXISTS operator |
B. | NOT operator |
C. | IS NULL operator |
D. | None of these |
Answer» D. None of these | |
42. |
_ Which of the following is NOT a type of SQL constraint?$? |
A. | PRIMARY KEY |
B. | ALTERNATE KEY |
C. | FOREIGN KEY |
D. | UNIQUE |
Answer» C. FOREIGN KEY | |
43. |
_ The command to eliminate a table from a database is:$? |
A. | DROP TABLE CUSTOMER; |
B. | DELETE TABLE CUSTOMER; |
C. | REMOVE TABLE CUSTOMER; |
D. | UPDATE TABLE CUSTOMER; |
Answer» B. DELETE TABLE CUSTOMER; | |
44. |
_ What SQL command can be used to add columns to a table?$? |
A. | ALTER TABLE TableName ADD ColumnName |
B. | ALTER TABLE TableName ADD COLUMN ColumnName |
C. | MODIFY TABLE TableName ADD ColumnName |
D. | MODIFY TABLE TableName ADD COLUMN ColumnName |
Answer» B. ALTER TABLE TableName ADD COLUMN ColumnName | |
45. |
_ 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; | |
46. |
_ The HAVING clause does which of the following?$? |
A. | Acts EXACTLY like a WHERE clause. |
B. | Acts like a WHERE clause but is used for columns rather than groups. |
C. | Acts like a WHERE clause but is used for groups rather than rows. |
D. | Acts like a WHERE clause but is used for rows rather than columns. |
Answer» D. Acts like a WHERE clause but is used for rows rather than columns. | |
47. |
_Find the temperature in increasing order of all cities$? |
A. | SELECT city FROM weather ORDER BY temperature; |
B. | SELECT city, temperature FROM weather; |
C. | SELECT city, temperature FROM weather ORDER BY temperature; |
D. | SELECT city, temperature FROM weather ORDER BY city; |
Answer» D. SELECT city, temperature FROM weather ORDER BY city; | |
48. |
_............. 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 | |
49. |
_Which of the following is illegal?$? |
A. | SELECT SYSDATE - SYSDATE FROM DUAL; |
B. | SELECT SYSDATE - (SYSDATE - 2) FROM DUAL; |
C. | SELECT SYSDATE - (SYSDATE + 2) FROM DUAL; |
D. | None of these |
Answer» E. | |
50. |
_Which SQL keyword is used to sort the result-set?$? |
A. | SORT BY |
B. | ORDER |
C. | ORDER BY |
D. | SORT |
Answer» D. SORT | |