Learn MYSQL MCQs

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

Which MySQL function calculates the difference between two dates?

1) DATEDIFF()

2) DATEPART()

3) DATEADD()

4) DATEDURATION()

Answer : Option 1

What MySQL command is used to show all the columns of a table?

1) SHOW COLUMNS FROM table_name;

2) SHOW ALL COLUMNS IN table_name;

3) DESCRIBE COLUMNS OF table_name;

4) LIST COLUMNS FOR table_name;

Answer : Option 1

How do you display all indexes on a MySQL table?

1) SHOW INDEX FROM table_name;

2) DISPLAY INDEXES FROM table_name;

3) LIST INDEXES IN table_name;

4) DESCRIBE INDEXES OF table_name;

Answer : Option 1

Which MySQL function is used to return the average value of a column?

1) AVG()

2) MEAN()

3) MEDIAN()

4) AVERAGE()

Answer : Option 1

What does the MySQL command ANALYZE TABLE do?

1) Analyzes and optimizes the table for better performance

2) Deletes all data in the table

3) Creates a backup of the table

4) Drops the table from the database

Answer : Option 1

What is the default storage engine for MySQL 5.5 and later?

1) MyISAM

2) InnoDB

3) CSV

4) MEMORY

Answer : Option 2

Which statement is used to insert new data into a MySQL table?

1) ADD INTO

2) INSERT INTO

3) PUT INTO

4) ADD DATA TO

Answer : Option 2

What keyword is used to retrieve only unique values from a column in a SELECT statement?

1) UNIQUE

2) DISTINCT

3) DIFFERENT

4) SINGULAR

Answer : Option 2

What is the purpose of the MySQL command DESCRIBE?

1) To show the structure of a table

2) To show the data in a table

3) To create a new table

4) To delete a table

Answer : Option 1

Which MySQL function is used to convert a string to uppercase?

1) UPPERCASE()

2) UPPER()

3) TO_UPPER()

4) CONVERT_UPPER()

Answer : Option 2