Learn MYSQL MCQs
Prepare MYSQL MCQs (Multiple choice Questions) for exam and job interviews.
Which SQL clause is used to filter results from a database?
1) WHERE
2) ORDER BY
3) HAVING
4) FILTER
Answer : Option 1
How do you retrieve unique records 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 ONLY column_name FROM table_name;
Answer : Option 2
Which command is used to remove an index from a table?
1) DROP INDEX index_name;
2) DELETE INDEX index_name;
3) REMOVE INDEX index_name;
4) CLEAR INDEX index_name;
Answer : Option 1
What does the SQL function IFNULL() do?
1) Returns the first argument if it is not NULL, otherwise returns the second argument
2) Returns the second argument if the first is NULL
3) Returns NULL if both arguments are NULL
4) Ignores NULL values in a query
Answer : Option 1
How can you retrieve the first 10 records from a table?
1) SELECT * FROM table_name LIMIT 10;
2) SELECT TOP 10 * FROM table_name;
3) GET FIRST 10 RECORDS FROM table_name;
4) FETCH FIRST 10 FROM table_name;
Answer : Option 1
Which MySQL function can be used to format a date?
1) FORMAT_DATE()
2) DATE_FORMAT()
3) FORMAT()
4) TO_DATE()
Answer : Option 2
What is a composite key in MySQL?
1) A key that consists of two or more columns
2) A key that consists of one column
3) A key that cannot be NULL
4) A unique key for each row
Answer : Option 1
Which statement is true about MySQL transactions?
1) They are all-or-nothing operations.
2) They can only update one row.
3) They cannot be rolled back.
4) They require a special command.
Answer : Option 1
What is the purpose of the SQL JOIN clause?
1) To combine rows from two or more tables
2) To filter rows from a single table
3) To group rows based on a column
4) To sort rows
Answer : Option 1
How can you find the average value of a column in MySQL?
1) SELECT AVG(column_name) FROM table_name;
2) SELECT MEAN(column_name) FROM table_name;
3) SELECT AVERAGE(column_name) FROM table_name;
4) SELECT SUM(column_name) / COUNT(column_name) FROM table_name;
Answer : Option 1