MySQL Database Quiz Questions

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

A surrogate key in MySQL is an artificial key that is used as a unique identifier for each record in a table.

Q2
True / False

Surrogate keys in MySQL can be based on business logic.

Q3
True / False

A surrogate key in MySQL can be a combination of multiple columns.

Q4
True / False

In MySQL, surrogate keys can improve query performance by serving as primary keys.

Q5
True / False

A surrogate key in MySQL must always be an integer.

Q6
True / False

Surrogate keys in MySQL are ideal for maintaining relationships between tables in a database.

Q7
True / False

Using a surrogate key in MySQL guarantees that the values will never have gaps (i.e., they will be consecutive).

Q8
True / False

Surrogate keys in MySQL eliminate the need for natural keys in database design.

Q9
True / False

Surrogate keys in MySQL can be indexed for faster lookups and joins.

Q10
True / False

In MySQL, it is possible to create a surrogate key using the AUTO_INCREMENT attribute.

Q11
Single Choice

What is a surrogate key in MySQL?

Q12
Single Choice

Which MySQL data type is commonly used for a surrogate key?

Q13
Single Choice

In MySQL, how do you set a column as a surrogate key?

Q14
Single Choice

What is a key advantage of using a surrogate key in MySQL?

Q15
Single Choice

How does MySQL handle surrogate key collisions when using AUTO_INCREMENT?

Q16
Single Choice

What is a potential drawback of using surrogate keys in MySQL?

Q17
Single Choice

In a MySQL database with heavy write operations, what is a recommended approach to handle surrogate keys?

Q18
Single Choice

Which MySQL feature allows for automatic generation of surrogate keys without specifying AUTO_INCREMENT?

Q19
Single Choice

In a distributed MySQL database environment, what is a strategy to ensure unique surrogate keys across different nodes?

Q20
Single Choice

Which MySQL statement correctly creates a table with a surrogate key and ensures that the key values are unique and automatically incremented?

Q21
Multiple Choice

Which SQL statement demonstrates the creation of a surrogate key in a table design?

SQL Code
CREATE TABLE employees (
 employee_id INT AUTO_INCREMENT PRIMARY KEY,
 employee_name VARCHAR(100)
);
Q22
Multiple Choice

Which SQL code snippet correctly defines a surrogate key in a 'products' table?

SQL Code
CREATE TABLE products (
 product_id INT AUTO_INCREMENT PRIMARY KEY,
 product_name VARCHAR(100)
);
Q23
Multiple Choice

Which SQL statement demonstrates the use of a surrogate key and a natural key in the same table?

SQL Code
CREATE TABLE orders (
 order_id INT AUTO_INCREMENT PRIMARY KEY,
 order_number VARCHAR(20) UNIQUE,
 customer_id INT
);
Q24
Multiple Choice

Which SQL code snippet demonstrates the proper implementation of a surrogate key in a 'departments' table?

SQL Code
CREATE TABLE departments (
 department_id INT AUTO_INCREMENT PRIMARY KEY,
 department_name VARCHAR(100)
);
Q25
Multiple Choice

Which SQL code correctly uses a surrogate key in a 'customers' table design?

SQL Code
CREATE TABLE customers (
 customer_id INT AUTO_INCREMENT PRIMARY KEY,
 customer_name VARCHAR(100),
 email VARCHAR(100)
);
Q26
Multiple Choice

Which SQL code snippet demonstrates the use of both a surrogate key and a natural key in a 'students' table?

SQL Code
CREATE TABLE students (
 student_id INT AUTO_INCREMENT PRIMARY KEY,
 student_number VARCHAR(10) UNIQUE,
 student_name VARCHAR(100)
);
Q27
Multiple Choice

Which SQL code correctly illustrates the use of a surrogate key in a 'courses' table?

SQL Code
CREATE TABLE courses (
 course_id INT AUTO_INCREMENT PRIMARY KEY,
 course_name VARCHAR(100)
);
Q28
Multiple Choice

Which SQL statement best demonstrates a surrogate key implementation in a 'projects' table?

SQL Code
CREATE TABLE projects (
 project_id INT AUTO_INCREMENT PRIMARY KEY,
 project_name VARCHAR(100)
);
Q29
Multiple Choice

Which SQL code snippet best illustrates the use of a surrogate key in a 'suppliers' table design?

SQL Code
CREATE TABLE suppliers (
 supplier_id INT AUTO_INCREMENT PRIMARY KEY,
 supplier_name VARCHAR(100),
 contact_email VARCHAR(100)
);
Q30
Multiple Choice

Which SQL statement demonstrates the correct use of a surrogate key in a 'locations' table?

SQL Code
CREATE TABLE locations (
 location_id INT AUTO_INCREMENT PRIMARY KEY,
 location_name VARCHAR(100),
 address VARCHAR(255)
);