A model includes a products table and a table with monthly category targets; each product can belong to multiple categories and each category can have multiple products. Which cardinality should be set?

Prepare for the Fabric Analytics Engineer Associate Test with comprehensive materials. Explore flashcards, multiple choice questions, and detailed explanations. Get ready for your success!

Multiple Choice

A model includes a products table and a table with monthly category targets; each product can belong to multiple categories and each category can have multiple products. Which cardinality should be set?

Explanation:
This question tests how to model relationships between entities in a relational database. When an entity in one table can be linked to many records in another, and the reverse is also true, you have a many-to-many relationship. Here, a product can belong to multiple categories and a category can contain multiple products, so the link between products and categories is many-to-many. Implementing that typically uses a junction table that stores pairs of product_id and category_id (and possibly extra attributes). The monthly targets table adds another dimension, but it doesn’t change the fact that the product–category link itself is many-to-many; it can be modeled alongside with its own tables as needed. Therefore, the appropriate cardinality is many-to-many.

This question tests how to model relationships between entities in a relational database. When an entity in one table can be linked to many records in another, and the reverse is also true, you have a many-to-many relationship. Here, a product can belong to multiple categories and a category can contain multiple products, so the link between products and categories is many-to-many. Implementing that typically uses a junction table that stores pairs of product_id and category_id (and possibly extra attributes). The monthly targets table adds another dimension, but it doesn’t change the fact that the product–category link itself is many-to-many; it can be modeled alongside with its own tables as needed. Therefore, the appropriate cardinality is many-to-many.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy