MySQL Quiz - MCQ - Multiple Choice Questions with Answers

MySQL is an open-source relational database system, which means it uses a structured method to organize data into tables that can be related to each other.

Dive into the world of MySQL with this beginner's quiz! Test your knowledge of the fundamental concepts and check your understanding of this popular relational database system. Each question is accompanied by an answer and a brief explanation, so you can learn as you go!

1. Which SQL command is used to retrieve data from a database?

A. INSERT
B. DELETE
C. SELECT
D. UPDATE

2. Which SQL statement is used to remove a table from the database?

A. DELETE TABLE
B. DROP TABLE
C. REMOVE TABLE
D. CLEAR TABLE

3. Which keyword is used to sort the result set in ascending order?

A. SORT
B. ORDER
C. ORDER BY
D. SORT BY

4. How can you fetch unique values from a column?

A. UNIQUE
B. DISTINCT
C. SINGLE
D. UNO

5. Which of the following SQL commands will delete all records from a table named customers but retain the table structure?

A. DROP TABLE customers;
B. TRUNCATE TABLE customers;
C. DELETE TABLE customers;
D. REMOVE ALL FROM customers;

6. In which SQL command would you use the WHERE clause?

A. INSERT
B. UPDATE
C. CREATE
D. ALTER

7. What is the default sort order of the ORDER BY clause?

A. DESC
B. ASC
C. RANDOM
D. NONE

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

A. ADD COLUMN
B. NEW COLUMN
C. INSERT COLUMN
D. ALTER TABLE

9. Which data type is used to store text values in MySQL?

A. CHAR
B. INT
C. FLOAT
D. BOOL

10. Which keyword is used to join two tables in SQL?

A. CONNECT
B. LINK
C. JOIN
D. COMBINE

11. Which MySQL function returns the current date and time?

A. NOW()
B. DATE()
C. TODAY()
D. TIMESTAMP()

12. What does SQL stand for?

A. Structured Quality Language
B. Simple Query Logic
C. Structured Query Language
D. System Query Language

13. Which command is used to create a new database in MySQL?

A. CREATE NEW DATABASE
B. ADD DATABASE
C. NEW DATABASE
D. CREATE DATABASE

14. Which operator is used to compare if two values are not equal?

A. !=
B. <>
C. ><
D. Both A and B

15. Which MySQL data type is used to store large blocks of text?

A. TEXT
B. CHAR
C. BIGCHAR
D. LARGETEXT

16. Which SQL clause is used to filter the results returned by a query?

A. SORT BY
B. FILTER BY
C. WHERE
D. HAVING

17. Which command is used to back up a MySQL database?

A. BACKUP DATABASE
B. SAVE DATABASE
C. mysqldump
D. mysqlsave

18. Which SQL statement is used to insert a new record in a table?

A. ADD RECORD
B. INSERT NEW
C. INSERT INTO
D. ADD INTO

19. What type of JOIN returns only rows when there is at least one match in both tables?

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

20. Which MySQL function can be used to return the length of a string?

A. LENGTH()
B. SIZE()
C. STRLEN()
D. COUNT()

21. Which keyword can be used to specify a unique constraint for a table column?

A. UNIQUE
B. DISTINCT
C. SINGLE
D. RARE

22. In MySQL, which command is used to return the version of the MySQL server?

A. SELECT VERSION();
B. GET VERSION();
C. SELECT MYSQLVERSION();
D. SELECT SERVER();

23. Which SQL statement is used to update data in a database?

A. REFRESH
B. MODIFY
C. REPLACE
D. UPDATE

24. Which of the following is not a valid SQL data type?

A. FLOAT
B. CHAR
C. SINGLE
D. DECIMAL

25. Which clause is used with the GROUP BY clause to filter grouped results in SQL?

A. WHERE
B. ORDER BY
C. HAVING
D. LIKE

26. Which of the following is used to make a column's value automatically increase for each new record?

A. AUTOINCREMENT
B. AUTOADD
C. INCREMENTAL
D. ADDAUTO

27. How do you select all columns from a table named "students"?

A. SELECT * INTO students;
B. SELECT students.*;
C. SELECT ALL FROM students;
D. SELECT * FROM students;

28. What would be the result of the following SQL query: SELECT UPPER('mysql');?

A. mysql
B. MYSQL
C. UPPER
D. None of the above

29. Which SQL function is used to round a number?

A. ROUND
B. RND
C. CIRCLE
D. LOOP

30. Which of the following is not an SQL aggregate function?

A. COUNT()
B. MAX()
C. CONCAT()
D. SUM()

31. Which command is used to remove a specific row from a table?

A. REMOVE
B. DROP
C. DELETE
D. DESTROY

32. Which keyword defines a primary key constraint on a table in MySQL?

A. PRIMARY
B. MAIN
C. UNIQUE
D. PRIMARY KEY

33. Which keyword would you use to rename a table in MySQL?

A. RENAME
B. RENAME TABLE
C. ALTER
D. CHANGE TABLE

34. Which SQL statement is used to access data from multiple tables based on a relationship between certain columns?

A. COMBINE
B. UNION
C. JOIN
D. MERGE

35. What is the maximum length of a table name in MySQL?

A. 64 characters
B. 128 characters
C. 256 characters
D. 512 characters

36. Which MySQL function returns the smallest integer value not less than a number?

A. CEILING()
B. FLOOR()
C. ROUNDUP()
D. TOP()

37. Which SQL keyword is used to retrieve a maximum of 5 records from a table?

A. FETCH
B. TOP
C. LIMIT
D. GET

38. What is the SQL query for retrieving all records from a table named 'products' where the price is greater than 50?

A. SELECT * FROM products WHERE price > 50;
B. FETCH * FROM products WHEN price > 50;
C. GET * FROM products HAVING price > 50;
D. RECEIVE * FROM products WHERE price > 50;

39. Which SQL clause is used to specify a condition while fetching data from a table?

A. DECISION
B. CHECK
C. WHERE
D. CONDITION

40. What is the primary purpose of creating an index on a MySQL column?

A. To consume more disk space.
B. To slow down SELECT query performance.
C. To improve the speed of retrieval operations.
D. To enhance the look of the database.

41. Which of the following tools can be used to analyze query performance in MySQL?

A. EXPLAIN
B. DEBUG
C. TRACE
D. LISTEN

42. Which storage engine in MySQL supports transactions?

A. MEMORY
B. MERGE
C. MyISAM
D. InnoDB

Comments

Spring Boot 3 Paid Course Published for Free
on my Java Guides YouTube Channel

Subscribe to my YouTube Channel (165K+ subscribers):
Java Guides Channel

Top 10 My Udemy Courses with Huge Discount:
Udemy Courses - Ramesh Fadatare