-1

Can there be two one-to-one relationships between the same tables? And is it actually a "right" way to represent this?

The task for such entities in the publication office database is following:

Each order is assigned a unique number, customer id, type of printed material, publication, printing house, order acceptance date, order completion date, and print quality. Information about publications includes: publication code, author(s), title of publication, volume in printed sheets, circulation (number of copies), unique order number.

So to have the attributes publication and order number (in bold) in each table, I have to create two one-to-one relationships:

database

philipxy
  • 14,867
  • 6
  • 39
  • 83
  • [Why should I not upload images of code/data/errors when asking a question?](https://meta.stackoverflow.com/q/285551/3404097) An ERD is an image of DDL. – philipxy Jan 09 '23 at 06:10

1 Answers1

0

That wouldn't work because initially, you wouldn't be able to add anything to the Order or Publication table without violating the FK constraint. You would be better off combining the Order and Publication tables into a single table with a composite primary key of orderId and publicationId. This would correctly express the fact that a given order and publication pairing is unique.

Tyler Liu
  • 989
  • 1
  • 6
  • 7