MySQL Database Quiz Questions

Course Name:MySQL
Chapter Name:Chapter 8 - RDBMS Concepts
Lesson Content Link:Cardinality
Current Quiz Count:30
Progress
0%
Q1
True / False

In MySQL, cardinality refers to the uniqueness of data values in a column.

Q2
True / False

High cardinality in MySQL means a column has a large number of duplicate values.

Q3
True / False

The SHOW INDEX command in MySQL can display cardinality information for an index.

Q4
True / False

In MySQL, a column with low cardinality is ideal for indexing.

Q5
True / False

Cardinality in MySQL can be affected by the presence of NULL values in a column.

Q6
True / False

The cardinality of an index in MySQL can change over time as data is inserted, updated, or deleted.

Q7
True / False

MySQL automatically updates the cardinality of an index in real-time as data is modified.

Q8
True / False

Cardinality estimates in MySQL can be inaccurate, leading to suboptimal query plans.

Q9
True / False

The InnoDB storage engine in MySQL uses cardinality estimates to determine whether to use a table scan or an index scan.

Q10
True / False

To improve query performance in MySQL, it is always necessary to maintain high cardinality for all columns.

Q11
Single Choice

What is cardinality in the context of MySQL?

Q12
Single Choice

Which MySQL command would you use to analyze the cardinality of an index?

Q13
Single Choice

High cardinality in a column means:

Q14
Single Choice

How does MySQL use cardinality information when optimizing queries?

Q15
Single Choice

In MySQL, which of the following best describes the relationship between cardinality and performance?

Q16
Single Choice

What would be the cardinality of a column in MySQL with the following values: [1, 2, 2, 3, 3, 3]?

Q17
Single Choice

When creating an index in MySQL, which type of index would benefit most from high cardinality?

Q18
Single Choice

How does MySQL's InnoDB storage engine estimate index cardinality?

Q19
Single Choice

Which MySQL statement would you use to force the recalculation of index cardinality statistics?

Q20
Single Choice

In a MySQL certification exam scenario, how would you describe the impact of low cardinality on a composite index?

Q21
Multiple Choice

Which SQL code correctly calculates the cardinality of a 'department_id' column in the 'employees' table?

SQL Code
SELECT department_id, COUNT(*)
FROM employees
GROUP BY department_id;
Q22
Multiple Choice

Which SQL statement effectively analyzes the cardinality of the 'customer_id' column in a sales table?

SQL Code
SELECT customer_id, COUNT(*)
FROM sales
GROUP BY customer_id;
Q23
Multiple Choice

Which SQL query correctly evaluates the cardinality of an index on the 'product_id' column in a 'sales' table?

SQL Code
SHOW INDEX FROM sales
WHERE Key_name = 'product_id';
Q24
Multiple Choice

Which SQL query accurately assesses the impact of cardinality on a database query's performance?

SQL Code
EXPLAIN SELECT *
FROM employees
WHERE department_id = 10;
Q25
Multiple Choice

Which SQL code snippet best illustrates high cardinality in a table's 'email' column?

SQL Code
SELECT email, COUNT(*)
FROM users
GROUP BY email;
Q26
Multiple Choice

What SQL code correctly identifies low cardinality in the 'gender' column of a 'users' table?

SQL Code
SELECT gender, COUNT(*)
FROM users
GROUP BY gender;
Q27
Multiple Choice

Which SQL code correctly calculates the cardinality of a 'department_id' column in the 'employees' table?

SQL Code
SELECT department_id, COUNT(*)
FROM employees
GROUP BY department_id;
Q28
Multiple Choice

Which SQL query correctly evaluates the cardinality of an index on the 'product_id' column in a 'sales' table?

SQL Code
SHOW INDEX FROM sales
WHERE Key_name = 'product_id';
Q29
Multiple Choice

Choose the SQL code that demonstrates the calculation of cardinality for a composite index on 'first_name' and 'last_name' columns.

SQL Code
SHOW INDEX FROM employees
WHERE Key_name = 'first_name_last_name';
Q30
Multiple Choice

What SQL code correctly identifies low cardinality in the 'gender' column of a 'users' table?

SQL Code
SELECT gender, COUNT(*)
FROM users
GROUP BY gender;