Learn MYSQL MCQs

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

How do you delete records from a table?

1) DELETE FROM table_name WHERE condition;

2) REMOVE FROM table_name WHERE condition;

3) ERASE FROM table_name WHERE condition;

4) CLEAR FROM table_name WHERE condition;

Answer : Option 1

Which command is used to add a new column to an existing table?

1) ALTER TABLE table_name ADD column_name datatype;

2) INSERT INTO table_name ADD column_name datatype;

3) UPDATE table_name ADD column_name datatype;

4) MODIFY table_name ADD column_name datatype;

Answer : Option 1

What is the purpose of the GROUP BY clause?

1) To group records with identical values

2) To sort records

3) To filter records

4) To join tables

Answer : Option 1

Which function is used to calculate the sum of a column?

1) SUM(column_name)

2) TOTAL(column_name)

3) ADD(column_name)

4) SUMMATION(column_name)

Answer : Option 1

What is the function of the JOIN clause?

1) To combine rows from two or more tables

2) To filter records

3) To sort records

4) To group records

Answer : Option 1

Which command is used to remove a table from a database?

1) DROP TABLE table_name;

2) DELETE TABLE table_name;

3) REMOVE TABLE table_name;

4) ERASE TABLE table_name;

Answer : Option 1

What is the purpose of the DISTINCT keyword?

1) To return only unique records

2) To filter records

3) To sort records

4) To join tables

Answer : Option 1

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

1) AVG(column_name)

2) MEAN(column_name)

3) AVERAGE(column_name)

4) MEDIAN(column_name)

Answer : Option 1

What is the purpose of the LIMIT clause?

1) To specify the maximum number of records to return

2) To filter records

3) To sort records

4) To group records

Answer : Option 1

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

1) CREATE USER username@hostname IDENTIFIED BY 'password';

2) NEW USER username@hostname IDENTIFIED BY 'password';

3) ADD USER username@hostname IDENTIFIED BY 'password';

4) INSERT USER username@hostname IDENTIFIED BY 'password';

Answer : Option 1