12 Sep 100 MySQL MCQ (Multiple Choice Questions) with Answers
Show Answer
Explanation
2) Which SQL command is used to retrieve data from a MySQL database?
Show Answer
Explanation
3) Which data type is used to store variable-length character strings in MySQL?
Show Answer
Explanation
4) Which clause is used to filter rows based on a specified condition in a SELECT query?
Show Answer
Explanation
5) What is the default port number for MySQL connections?
Show Answer
Explanation
6) Which SQL keyword is used to remove duplicate rows from a result set?
Show Answer
Explanation
7) Which command is used to add a new record into a MySQL table?
Show Answer
Explanation
8) Which statement is used to modify existing records in a table?
Show Answer
Explanation
9) Which command is used to delete all rows from a table without logging individual row deletions?
Show Answer
Explanation
10) Which command permanently deletes a table structure along with all its data?
Show Answer
Explanation
11) Which SQL constraint ensures that all values in a column are unique?
Show Answer
Explanation
12) A PRIMARY KEY constraint automatically implies which combination of constraints?
Show Answer
Explanation
13) How many PRIMARY KEY constraints can a single table have?
Show Answer
Explanation
14) Which SQL clause is used to sort the result set in ascending or descending order?
Show Answer
Explanation
15) What is the default sorting direction of the ORDER BY clause?
Show Answer
Explanation
16) Which wildcard character represents zero, one, or multiple characters in a LIKE query?
Show Answer
Explanation
17) Which wildcard character represents a single character in a LIKE query?
Show Answer
Explanation
18) Which aggregate function returns the total number of rows matching a criteria?
Show Answer
Explanation
19) Which operator is used to search for a specified pattern in a column?
Show Answer
Explanation
20) Which clause is used to group rows that have the same values in specified columns?
Show Answer
Explanation
21) Which clause is used to filter groups created by the GROUP BY clause?
Show Answer
Explanation
22) Which function returns the current date and time in MySQL?
Show Answer
Explanation
23) Which JOIN returns all records from the left table and matched records from the right table?
Show Answer
Explanation
24) Which JOIN returns records that have matching values in both tables?
Show Answer
Explanation
25) What type of JOIN produces a Cartesian product of two tables?
Show Answer
Explanation
26) Which MySQL storage engine supports transactions and foreign keys by default?
Show Answer
Explanation
27) Which SQL statement is used to create a new database?
Show Answer
Explanation
28) Which statement is used to select a database to work with in MySQL?
Show Answer
Explanation
29) Which statement shows all available databases in MySQL?
Show Answer
Explanation
30) Which statement displays the structure of a table (columns, types, keys)?
Show Answer
Explanation
31) Which command is used to add a new column to an existing table?
Show Answer
Explanation
32) Which operator is used to test for NULL values in MySQL?
Show Answer
Explanation
33) Which SQL function replaces NULL with a specified value?
Show Answer
Explanation
34) What does the auto_increment attribute do in MySQL?
Show Answer
Explanation
35) Which keyword is used to limit the number of rows returned by a query in MySQL?
Show Answer
Explanation
36) In LIMIT 10, 5, what does 10 represent?
Show Answer
Explanation
37) Which function is used to convert text to uppercase in MySQL?
Show Answer
Explanation
38) Which function returns the length of a string in characters?
Show Answer
Explanation
39) Which mathematical function returns the highest value from a column?
Show Answer
Explanation
40) Which operator is used to filter values within an inclusive range?
Show Answer
Explanation
41) Which operator allows specifying multiple discrete values in a WHERE clause?
Show Answer
Explanation
42) What is the purpose of a Foreign Key in MySQL?
Show Answer
Explanation
43) Which command grants privileges to MySQL users?
Show Answer
Explanation
44) Which command removes privileges from a MySQL user?
Show Answer
Explanation
45) Which privilege allows a user to create new tables and databases?
Show Answer
Explanation
46) Which command saves all pending transaction changes to the database?
Show Answer
Explanation
47) Which command undoes transaction changes made since the last commit?
Show Answer
Explanation
48) Which MySQL log records all statements that change database data?
Show Answer
Explanation
49) What does DDL stand for in database terminology?
Show Answer
Explanation
50) Which of the following is a DML command?
Show Answer
Explanation
51) Which of the following is a DDL command?
Show Answer
Explanation
52) What is the result of SELECT 5 + NULL; in MySQL?
Show Answer
Explanation
53) Which function removes leading and trailing spaces from a string?
Show Answer
Explanation
54) Which index type is created automatically when a PRIMARY KEY is defined?
Show Answer
Explanation
55) Which keyword is used to rename a column or table in a SELECT output?
Show Answer
Explanation
56) Which function extracts the year part from a DATE or DATETIME expression?
Show Answer
Explanation
57) How do you write a single-line comment in MySQL?
Show Answer
Explanation
58) What is the purpose of the MySQL EXPLAIN keyword?
Show Answer
Explanation
59) Which function is used to concatenate two or more strings together?
Show Answer
Explanation
60) What is a View in MySQL?
Show Answer
Explanation
61) Which command is used to create a view?
Show Answer
Explanation
62) What is a Stored Procedure in MySQL?
Show Answer
Explanation
63) Which SQL keyword is used to execute a Stored Procedure in MySQL?
Show Answer
Explanation
64) What is a MySQL Trigger?
Show Answer
Explanation
65) Which events can trigger a database trigger in MySQL?
Show Answer
Explanation
66) What does the CHAR data type store?
Show Answer
Explanation
67) What is the storage size of the TINYINT data type in bytes?
Show Answer
Explanation
68) What is the maximum range of signed values for a TINYINT column?
Show Answer
Explanation
69) Which data type is best suited for storing monetary values with exact precision?
Show Answer
Explanation
70) What is the default string matching behavior in MySQL standard string queries?
Show Answer
Explanation
71) Which operator is used for bitwise AND operations in MySQL?
Show Answer
Explanation
72) Which condition tests if a subquery returns any rows?
Show Answer
Explanation
73) Which set operator combines the results of two queries and removes duplicate rows?
Show Answer
Explanation
74) What is the difference between UNION and UNION ALL?
Show Answer
Explanation
75) Which function returns the current logged-in MySQL user and hostname?
Show Answer
Explanation
76) Which command reloads the grant tables in MySQL?
Show Answer
Explanation
77) Which clause is used to assign default values to a column if no value is provided?
Show Answer
Explanation
78) What does ACID stand for in transaction processing?
Show Answer
Explanation
79) Which engine storage type stores all data in RAM for fast access?
Show Answer
Explanation
80) What command is used to delete a database in MySQL?
Show Answer
Explanation
81) Which command is used to create an index on a table?
Show Answer
Explanation
82) What is the main purpose of creating an index on a table?
Show Answer
Explanation
83) Which function calculates the average value of a numeric column?
Show Answer
Explanation
84) Which statement returns all records from a table named employees?
Show Answer
Explanation
85) What does the ON DELETE CASCADE option mean for foreign keys?
Show Answer
Explanation
86) Which function returns the current database name in use?
Show Answer
Explanation
87) How do you write a multi-line comment in MySQL?
Show Answer
Explanation
88) Which data type is best used for storing binary large objects like images or files?
Show Answer
Explanation
89) What is the default date format in MySQL?
Show Answer
Explanation
90) Which function is used to get the number of days between two dates?
Show Answer
Explanation
91) What does the CHECK constraint do in MySQL?
Show Answer
Explanation
92) Which character set is recommended in modern MySQL for full Unicode support (including emojis)?
Show Answer
Explanation
93) Which statement is used to remove an index named idx_name from table_name?
Show Answer
Explanation
94) Which clause limits query results based on aggregate calculations?
Show Answer
Explanation
95) What is a subquery in MySQL?
Show Answer
Explanation
96) Which command shows all active threads/queries running in MySQL?
Show Answer
Explanation
97) Which clause is used to set savepoints inside a transaction?
Show Answer
Explanation
98) Which MySQL system variable stores the auto-increment step value?
Show Answer
Explanation
99) Which function returns the auto-generated ID from the last INSERT statement executed by the connection?
Show Answer
Explanation
100) What does the COALESCE() function return?
No Comments