If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Can I use normal forms here?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-23-07, 16:42
tom.fox tom.fox is offline
Registered User
 
Join Date: Aug 2007
Posts: 12
Can I use normal forms here?

Hey guys.

I'm doing an internship in the States and I have to complete the following task.

An advisor inputs all invoices from the salesmen into excel sheets. first of all to calculate the commission for each salesperson, second of all for reporting.
How much commission was summed up today, weekly etc.

so far the excel sheets are almost not automated and it takes a lot of time to calculate it by zourself. i want to design a database with ACCESS 2003. I already made a form to input the following information.

- Date
- Salesperson
- Invoice #
- Customer
- Warranty period?
- Payment method
- purchase price
- sales price
- warranty price
- total sale
- credit card fee
- shipping
- commission

They do not want me to store any personal information about customers or the sale personnel. it is also not interesting what product was sold. all they care about are the numbers.

so far all these information are stored in ONE table. only those rates which might change, like credit card fees or commission rates, are stored in another table. the form i created accesses these data for their calculations. also i put the salespersonnel (id and name) in a table and a combobox on the form accesses this table. the last table contains thousands of customer (only company name) and a combobox also accesses this table. but none of these tables are referenced to each other.

so i know of normal forms and all that design rules, but i do not see a way to do that here. do you? i mean i certainly have the first normal form, but can i apply the third? or any other things that improve my db? can't wait to hear some advices for my design...

thank you very much

Last edited by tom.fox; 08-24-07 at 11:46.
Reply With Quote
  #2 (permalink)  
Old 08-23-07, 18:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
before you start worrying about normal forms, you have to have a natural key

what's your natural key here?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 08-24-07, 10:41
tom.fox tom.fox is offline
Registered User
 
Join Date: Aug 2007
Posts: 12
Well so far i did not think about that, but I think it is the invoice number. this numer has a logical relation to all other attributes...
Reply With Quote
  #4 (permalink)  
Old 08-24-07, 10:43
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
well, that's a good start, but it's not enough, you're looking for a compound key here

the key of this table cannot be just invoice number, otherwise you would only be able to store at most one row for each invoice
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 08-24-07, 11:53
tom.fox tom.fox is offline
Registered User
 
Join Date: Aug 2007
Posts: 12
thx a lot for your help r937

yes, i think an invoice# will show up several times once in a while, when customers buy several parts...

so i have to add another attribute to invoice number? and both attributes are the compund key? that makes sense... ok once i got this done, are there more things to improve?

is there anythying i need to do about the several items on one invoice, except for the compund key?

thx
Reply With Quote
  #6 (permalink)  
Old 08-24-07, 12:00
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
i don't think you need to add a column

try to see if you can find unique combinations of invoiceno with one or more existing columns
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 08-24-07, 13:58
tom.fox tom.fox is offline
Registered User
 
Join Date: Aug 2007
Posts: 12
oh yeah, that is what i meant. guess my bad english ruined that

i sure did find a second attribute for a combination..... invoice# and the kind of sale

So what would be the next step, if there is one? thx thx thx
Reply With Quote
  #8 (permalink)  
Old 08-24-07, 14:07
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
which column is "the kind of sale"?

actually, i want to go back to post #4

i think i was wrong

there's only one row of data for each invoice, right?

in that case, i think you're okay with invoice number as the PK
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 08-24-07, 15:16
tom.fox tom.fox is offline
Registered User
 
Join Date: Aug 2007
Posts: 12
there are two kind of sales. parts they sell in stock(regular sale) and those they buy somewhere else and sell then to customers (special order sale). i have to differentiate. this column is just a checkbox. if checkbox clicked then special order sale true. so there would me maximum two rows with the same invoice number. all sums from special orders are added up, as those from regular sales. means if 4 items were sold, 2 spo's and 2 regular, i add up both spo's in 1 row, the same with regular

so technically there might be two rows per each invoice...
Reply With Quote
  #10 (permalink)  
Old 08-24-07, 15:41
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
so two columns, then

you're doing fine

okay, now here is the next step in the normalization

if i told you the invoice number and the sale type, e.g. 12345/reg, and then, somewhere else in that row, if i changed one piece of data, would anything else have to change?

for example, if i changed sales price, for that row, would i also have to change commission?

if the answer is yes, you have a non-key dependency
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #11 (permalink)  
Old 08-24-07, 16:29
tom.fox tom.fox is offline
Registered User
 
Join Date: Aug 2007
Posts: 12
that is correct. if you changed sales prices for example, that would affect several other data.... so the answer would be yes..
Reply With Quote
  #12 (permalink)  
Old 08-24-07, 17:48
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
well, that means that commission is dependent not just on invoice number and sales type, but on sales amount, too

so it's not in 3NF
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #13 (permalink)  
Old 08-24-07, 17:52
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #14 (permalink)  
Old 08-24-07, 18:22
tom.fox tom.fox is offline
Registered User
 
Join Date: Aug 2007
Posts: 12
thx for the link..... i am sure i will have some questions after i read it
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On