How to edit Relationship properties to only use part of the CDM Identifier in LDM?

184 Views Asked by At

I'm creating a conceptual data model for a simplified web store using Power Designer.

I'm having trouble specifying the relation between an Order and a Receipt. I would like a receipt to only have a part of the order's identifier in its primary key in the logical model (more specifically, only order_id). I am unable to achieve this by tweaking the relationship properties (see the screenshots bellow; the problematic relationship is marked with a green arrow).

Should I simply omit the relation in the conceptual model?


Conceptual data model

enter image description here

Logical data model

enter image description here

EDIT

If perhaps it wasn't clear how I envisioned my tables…

User

username password mail first_name last_name address
hacker123 greenGrass [email protected] David Norton West Shire 40, 1240 Neverland
musicman100 SuperPassword [email protected] John Stewart Strange Alley 50, 1250 Outer Space

Product

product_id name description price_per_unit unit_of_measure supply
1 Tooth Brush 100 NULL 5.99 piece 200
2 Super Paste 200 For sparkling smiles 7.99 piece 50

Order

order_id username product_id amount
50 hacker123 1 2
50 hacker123 2 1
51 musicman100 1 5

Receipt

receipt_id order_id
12 50
13 51

EDIT #2

I just realised that I should probably break up Order into two tables! One to track which products are on a particular order, and another to track who placed the order.

Perhaps I could even split the Order table into 3 parts

Order(order_id, order_time)

ProductsPerOrder(order_id, product_id, amount)

OrdersPlaced(order_id, username)

2

There are 2 best solutions below

0
Janez Kuhar On

You can edit the relationship in the logical model!

If you click on a relationship, a Relationship properties dialog appears. There's a tab called Joins. This is where you can specify which columns to refer to with the relationship.

3
pascal On

You have a contradiction... One part says that Order is identified by User+Product+Order; the other says that Order has its own identifier order_id.

I guess the second one is correct, with the usual design that Order has an id.

And you need to change the relationships in the CDM, between Order, and User/Product, to uncheck the Dependent property. These links are just mandatory, not dependent (which would mean that Order is defined relatively to User+Product).

p.s. the same holds for Receipt, which has its own identifier.