0

I have to design the following sentences for a company that sells different vehicles: "The database must keep track of everyone involved(customer and staff) in the sales for vehicles. The sale price, profit and commission from that profit also needs to be recorded."

I came across many ER diagrams to model such a scenario which involves a ternary relationship between Vehicles, Staff and Customer as can be seen here.(ER1)

And another one where the Sales in actually an Entity? like this.(ER2)

Initially, I was drawing my diagram like this(3) but as it says, the diagram is not accurate and I'm not sure why.

What exactly is the difference between the concept that these two diagrams(ER1 and ER2) explain? It would be a lot of help if someone could explain the difference between the two models and which one is better suited for what I want to record in the database.

If any clarification is needed please let me know.

0

the first diagram you can't realized in a rdms, you need to make sales always to an entity, to represent the relation ship.

if we take the third diagram, you would have all the wanted data, but you couldn't make foreign keys work, because of the ring relationship.( every row that is referenced mus exist before, this doesn't work in a ring relationship).

now you have two possibilities:

  1. you have to represent the trinary relationship in an entity, and you wouldn't have the eer 1 any more, as sales is an entity with foreign keys to all three tables(entities)
  2. you put the relationship in your application code

the first gets you your second approach.

The second doesn't show the relationship with foreign keys, so you would add the information by adding comments to the tables.

2
  • Do you think ER2, with Sales as an entity is the correct way?
    – chimmy102
    Apr 3 at 13:21
  • as i desribed in my answer, er1 can't be realized in a relational database, so you basically always end in er2. i explained why Er1 will not work in a datavbase.
    – nbk
    Apr 3 at 14:50
0

Inventory System Data Design Issue You can refer to this query, it has been already explained and worked on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.