MySQL Quiz

MySQL is one of the most widely used relational databases. The questions cover SQL commands, data types, keys, joins, constraints and basic database administration.

What this quiz covers

Study tip: Practise by writing the query first and checking your result against the explanation, especially for joins.

Questions, answers and explanations

1. What is MySQL?

  1. A Programming Language
  2. A Relational Database Management System
  3. A CSS Framework
  4. A JavaScript Library

Answer: A Relational Database Management System

MySQL is one of the world's most popular relational database management systems.

2. Which language is used to interact with MySQL databases?

  1. HTML
  2. SQL
  3. CSS
  4. Python

Answer: SQL

SQL (Structured Query Language) is used to manage and query MySQL databases.

3. Who originally developed MySQL?

  1. Oracle
  2. MySQL AB
  3. Microsoft
  4. Google

Answer: MySQL AB

MySQL was originally developed by the Swedish company MySQL AB.

4. Which command is used to create a new database?

  1. CREATE DATABASE
  2. NEW DATABASE
  3. ADD DATABASE
  4. MAKE DATABASE

Answer: CREATE DATABASE

The CREATE DATABASE statement creates a new database.

5. Which SQL statement retrieves data from a table?

  1. GET
  2. SELECT
  3. SHOW
  4. DISPLAY

Answer: SELECT

The SELECT statement retrieves records from one or more tables.

6. Which SQL statement inserts a new record into a table?

  1. INSERT INTO
  2. ADD RECORD
  3. NEW ROW
  4. UPDATE

Answer: INSERT INTO

INSERT INTO adds new records to a table.

7. Which SQL statement updates existing records?

  1. CHANGE
  2. UPDATE
  3. MODIFY
  4. EDIT

Answer: UPDATE

UPDATE modifies existing records in a table.

8. Which SQL statement deletes records from a table?

  1. REMOVE
  2. DELETE
  3. ERASE
  4. DROP

Answer: DELETE

DELETE removes one or more records from a table.

9. Which SQL statement creates a new table?

  1. CREATE TABLE
  2. NEW TABLE
  3. ADD TABLE
  4. MAKE TABLE

Answer: CREATE TABLE

CREATE TABLE creates a new table in the database.

10. Which clause is used to filter records?

  1. WHERE
  2. FILTER
  3. HAVING
  4. SORT

Answer: WHERE

The WHERE clause filters records based on a specified condition.

11. Which SQL clause is used to sort query results?

  1. ORDER BY
  2. SORT BY
  3. GROUP BY
  4. FILTER BY

Answer: ORDER BY

ORDER BY sorts the result set in ascending or descending order.

12. Which SQL keyword removes duplicate records?

  1. DISTINCT
  2. UNIQUE
  3. REMOVE
  4. DELETE

Answer: DISTINCT

DISTINCT returns only unique values from a query.

13. Which SQL function returns the total number of rows?

  1. COUNT()
  2. SUM()
  3. TOTAL()
  4. ROWS()

Answer: COUNT()

COUNT() returns the number of rows that match a condition.

14. Which SQL function returns the highest value in a column?

  1. MAX()
  2. HIGH()
  3. TOP()
  4. LARGEST()

Answer: MAX()

MAX() returns the largest value from a column.

15. Which SQL function returns the lowest value in a column?

  1. MIN()
  2. LOW()
  3. SMALL()
  4. LEAST()

Answer: MIN()

MIN() returns the smallest value from a column.

16. Which clause groups rows with the same values?

  1. GROUP BY
  2. ORDER BY
  3. WHERE
  4. JOIN

Answer: GROUP BY

GROUP BY groups records that have the same values.

17. Which SQL statement permanently removes a table?

  1. DROP TABLE
  2. DELETE TABLE
  3. REMOVE TABLE
  4. CLEAR TABLE

Answer: DROP TABLE

DROP TABLE permanently deletes a table and its data.

18. Which key uniquely identifies each record in a table?

  1. Primary Key
  2. Foreign Key
  3. Unique Key
  4. Candidate Key

Answer: Primary Key

A Primary Key uniquely identifies every record in a table.

19. Which key creates a relationship between two tables?

  1. Foreign Key
  2. Primary Key
  3. Unique Key
  4. Index Key

Answer: Foreign Key

A Foreign Key links records between two related tables.

20. Which of the following is an advantage of MySQL?

  1. Open Source
  2. Fast Performance
  3. Reliable
  4. All of the above

Answer: All of the above

MySQL is open-source, reliable, secure, and provides excellent performance.

Take the timed quiz