473,568 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Database Design question, Header with two detail.. pls help

Hi All,

I have a database design question, pls give me some help..

I want to define tables for salesman's sales target commission . The
commission could be given per EITHER sales amount of : Group of
Products OR Group of Brand.
e.g : the data example :
For one salesman_A :
product_1, product_2, product_3 etc.. => sales = $100 - $200 =>
commission = 5%
product_1, product_2, product_3 etc.. => sales = $201 - $400 =>
commission = 10%
Brand_A, Brand_B, Brand_C .. etc => sales = $100 - $200 =>
commission = 2.5%
Brand_A, Brand_B, Brand_C .. etc => sales = $201 - $400 =>
commission = 5%

Below is my table design, is this a good design or something is wrong
here ? Thank you for your help.

CREATE TABLE Sales_Commissio n_Header (
Sales_ID Char(4) ,
Sales_Commissio n_Group Char(4),
Note Varchar(30),
Constraint Sales_Commissio n_Header_PK Primary Key(Sales_ID,
Sales_Commissio n_Group)
)
Alter Table Sales_Commissio n_Header Add Constraint
FK_Sales_Commis sion_Header Foreign Key (Sales_Commissi on_Group)
References Commission_Grou p_Header(Sales_ Commission_Grou p)

CREATE TABLE Sales_Commissio n_Detail (
Sales_ID Char(4) ,
Sales_Commissio n_Group Char(4),
Sales_From Decimal(12,2) ,
Sales_To Decimal(12,2) ,
Commission Decimal(5,2),
Constraint Sales_Commissio n_Detail_PK Primary Key(Sales_ID,
Sales_Commissio n_Group, Sales_From, Sales_To)
)
Alter Table Sales_Commissio n_Detail Add Constraint
FK_Sales_Commis sion Foreign Key (Sales_ID, Sales_Commissio n_Group)
References Sales_Commissio n_Header(Sales_ ID,
Sales_Commissio n_Group)

CREATE TABLE Commission_Grou p_Header (
Sales_Commissio n_Group Char(4) Primary Key,
Note Varchar(30)
)

CREATE TABLE Commission_Grou p_Detail_Produc t (
Sales_Commissio n_Group Char(4),
Product_ID VarChar(10), -- This product_ID will be FK
reference to master product
Constraint Commission_Grou p_Detail_Produc t_PK Primary
Key(Sales_Commi ssion_Group, Product_ID)
)
Alter Table Commission_Grou p_Detail_Produc t Add Constraint
FK_Commission_G roup_Detail_Pro duct Foreign Key
(Sales_Commissi on_Group)
References Commission_Grou p_Header(Sales_ Commission_Grou p)
CREATE TABLE Commission_Grou p_Detail_Brand (
Sales_Commissio n_Group Char(4),
Brand_ID VarChar(10), -- This brand_ID will be FK
reference to master brand
Constraint Commission_Grou p_Detail_Brand_ PK Primary
Key(Sales_Commi ssion_Group, Brand_ID)
)
Alter Table Commission_Grou p_Detail_Brand Add Constraint
FK_Commission_G roup_Detail_Bra ns Foreign Key (Sales_Commissi on_Group)
References Commission_Grou p_Header(Sales_ Commission_Grou p)

thank you,
Tristant
Jul 20 '05 #1
0 1359

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3270
by: Krist | last post by:
Hi All, There is some additional info I forget on this same topic I just posted. I have a database design question, pls give me some help.. I want to define tables for salesman's sales target commission . The commission could be given per EITHER sales amount of : Group of Products OR Group of Brand. e.g : the data example : For one...
1
1845
by: Lloyd Stevens | last post by:
CustomerTable CustomerTarrifTable TarrifTable WarrantTable *CustomerID CustomerID ProductName *WarrantID BoatType *CustomerTarrifID TarrifRate WarrantDate CustomerName TarrifNo *TarrifNo TarrifNo QuantitySold quantityPurchas CIF CIF Relationships ...
6
5106
by: DH | last post by:
I have a VERY basic question about figuring database size. I've inherited a database which is generally similar to this basic one: Item, Red, Blue, Green, Yellow (text), (int),(int),(int),(int) box, 1,0,0,2 hat, 0,0,0,1 car, 3,0,0,0 This format leads to a lot of zeros in the rows which take up a lot of
1
7310
by: David Horowitz | last post by:
Hi folks. I need to create a report that has a Group Header that pulls certain data from the Detail section. It's something like this: +--Report---------------------------------------- | +--Group Header---------------------------------- | | Codes: XYZ, XXX, YYY
2
1989
by: Cary | last post by:
This may reveal my poor programming skills, but here goes... I'm building a pricing tool for my business. I'm nearing the end of the project, and I've been asked to be able to save quotes in some sort of database (Major Feature Creep). For each quote, I've got two kinds of variables. The first are global for the quote, such as ...
29
3545
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this one data field - but i'm not sure) :-) Background info:
2
1127
by: Jennifer | last post by:
I've got a file I need to load into a table. The file contains modifiers to a fast food order. For example, if you ordered a burger and asked for no onions, the no onions request would be in the modifier file. So, the problem is there are "fake" duplicates in the file. What I mean is this: The file contains a Header ID, Detail ID and...
221
367152
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in...
12
77955
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please give me some idea where I am going wrong ?? I just want to retrieve data from my emp_mstr table and display it using my JSP file... The table...
0
7692
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7659
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.