Learn MYSQL MCQs

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

How do you rename a MySQL database?

1) ALTER DATABASE old_name RENAME TO new_name;

2) RENAME DATABASE old_name TO new_name;

3) CHANGE DATABASE old_name TO new_name;

4) MODIFY DATABASE old_name SET new_name;

Answer : Option 1

Which command is used to fetch records in ascending order?

1) ORDER BY column_name ASC;

2) SORT BY column_name;

3) FILTER BY column_name;

4) GROUP BY column_name ASC;

Answer : Option 1

What is the use of the SQL GROUP_CONCAT function?

1) To concatenate values from multiple rows into a single string

2) To group records by a specific column

3) To count unique values

4) To sum values in a group

Answer : Option 1

How do you disable a trigger in MySQL?

1) ALTER TRIGGER trigger_name DISABLE;

2) DISABLE TRIGGER trigger_name;

3) DROP TRIGGER trigger_name;

4) REMOVE TRIGGER trigger_name;

Answer : Option 1

Which command is used to check the status of the MySQL server?

1) SHOW STATUS;

2) CHECK STATUS;

3) SERVER STATUS;

4) STATUS;

Answer : Option 1

What is the function of the SQL REPLACE() function?

1) To replace occurrences of a substring in a string

2) To find a substring

3) To insert a new record

4) To delete a record

Answer : Option 1

Which keyword is used to create a new table in MySQL?

1) CREATE TABLE table_name;

2) NEW TABLE table_name;

3) ADD TABLE table_name;

4) DEFINE TABLE table_name;

Answer : Option 1

What does the SQL command SELECT DISTINCT do?

1) Retrieves unique values from a column

2) Retrieves all values from a column

3) Retrieves no data

4) Retrieves first occurrence only

Answer : Option 1

How do you specify the character set for a MySQL table?

1) CREATE TABLE table_name (column_name VARCHAR(255) CHARACTER SET charset_name);

2) SET CHARACTER SET FOR table_name;

3) DEFINE CHARACTER SET table_name;

4) CHARACTER SET FOR table_name;

Answer : Option 1

Which command is used to get the index information for a table?

1) SHOW INDEX FROM table_name;

2) DESCRIBE table_name;

3) INDEX TABLE table_name;

4) GET INDEXES FOR table_name;

Answer : Option 1