Learn MYSQL MCQs

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

How do you create a new table in MySQL?

1) CREATE TABLE table_name;

2) NEW TABLE table_name;

3) ADD TABLE table_name;

4) MAKE TABLE table_name;

Answer : Option 1

Which command is used to update existing records in a MySQL table?

1) UPDATE

2) CHANGE

3) MODIFY

4) ALTER

Answer : Option 1

How can you get the total number of records in a table?

1) COUNT(*)

2) SUM(*)

3) TOTAL(*)

4) NUMBER(*)

Answer : Option 1

What is the correct syntax for creating a database in MySQL?

1) CREATE DATABASE database_name;

2) NEW DATABASE database_name;

3) ADD DATABASE database_name;

4) MAKE DATABASE database_name;

Answer : Option 1

Which command is used to delete a database in MySQL?

1) DROP DATABASE database_name;

2) DELETE DATABASE database_name;

3) REMOVE DATABASE database_name;

4) CLEAR DATABASE database_name;

Answer : Option 1

What keyword is used to sort the result set in a SELECT statement?

1) SORT BY

2) ORDER BY

3) ARRANGE BY

4) GROUP BY

Answer : Option 2

How do you retrieve the last inserted ID in MySQL?

1) LAST_INSERT_ID()

2) GET_LAST_ID()

3) FETCH_LAST_ID()

4) RETURN_LAST_ID()

Answer : Option 1

Which MySQL function is used to find the length of a string?

1) LENGTH()

2) SIZE()

3) CHAR_LENGTH()

4) STRING_LENGTH()

Answer : Option 1

What is the purpose of the MySQL LIMIT clause?

1) To specify the maximum number of records to return

2) To filter records based on conditions

3) To group records by a specific field

4) To sort records in a specific order

Answer : Option 1

How do you create an index on a MySQL table?

1) CREATE INDEX index_name ON table_name (column_name);

2) ADD INDEX index_name TO table_name (column_name);

3) NEW INDEX index_name IN table_name (column_name);

4) SET INDEX index_name FOR table_name (column_name);

Answer : Option 1