Learn MYSQL MCQs

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

What is the command to create a new database in MySQL?

1) CREATE DATABASE database_name;

2) ADD DATABASE database_name;

3) NEW DATABASE database_name;

4) INIT DATABASE database_name;

Answer : Option 1

Which command is used to delete a database in MySQL?

1) DROP DATABASE database_name;

2) REMOVE DATABASE database_name;

3) DELETE DATABASE database_name;

4) TRUNCATE DATABASE database_name;

Answer : Option 1

What is the default port number for MySQL?

1) 3306

2) 8080

3) 1433

4) 1521

Answer : Option 1

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

1) CREATE TABLE table_name (...);

2) INSERT TABLE table_name (...);

3) NEW TABLE table_name (...);

4) ADD TABLE table_name (...);

Answer : Option 1

What is the function of the PRIMARY KEY constraint?

1) Uniquely identifies each row in a table

2) Creates a duplicate key

3) Identifies duplicate records

4) Indexes all columns

Answer : Option 1

Which command is used to insert data into a table in MySQL?

1) INSERT INTO table_name VALUES (...);

2) UPDATE table_name SET (...);

3) ADD TO table_name VALUES (...);

4) NEW RECORD table_name VALUES (...);

Answer : Option 1

How do you retrieve all records from a table?

1) SELECT * FROM table_name;

2) FETCH * FROM table_name;

3) GET ALL FROM table_name;

4) SHOW * FROM table_name;

Answer : Option 1

What is the purpose of the WHERE clause?

1) To filter records based on conditions

2) To sort records

3) To join tables

4) To group records

Answer : Option 1

Which command is used to update records in a table?

1) UPDATE table_name SET column=value WHERE condition;

2) MODIFY table_name SET column=value WHERE condition;

3) CHANGE table_name SET column=value WHERE condition;

4) ALTER table_name SET column=value WHERE condition;

Answer : Option 1

What is the function of the ORDER BY clause?

1) To sort records in ascending or descending order

2) To group records by a column

3) To filter records

4) To limit the number of records

Answer : Option 1