I'm creating a database for a department store and the database has two tables: Items
and Coupons
. An item, like a TV, can only ever have one coupon. Some items don't have a coupon at a given time. Therefore my schema is:
Items
: item_id
, name
, price
, desc
, ...
Coupons
: coupon_id
, item_id
, rate
, ...
This way, when I query for items, I get a list of all items. If I want only items with a coupon, I can either select all coupons and then individually query for the item to which a coupon belongs, or I can perform a natural join between the two tables and get a list of only items with coupons.
I don't think adding a coupon_id
column to the Items
table is correct because then there will be null coupon_ids, which I believe is not optimal.
Is everything I've said above correct? Or would adding the coupon_id
column to Items
and having null coupon_id
be completely acceptable?