SQL: Right way to model multible relations in UML/ ERD -


how do uml example:

order(id, user_id, invoice_user_id) user_id , invoice_user_id foreign keys , user_id != null 

both users stored in same entity. how cardinalities or uml priciple? guessed way:

[order]0..n--1..2[user]

so order can have 2 users. option (i hope understand textpicture...) should mean order can have 2 users. or way right:

[order]n -- 1[user] |n |1 [(invoice)user]

one user can have many orders and/or can invoice user of many orders...

you should naming unnamed association-end properties , using 2 separate associations. way have it, there no way invoice user separately other user. , these users anyway? need more analysis understand roles involved. here's guess:

  • seller creates number of invoices
  • buyer receives number of invoices
  • invoice received by 1 buyer
  • invoice created by 1 seller

that gives model this:

  ------ |seller|  ------  1 | creatingseller    |  * | createdinvoice  -------  *                              1  ----- |invoice|----------------------------------|buyer|  -------  receivedinvoice   receivingbuyer  ----- 

now can navigate 2 "users".

btw, both buyer , seller roles played agent, person or organization. i'm not going model whole thing you.

just aware, there other ways realize model in rdbms, using "reference data" / "enumeration literals" differentiate 2 associations , 2 roles of agent. original question indicates want more physical model, think you're asking trouble skipping analysis model, can realized in rdbms.


Comments

Popular posts from this blog

What Are The Best Universities In The World?

Hard vs. Soft Water: What's The Difference?

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -