MySQL MCQs Part 2

 Here are 10 more MySQL MCQs for UGC NET, SET, EMRS, KVS, ISRO, and Assistant Professor exams.


11. What is the purpose of the HAVING clause in MySQL?

A) It filters records before grouping
B) It filters records after grouping
C) It is used to rename columns
D) It is used to join tables

Answer: B) It filters records after grouping


12. Which MySQL function is used to count the number of rows in a table?

A) COUNT()
B) SUM()
C) TOTAL()
D) NUMBER()

Answer: A) COUNT()


13. What does the FOREIGN KEY constraint do in MySQL?

A) Ensures unique values in a column
B) Links a column to a primary key in another table
C) Automatically increments a column value
D) Restricts NULL values in a column

Answer: B) Links a column to a primary key in another table


14. Which command is used to create a backup of a MySQL database?

A) BACKUP DATABASE
B) SAVE DATABASE
C) mysqldump
D) EXPORT DATABASE

Answer: C) mysqldump


15. Which MySQL JOIN returns only matching rows from both tables?

A) LEFT JOIN
B) RIGHT JOIN
C) INNER JOIN
D) FULL JOIN

Answer: C) INNER JOIN


16. How can you change the structure of an existing MySQL table?

A) MODIFY TABLE
B) ALTER TABLE
C) UPDATE TABLE
D) CHANGE TABLE

Answer: B) ALTER TABLE


17. What is the maximum length of a VARCHAR column in MySQL?

A) 255
B) 512
C) 65535
D) 16384

Answer: C) 65535 (depends on row size)


18. What will happen if you use the DROP TABLE command in MySQL?

A) It will remove the table but keep the data
B) It will delete all rows but keep the table structure
C) It will permanently remove the table and its data
D) It will disable the table temporarily

Answer: C) It will permanently remove the table and its data


19. Which MySQL statement is used to retrieve unique records from a table?

A) SELECT UNIQUE
B) SELECT DISTINCT
C) SELECT FILTER
D) SELECT DIFFERENT

Answer: B) SELECT DISTINCT


20. What does the GROUP BY clause do in MySQL?

A) It sorts the data in ascending order
B) It groups records that have the same values in specified columns
C) It deletes duplicate rows from a table
D) It updates multiple records at once

Answer: B) It groups records that have the same values in specified columns



Comments