Learn MYSQL MCQs
Prepare MYSQL MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of the SQL INSERT IGNORE statement?
1) To insert a new row and ignore errors
2) To insert a new row only if it does not exist
3) To update an existing row
4) To replace a row
Answer : Option 1
Which SQL statement is used to create a new table in MySQL?
1) NEW TABLE table_name;
2) CREATE TABLE table_name;
3) ADD TABLE table_name;
4) DEFINE TABLE table_name;
Answer : Option 2
What does the SQL SELECT COUNT(*) function return?
1) The number of rows in a table
2) The number of columns in a table
3) The number of unique values
4) The maximum value in a column
Answer : Option 1
What is the purpose of the SQL LIMIT clause?
1) To restrict the number of records returned
2) To filter records
3) To sort records
4) To group records
Answer : Option 1
How do you update a record in a MySQL table?
1) UPDATE table_name SET column_name=value WHERE condition;
2) CHANGE table_name SET column_name=value WHERE condition;
3) MODIFY table_name SET column_name=value WHERE condition;
4) ALTER table_name SET column_name=value WHERE condition;
Answer : Option 1
Which SQL statement is used to delete a table in MySQL?
1) DELETE TABLE table_name;
2) DROP TABLE table_name;
3) REMOVE TABLE table_name;
4) CLEAR TABLE table_name;
Answer : Option 2
What does the SQL GROUP BY clause do?
1) Groups rows that have the same values
2) Orders the result set
3) Filters records
4) Limits the number of records
Answer : Option 1
How can you select unique values from a column?
1) SELECT UNIQUE column_name FROM table_name;
2) SELECT DISTINCT column_name FROM table_name;
3) SELECT DIFFERENT column_name FROM table_name;
4) SELECT UNIQUE VALUES column_name FROM table_name;
Answer : Option 2
What is the function of the SQL COALESCE() function?
1) Returns the first non-null value in a list
2) Counts the number of rows
3) Concatenates strings
4) Finds the maximum value
Answer : Option 1
Which SQL statement is used to change the name of a column in MySQL?
1) ALTER TABLE table_name CHANGE old_column_name new_column_name;
2) MODIFY TABLE table_name CHANGE old_column_name new_column_name;
3) RENAME COLUMN old_column_name TO new_column_name;
4) CHANGE COLUMN old_column_name TO new_column_name;
Answer : Option 1