Learn MYSQL MCQs

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

How can you change the name of 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

What does the SQL command INSERT INTO do?

1) Adds new records to a table

2) Removes records from a table

3) Updates existing records in a table

4) Creates a new table

Answer : Option 1

Which function is used to get the maximum value from a column in MySQL?

1) MAX()

2) HIGHEST()

3) TOP()

4) MAXIMUM()

Answer : Option 1

What does the SQL keyword AS do?

1) Renames a column or table

2) Defines a constraint

3) Sets a default value

4) Creates an index

Answer : Option 1

How can you retrieve records from multiple tables in MySQL?

1) Using JOIN clauses

2) Using UNION

3) Using COMBINE

4) Using LINK

Answer : Option 1

What does the SQL command DROP TABLE do?

1) Deletes a table and all its records

2) Removes a table structure only

3) Truncates a table

4) Alters a table

Answer : Option 1

Which MySQL function converts a string to a date?

1) STR_TO_DATE()

2) TO_DATE()

3) CAST_TO_DATE()

4) DATE_CONVERT()

Answer : Option 1

What is the purpose of the MySQL command EXPLAIN?

1) Describes how MySQL executes a query

2) Displays the results of a query

3) Optimizes a query

4) Creates a new index

Answer : Option 1

Which command is used to create a view in MySQL?

1) CREATE VIEW view_name AS SELECT columns;

2) NEW VIEW view_name FROM SELECT columns;

3) ADD VIEW view_name SELECT columns;

4) DEFINE VIEW view_name AS SELECT columns;

Answer : Option 1

What is a stored procedure in MySQL?

1) A prepared SQL code that can be saved and reused

2) A temporary table

3) An index for performance

4) A type of JOIN

Answer : Option 1