Q1
True / FalseIn MySQL, a business key is always the primary key of a table.
A business key is a key that has real-world meaning outside the database and is used by business processes. It is not necessarily the primary key, which is a unique identifier for the records in a table.
Q2
True / FalseIn MySQL, a natural key is a key that is derived from application data.
A natural key is a key that is based on the actual data of a table and has a logical relationship to the data it represents, such as a Social Security Number.
Q3
True / FalseIn MySQL, a candidate key can be composed of more than one column.
A candidate key can consist of one or more columns. It uniquely identifies a row in a table and can be chosen as the primary key.
Q4
True / FalseIn MySQL, every natural key is a candidate key.
A natural key is inherently a candidate key because it uniquely identifies rows within the table and can serve as a primary key.
Q5
True / FalseIn MySQL, business keys are typically generated by the database system.
Business keys are usually derived from the business processes and not generated by the database system. They have a real-world meaning.
Q6
True / FalseIn MySQL, a candidate key must always be a numeric column.
A candidate key can be of any data type as long as it uniquely identifies rows within the table. It does not have to be numeric.
Q7
True / FalseIn MySQL, a surrogate key is always a candidate key.
A surrogate key is an artificial key added to a table to serve as a primary key. As such, it is always a candidate key because it uniquely identifies rows within the table.
Q8
True / FalseIn MySQL, a table can have multiple candidate keys but only one business key.
A table can have multiple candidate keys, and it can also have multiple business keys, as long as they uniquely identify records in a meaningful way to the business.
Q9
True / FalseIn MySQL, a natural key can sometimes change, which can complicate database management.
Natural keys are derived from real-world data, which can change. This can complicate database management because primary keys are generally expected to be stable.
Q10
True / FalseIn MySQL, it is possible for a single table to have no natural key but still have a candidate key.
A table might not have a natural key derived from its data but can still have a candidate key, such as an auto-incremented surrogate key, which uniquely identifies the records in the table.
Q21
Multiple ChoiceWhich SQL statement demonstrates the creation of a candidate key in a table design?
SQL Code
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
email VARCHAR(100) UNIQUE,
social_security_number VARCHAR(11) UNIQUE
);
A candidate key is a column, or a set of columns, that can uniquely identify a record in a table. In this example, both 'email' and 'social_security_number' are candidate keys, with 'employee_id' as the primary key.
Q23
Multiple ChoiceWhich SQL statement demonstrates the use of a business key in a table design?
SQL Code
CREATE TABLE orders (
order_number VARCHAR(20) PRIMARY KEY,
customer_id INT,
order_date DATE
);
A business key is a key that is derived from the business context, often serving as a natural key. In this example, 'order_number' is a business key that uniquely identifies each order.
Q24
Multiple ChoiceWhich SQL code correctly defines multiple candidate keys in a 'customers' table?
SQL Code
CREATE TABLE customers (
customer_id INT PRIMARY KEY,
email VARCHAR(100) UNIQUE,
phone_number VARCHAR(15) UNIQUE
);
In this table, 'email' and 'phone_number' are candidate keys because they uniquely identify each customer, while 'customer_id' is the primary key.
Q29
Multiple ChoiceWhich SQL statement properly defines a business key, natural key, and candidate key in a 'suppliers' table?
SQL Code
CREATE TABLE suppliers (
supplier_id INT PRIMARY KEY,
supplier_code VARCHAR(10) UNIQUE,
supplier_name VARCHAR(100)
);
In this example, 'supplier_code' is a business key and natural key because it uniquely identifies suppliers based on a business-related identifier. It is also a candidate key along with the 'supplier_id'.
Q30
Multiple ChoiceWhich SQL code demonstrates the creation of a table with both a business key and a candidate key, ensuring data integrity?
SQL Code
CREATE TABLE vehicles (
vehicle_id INT PRIMARY KEY,
vin VARCHAR(17) UNIQUE,
license_plate VARCHAR(10) UNIQUE
);
In this example, 'vin' (Vehicle Identification Number) serves as both a business key and a natural key, uniquely identifying each vehicle. It is also a candidate key along with 'license_plate'.