One-to-zero-or-one relationship

Posted 4 years ago by miso

Hi, is is possible to create one-to-zero-or-one ORM relationship?

Example: offer[offer_id, product_id] product[product_id]


  • offer MUST have exactly 1 product
  • product MUST have 0 offers or 1 offer (in other words, product will or will not be assigned to offer)
  • if product have 0 offers, in the future will have 0 offers (when connecting offer with product, the product is cloned)


I am not sure if to make NULLABLE FK product_id or make third table offer_product[offer_id,product_id] with UNIQUE constrains.

Thank you

Please sign in or create an account to participate in this conversation.