Learn MYSQL MCQs

Prepare MYSQL MCQs (Multiple choice Questions) for exam and job interviews.

What is the purpose of the GRANT command?

1) To assign privileges to a user

2) To create a new user

3) To delete a user

4) To modify user permissions

Answer : Option 1

Which command is used to revoke privileges from a user?

1) REVOKE privilege FROM user;

2) REMOVE privilege FROM user;

3) DELETE privilege FROM user;

4) ERASE privilege FROM user;

Answer : Option 1

What does the COUNT function return?

1) The number of records in a result set

2) The sum of a column

3) The average of a column

4) The maximum value of a column

Answer : Option 1

What is the function of the HAVING clause?

1) To filter groups based on a condition

2) To filter individual records

3) To sort records

4) To limit the number of records

Answer : Option 1

Which command is used to change a user's password in MySQL?

1) SET PASSWORD FOR username@hostname = PASSWORD('newpassword');

2) ALTER PASSWORD FOR username@hostname = PASSWORD('newpassword');

3) CHANGE PASSWORD FOR username@hostname = PASSWORD('newpassword');

4) UPDATE PASSWORD FOR username@hostname = PASSWORD('newpassword');

Answer : Option 1

What does the MAX function return?

1) The maximum value in a column

2) The sum of a column

3) The average of a column

4) The minimum value in a column

Answer : Option 1

Which function is used to concatenate two or more strings?

1) CONCAT(string1, string2, ...)

2) MERGE(string1, string2, ...)

3) JOIN(string1, string2, ...)

4) ADD(string1, string2, ...)

Answer : Option 1

What is the function of the IN clause?

1) To specify multiple values in a WHERE clause

2) To sort records

3) To group records

4) To join tables

Answer : Option 1

Which command is used to backup a MySQL database?

1) mysqldump -u username -p database_name > backup.sql

2) backup -u username -p database_name > backup.sql

3) dump -u username -p database_name > backup.sql

4) save -u username -p database_name > backup.sql

Answer : Option 1

What does the MIN function return?

1) The minimum value in a column

2) The sum of a column

3) The average of a column

4) The maximum value of a column

Answer : Option 1