SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot tconley79's Avatar
    Join Date
    Feb 2004
    Location
    Miami
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tracking Sales stats

    Hi
    I'm creating yet another table structure to track the success of a group of salespeople on a web-based database.


    The table setup so far is:

    CLIENT TABLE
    _______________
    ID
    name
    Type (A, B, C, or D)


    SALES PERSON TABLE
    __________________
    ID
    name


    CONTACTS table (tracks salesperson's attempts to contact client and salesperson can contact client more than once)
    _______________
    ID
    Salesperson_ID
    Client_ID
    date

    SALES table(tracks successful sales)
    ___________
    ID
    Salesperson_ID
    Client_ID
    product_ID(from a product table)
    date


    The web client wants to have a way for salesmen to view a report of their success(of lack thereof). It will be in the form of an html table that will list:

    -Salesperson Name
    -# of unique clients contacted
    -# of sales to client type A
    -# of sales to client type B
    -# of sales to client type C
    -# of sales to client type D
    -# total of sales
    -# of resales (any sale after the first sale to the same client)

    Now I can perform a database query of all tables in question (client,contact, salesperson, sales) every time this page is requested...or would it be more efficient to have these stats already stored in the database either in a separate table of added to the salesperson table. These values would be updated with each contact and sale (though this would add extra insert/update statements with each sale and contact)

    Any thoughts?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would suggest to calculate the statistics on request.
    The tables are normalized.
    There won't be any problem.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •