Scenario: A company wants to ensure that every order placed in their system has a corresponding customer. Which type of constraint would you apply to the order table to enforce this rule?
- Check Constraint
- Foreign Key Constraint
- Primary Key Constraint
- Unique Constraint
To ensure that every order has a corresponding customer, you would apply a Foreign Key Constraint to the order table. This constraint establishes a link between the order table and the customer table, preventing orders without a matching customer.
In a one-to-many relationship, which entity holds the foreign key?
- Both entities
- It depends on the database design
- Many entities
- One entity randomly chosen
In a one-to-many relationship, the entity on the "many" side holds the foreign key. This key establishes the link between the two tables, allowing the "many" side to reference the primary key of the "one" side.
Which type of NoSQL database is best suited for hierarchical data with dynamic schemas?
- Column-family database
- Document-oriented database
- Graph database
- Key-value store database
A document-oriented database is best suited for hierarchical data with dynamic schemas. It allows storing complex, nested data structures in a document format (e.g., JSON or XML), making it flexible for evolving data requirements.
Which NoSQL database type is most suitable for graph-based data modeling?
- Column-family Store
- Document Store
- Graph Database
- Key-Value Store
Graph databases are the most suitable NoSQL type for graph-based data modeling. They are designed to represent and store data as nodes, edges, and properties, making them highly efficient for managing complex relationships in interconnected data sets.
Version control in data modeling helps to ensure _______ of data models.
- Collaboration
- Consistency
- Flexibility
- Security
Version control ensures consistency of data models by tracking changes and allowing users to revert to previous states if needed. It prevents conflicts and discrepancies, providing a stable and reliable model over time.
What are the advantages of using a Star Schema over a Snowflake Schema in data warehousing?
- Better suited for normalized data
- Easier to understand and navigate
- More suitable for complex analytical queries
- Reduced query complexity
One advantage of using a Star Schema over a Snowflake Schema is reduced query complexity. In a Star Schema, all dimensional data is stored in a single table, making it simpler and faster for querying compared to the normalized structure of a Snowflake Schema, which involves multiple tables and joins.
Which type of relationship in an ERD allows an entity to be related to itself?
- Many-to-Many
- One-to-One
- Recursive
- Weak
A recursive relationship in an ERD allows an entity to be related to itself. This scenario often occurs when an entity has a relationship with instances of the same entity type. It is useful in modeling hierarchical structures and network relationships.
What are the key differences between a fact table and a transactional table in a relational database?
- Fact tables are used for online transaction processing (OLTP), while transactional tables are used for online analytical processing (OLAP)
- Fact tables contain aggregated data, while transactional tables store detailed, raw data
- Fact tables have a primary key, while transactional tables have foreign keys
- Fact tables store current data, while transactional tables store historical data
Fact tables in a relational database store aggregated data, often derived from transactional tables. Transactional tables, on the other hand, store detailed, raw data. Recognizing these differences is essential for efficient database design and querying in both OLAP and OLTP environments.
In Slowly Changing Dimensions (SCD), Type 4 utilizes an _______ table to store historical changes.
- Archive
- Audit
- Historical
- Snapshot
In Slowly Changing Dimensions (SCD) Type 4, a "Historical" table is used to store historical changes. This allows tracking changes over time while maintaining the current data in the main table. This type is beneficial when it's essential to preserve a complete history of changes.
What is the role of a "row key" in a column-family store?
- It determines the data type of the row
- It indicates the timestamp of the row
- It is used to uniquely identify a row
- It specifies the number of columns in the row
The "row key" in a column-family store is crucial as it uniquely identifies a row. It acts as the primary key for data retrieval, enabling efficient and fast access to specific rows in the column-family.