I am working on an ERD which represents the relationships between entities in a Web development company behavioral model.
There I have entities like:
- Customer
- Service ———– (like: web development, web design, web consultation, …)
- Order-item ——- (like: web development, web design, web consultation, …)
- Order
- Invoice
- Project
- Project-phase
- Task ————— (like: web development task3, web design task7)
- Developer
- Delivery ———– (like: the developed web app, web consultation session, …)
I have this diagram so far, though I know it still has major problems, and it is just for a start point:
Main concept
- Customer makes
order-item
s onservice
s, combined to form anorder
which relates to aninvoice
. - Each
project
has multipleproject-phase
s with eachproject-phase
related to anorder
. - Each
project-phase
has multipletask
s, each of which is assigned to adeveloper
. - Each
project-phase
has adelivery
, which will be delivered upon payment of the relatedorder
sinvoice
.
Questions
- Are
has
andcontains
completely the same? If not, how to choose between them for relationships?! what is the measure?! - Are there any rational problems with the Main concept section?
- Any helpful ideas or suggestions to improve this model?
Any help with this, would be really appreciated.
Update 1
Refined version of the diagram
Update 2
Considering an analogy of a Fast food restaurant would be helpful:
- Customer ———- A hungry person
- Service ————- Making a burger, Home delivery, Mobile delivery, …
- Order-item ——— A burger, …
- Order —————- A home-delivered burger
- Invoice ————– The printed invoice
- Project ————– Serving the customer for a complete year (like a contract)
- Project-phase —– Serving the customer for a single day
- Task —————– Preparing the kitchen, process the meat, …
- Developer ———- The cookie
- Delivery ————- A burger in wrapped in wax papaer and a drink with the tray
Update 3
Project seems to be unrelated to Customer in your diagram. Is this what you intended?
I think Order is and Project should not be related, as I think it is something off-the-counter and customer has nothing to do with it. she/he is only after the delivery and is concerned about time and money, nothing else. Please tell if I am wrong.
Are all Orders part of a Project or can you have orders that aren't in a project at all?
All Orders are part of a project, except those new ones which are waiting in the process queue.
Similarly, you relate order item directly to customer, but also to order. Are orders split between customers?
Please think of Order-Item as these:
- web design
- web design consultancy
- domain name consultancy
- …
So, customer choose some of these items, collected as an Order which has an invoice and could be paid. Order-Items are directly related to offered Services. I don't understand what do you mean by Are orders split between customers?.
If not you don't need a ternary relationship between customer, order item and service. Rather, an order item is an intersection between order and service. Order items belong to customers by inheritance from order (or even project?)
This is somehow true: Order items belong to customers by inheritance from order, but I think it is more rational to say it like this:
Order-Items, inherited from Service, belong to Order which itself belongs to Customer.
Best Answer
You're oversimplifying the relations. No two relations in your diagram are the same, since they don't relate the same domains.
<ORDER> has <ORDER-ITEM>
is not the same as<PROJECT> has <PROJECT-PHASE>
. They might both be injective, but that's not sufficient to call them the same.Try to give your relations more descriptive names. While attributes (aka one-to-one binary relations) tend to be aggregated on a common determinant to create "entity tables", multivalued attributes and more complicated relations like the ternary relation between
Customer
,Service
andOrder-item
usually become tables on their own.Makes
really doesn't describe the relation or resulting table properly.I suggest you add cardinality indicators to your diagram and give your relations more descriptive names, using the predicate statement of each relation for guidance.
On second thought, those names are probably fine in a conceptual design as long as you read them together with the entity sets they relate. When you get to physical design, 1-to-1 and 1-to-many relations will probably be implemented as attributes of one of the entity sets, so the relation names won't affect the physical design. The many-to-many relations and non-binary relations will become their own tables, for table names at worst you can concatenate the entity names, e.g.
CustomerServiceOrderItems
.