Olete.in
Articles
Mock Tests
🧪 SQL MCQ Quiz Hub
SQL MCQ SET 1
Choose a topic to test your knowledge and improve your SQL skills
1. The expression 12 DIV 5 evaluates to ____________
2.4
2
error
0
2. If the PIPES_AS_CONCAT is disabled, 'abc' || 'xyz' results in ____________
1
0
error
-1
3. 'abc' || 'xyz', when PIPES_AS_CONCAT is enabled, results in ____________
0
1
abcxyz
xyzabc
4. The expression 2 BETWEEN 2 AND 5 results in ____________
TRUE
FALSE
-1
2
5. The expression HI LIKE NULL results in _____________
TRUE
FALSE
NULL
0
6. Which of the following is the correct order of precedence (high to low)?
!, ^, <<, XOR
^, !, <<, XOR
!, <<, XOR, ^
!, ^, XOR, <<
7. 0x61 + 0 results in _____________
0
'a'
97
arbitrary
8. The AUTO_INCREMENT column attribute is best used with which type?
FLOAT
INT
CHARACTER
DOUBLE
9. Which datatype is best suited to store currency values?
INT
FLOAT
DOUBLE
DECIMAL
10. If a column is expected to store values up to 2 million, the best datatype for it is _____________
SMALLINT
TINYINT
MEDIUMINT
BIGINT
11. Which of these types store the longest length of strings?
CHAR
VARCHAR
TINYTEXT
TEXT
12. Which of these values is not valid as an AUTO_INCREMENT value?
0
1
2
3
13. If an integer column is used for the values in range 1 to 99999, the best suitable datatype is ____________
MEDIUMINT SIGNED
MEDIUMINT UNSIGNED
SMALLINT SIGNED
SMALLINT UNSIGNED
14. INT2 maps to MySQL type _____________
TINYINT
SMALLINT
MEDIUMINT
BIGINT
15. INT3 maps to MySQL type _____________
TINYINT
SMALLINT
MEDIUMINT
BIGINT
16. Which of these return a result to the client?
Stored functions
Stored procedures
Triggers
Events
17. Which of these is defined to execute when the table is modified only?
Stored functions
Stored procedures
Triggers
Events
18. What executes on a time activated basis according to a schedule?
Stored program
Events
Triggers
Stored procedures
19. Which character does the mysql client program recognize as a statement delimiter?
Stored functions
Stored procedures
Triggers
Events
20. Which command is used to redefined the mysql delimiter?
redefine_delim
delim_redefine
delimiter
redefine
21. Which of the following statements does not modify the table?
INSERT
UPDATE
DELETE
SELECT
22. To produce a stored function, which statement is used?
PRODUCE FUNCTION
CREATE FUNCTION
PRODUCE PROCEDURE
CREATE PROCEDURE
23. How many values can be returned from a given stored function?
0
1
2
3
24. How many values can be returned from a stored procedure?
0
1
2
3
25. Suppose a stored function named PI() is written in the database sampdb. How would it be called?
PI()
sampdb.PI()
MySQL.PI()
db.PI()
26. Which privilege must be given to the database to create a stored function or procedure?
CREATE ROUTINE
CREATE METHOD
CREATE FUNCTION
CREATE PROCEDURE
27. Which variable is set to zero when automatic privilege granting is not needed?
automatic_sp_privileges
automatic_ps_privileges
automatic_pg_privileges
automatic_gp_privileges
28. Which procedure parameter enables the caller to pass in a value and get back a value?
IN
OUT
INOUT
GETINOUT
29. For the same input parameters, if the stored function returns the same result, it is called _____________
deterministic
non deterministic
regular
monotonous
30. What is abc in the following MySQL statement?
action
condition value
statement
null
31. Which statement is used to create a trigger?
CREATE TRIGGER
CREATE TRIGGERS
PRODUCE TRIGGER
PRODUCE TRIGGERS
32. For which of the following are triggers not supported?
delete
update
insert
views
33. Which statement is used to remove a trigger?
REMOVE
DELETE
DROP
CLEAR
34. Before MySQL 5.1.6 which privilege was required to create and drop triggers?
PRIVILEGE
TRIGGER
SUPER
MACRO
35. What is abc in the following MySQL statement?
trigger name
table name
trigger statement
update statement
36. Which of these is a stored program associated with a schedule?
Trigger
Event
Stored function
Stored procedure
37. Which of the following lines is used to turn on the event scheduler?
event_scheduler = ON
eventscheduler = ON
event_scheduler_ON
events_scheduler_ON
38. Which statement is used to check the status of the event scheduler at runtime?
SHOW STATUS OF 'event_scheduler'
SHOW VARIABLES OF 'event_scheduler'
SHOW STATUS LIKE 'event_scheduler'
SHOW VARIABLES LIKE 'event_scheduler'
39. Which value of event_scheduler enables checking status but not changing it at runtime?
ON
OFF
DISABLED
ENABLED
40. Which log does the event scheduler log to?
error
record
library
update
41. Which clause specifies periodic execution at fixed intervals?
EVERY
ALL
AT
ALTERNATE
42. To create or drop events for a database, which privilege should be granted?
CREATE
DROP
PRIVILEGE
EVENT
43. The default definer of an event is the user who _______________
created the database
created the event
created the table
created the column
44. The creation of a stored program is similar to the definition of a _______________
Trigger
Event
View
Table
45. When the security context enables carefully written stored programs to be set up that provide controlled access to tables for users, it is called __________
good
bad
illegal
fare
46. When a user creates a stored program that accesses sensitive data but forgets that other people who can invoke the object have the same access, the security context is __________
good
bad
illegal
fare
47. A stored procedure is invoked using the statement __________
INVOKE
SEE
CALL
RETURN
48. What produces result sets?
View
SELECT
Stored function
Trigger
49. Which privilege is enabled to create of alter a stored function?
SUPER
PRIOR
TOP
SUPERIOR
Submit