To change the data type of a column in an existing table, which clause should be used with the ALTER TABLE statement?
Explanation:
The MODIFY COLUMN clause within an ALTER TABLE statement is used to alter the definition of an existing column, including changing its data type.
You have a table with columns for StudentID, StudentName, CourseID, and CourseName. StudentID determines StudentName, and CourseID determines CourseName. What normal form is this table in?
Explanation:
The table is in 1NF because it likely has atomic values and no repeating groups. However, it's not in 2NF because CourseName depends only on CourseID, not the entire primary key (if it's a composite key of StudentID and CourseID).
In which scenario might a Snowflake Schema be preferred over a Star Schema?
Explanation:
The normalization in Snowflake Schemas reduces data duplication, which is beneficial for maintaining consistency and accuracy in the data warehouse.
What is a potential drawback of using a Snowflake Schema compared to a Star Schema?
Explanation:
The normalized structure of Snowflake Schemas, while promoting data integrity, can lead to more joins in queries, potentially impacting performance.
What is the primary purpose of a Primary Key in a database table?
Explanation:
A Primary Key serves as a unique identifier for each row in a table. It guarantees that no two rows will have the same Primary Key value, ensuring data integrity and enabling efficient data retrieval.
What happens to records in the 'Orders' table with 'ON UPDATE CASCADE' if a customer's ID is updated in the 'Customers' table?
Explanation:
With 'ON UPDATE CASCADE', when a customer's ID (the primary key) in the 'Customers' table is updated, the corresponding customer IDs in the 'Orders' table (the foreign key) are automatically updated to maintain referential integrity.
Which data validation technique prevents invalid data from being entered into the database by checking it against predefined rules?
Explanation:
Check constraints define rules at the column level to validate data upon insertion or updates, ensuring that only data meeting the specified criteria is allowed.
What is the key difference between a database and a schema?
Explanation:
A database can be thought of as a container holding one or more schemas. Each schema represents a logical grouping of database objects like tables, views, and constraints, organizing the data within the database.
What is the role of a column in a database table?
Explanation:
Each column in a database table corresponds to a specific attribute or property of the entities represented in the table. For instance, in a table of employees, columns might include 'EmployeeID,' 'FirstName,' 'LastName,' etc.
Which of the following is a key benefit of using a well-designed schema for a data warehouse?
Explanation:
A well-structured schema, particularly Star or Snowflake, is optimized for analytical queries, allowing for faster retrieval of insights from large datasets.