Learn MYSQL MCQs
Prepare MYSQL MCQs (Multiple choice Questions) for exam and job interviews.
Which keyword is used to combine rows from two or more tables based on a related column?
1) UNION
2) JOIN
3) MERGE
4) LINK
Answer : Option 2
What does the SQL command SELECT * do?
1) Retrieves all columns from a table
2) Retrieves specific columns from a table
3) Retrieves no data
4) Retrieves unique records only
Answer : Option 1
Which SQL clause is used to group rows that have the same values in specified columns?
1) GROUP BY
2) ORDER BY
3) HAVING
4) DISTINCT
Answer : Option 1
What is the function of the MySQL NOW() function?
1) Returns the current date and time
2) Returns the current date
3) Returns the current time
4) Returns the date of the last record
Answer : Option 1
How do you select the first 5 records from a table?
1) SELECT * FROM table_name LIMIT 5;
2) SELECT FIRST 5 FROM table_name;
3) SELECT TOP 5 * FROM table_name;
4) SELECT * FROM table_name MAX 5;
Answer : Option 1
Which command is used to update the data in a MySQL table?
1) CHANGE
2) UPDATE
3) MODIFY
4) SET
Answer : Option 2
What is the purpose of the SQL HAVING clause?
1) To filter records after grouping
2) To sort records
3) To limit the number of records
4) To join tables
Answer : Option 1
Which SQL command is used to create a new user in MySQL?
1) CREATE USER user_name;
2) ADD USER user_name;
3) NEW USER user_name;
4) INSERT USER user_name;
Answer : Option 1
How can you retrieve a random row from a MySQL table?
1) SELECT * FROM table_name ORDER BY RAND() LIMIT 1;
2) SELECT * FROM table_name RANDOM LIMIT 1;
3) SELECT RANDOM FROM table_name;
4) GET RANDOM ROW FROM table_name;
Answer : Option 1
What is the function of the SQL LIKE operator?
1) To search for a specified pattern in a column
2) To match exact values
3) To find records that contain NULL
4) To sort values in a column
Answer : Option 1