944,116 Members | Top Members by Rank

Ad:
Oct 21st, 2009
0

Quote system (Having issue with concept of having products and services)

Expand Post »
I'm mapping out an entity relationship diagram to try learn more about database design. I currently have approximately 17 tables that map out a quotation management system that quotes customers prices for products and/or services. I've been working on it for a number of days now but I am unable to find resources/help relating to the following

The entities/tables within the scenario I'm having trouble with are as follows:
  • Customer
  • Quote
  • QuoteItemListing
  • ProductItems
  • ServiceItems
  • Products
  • Services

Relationships
Customer (requests) Quote
Quote (has) QuoteItemListing
QuoteItemListing (may have) ProductItems
QuoteItemListing (may have) ServiceItems
ProductItems (are) Products
ServiceItems (are) Services

Essentially, I wish to be able to reference the IDs of the Products and Services a customer wishes to get a quote on in one table (QuoteItemListing). Could anyone please point me in the right direction? Thanks a lot.

My tables at present:

Customer
ID
name
address
phone

Quote
ID
customerFK

QuoteItemListing
ID
quoteFK

ProductItems
ID
productFK
quantityRequired
quoteOrderFK

ServiceItems
ID
serviceFK
quoteOrderFK

Product
ID
name
price

Service
ID
name
hourlyRate
hoursRequired
Last edited by daveomcgee; Oct 21st, 2009 at 6:39 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
daveomcgee is offline Offline
2 posts
since Mar 2009
Oct 21st, 2009
0
Re: Quote system (Having issue with concept of having products and services)
Dave,

There are two aspects of your E-R schema that you need to learn in order to successfully perform queries.

Firstly, your Product_Items and Service_Items are effectively many-to-many link tables.

Secondly, there is an optional relationship between Quote_Item_Listing and Product_Items/Service_Items.

Both aspects require their own particular SQL to perform both update and select queries. Fortunately, documentation (including tutorials) abounds.

A quick web search found this primer on many-to-many : http://www.singingeels.com/Articles/...tionships.aspx

For optional relationships, update queries are reasonably straightforward but for select you will typically need to employ a UNION of two separate queries. Try a web search for "SQL UNION".

I think you have set yourself a reasonably challenging task and you might consider a strategy for developing the necessary SQL. Personally, I would simplify things by getting it working for PRODUCTS, ignoring SERVICES (or vice versa). When you get it working, then expand to cater for the other table.

Finally, E-R/SQL solutions are seldom unique. I'm sure you will get differnet advice from other people.

Good luck.

Airshow
Last edited by Airshow; Oct 21st, 2009 at 10:17 pm. Reason: typos
Sponsor
Reputation Points: 318
Solved Threads: 358
WiFi Lounge Lizard
Airshow is offline Offline
2,527 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Database Design Forum Timeline: Clinic Management System
Next Thread in Database Design Forum Timeline: Q&A





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC