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 > help with my database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-07-06, 20:24
wesDotNet06 wesDotNet06 is offline
Registered User
 
Join Date: Mar 2006
Posts: 6
help with my database

hey guys i have to create 3 tables for a hardware store db. i came up with this layout for the tables. can you look over them to see what im doing wrong and what i can change to make the db better.

customers:
customerID
customerName
customerAddress
etc.

inventory
productID
productName
productType
productSize
etc.

(wasnt to sure how to set this table up Normalized)
purchaces
orderID
productID
CustomerID

thanks for your time
Reply With Quote
  #2 (permalink)  
Old 03-08-06, 04:18
kropes2001 kropes2001 is offline
Registered User
 
Join Date: Nov 2005
Location: Honolulu HI
Posts: 118
is this a school project or a live project ?

are you just trying to build something, or are you trying to build something that is completely robust and is going to really be used ?

your "purchases" table
are you planning to stick in all of the times that were purchased, or is that just a cross reference to a 4th table with all of the individual items contained in each sale ?

and.. if you really want a critique.. then include everyting.. not "etc, etc." 's
__________________
.
.
http://www.GetMySiteOnline.com - Can you help me Get My Site Online ? (Yes. That is EXACTLY what we do.)

http://www.GetMySiteOnline.com/FightingSpam/
__________________________
caeli enarrant gloriam Dei !
Reply With Quote
  #3 (permalink)  
Old 03-08-06, 08:21
Trent_Jackson Trent_Jackson is offline
Registered User
 
Join Date: Mar 2006
Location: Shreveport LA
Posts: 4
Reply help with my database

help with my database

--------------------------------------------------------------------------------

hey guys i have to create 3 tables for a hardware store db. i came up with this layout for the tables. can you look over them to see what im doing wrong and what i can change to make the db better.

customers:
customerID
customerName
customerAddress
etc.

inventory
productID
productName
productType
productSize
etc.

(wasnt to sure how to set this table up Normalized)
purchaces
orderID
productID
CustomerID

thanks for your time


One thing I may suggest is trying to make a "Purchase Table" that contains just the Purchase Header Information, then I would set up another table for the Purchase Details that contains all the items associated with the purchase but contains a forgien key relating it to the "Purchase Table" record.

Something that may be useful for you is to look at the Northwind Sample Database that comes with SQL Server as well as Access I believe. Hope this helps.
Reply With Quote
  #4 (permalink)  
Old 03-08-06, 08:38
wesDotNet06 wesDotNet06 is offline
Registered User
 
Join Date: Mar 2006
Posts: 6
this is for a school project nothing major. for the purchase table, im not to sure what to do guys. you both seem to be leaning towards making a 4th table. what would this 4th table contain? all the purchases?
Reply With Quote
  #5 (permalink)  
Old 03-08-06, 08:59
Trent_Jackson Trent_Jackson is offline
Registered User
 
Join Date: Mar 2006
Location: Shreveport LA
Posts: 4
Maybe you can make you two extra Purchase tables look something like this:

"Purchase Header"

OrderID
CustomerID
OrderDate
ShippedDate
etc....


"Purchase Detail"

OrderID
ProductID
UnitPrice
Quantity
etc....

This format of laying out the tables allows you to have as little redundant data as possible, which is what normalization of db tables is used for. What the fourth table contains is just the details of the purchase. The reason for the fourth table is so you do not have to repeat the order heading information for every product that is sold in the order.
Reply With Quote
  #6 (permalink)  
Old 03-08-06, 09:00
Trent_Jackson Trent_Jackson is offline
Registered User
 
Join Date: Mar 2006
Location: Shreveport LA
Posts: 4
Reply

Sorry for the repost
Reply With Quote
  #7 (permalink)  
Old 03-08-06, 09:07
wesDotNet06 wesDotNet06 is offline
Registered User
 
Join Date: Mar 2006
Posts: 6
ok so i see what your saying with adding the 2 tables u have shown me. should i remove the original purchase table that i drew up and insert the 2 that you gave me. or should i leave mine and add the other 2?
by the way, thanks for the help
Reply With Quote
  #8 (permalink)  
Old 03-08-06, 09:55
Trent_Jackson Trent_Jackson is offline
Registered User
 
Join Date: Mar 2006
Location: Shreveport LA
Posts: 4
Reply

I would get rid of yours and put the other two in place. With the two I gave you you do not need the one you have.
Reply With Quote
  #9 (permalink)  
Old 03-08-06, 10:22
wesDotNet06 wesDotNet06 is offline
Registered User
 
Join Date: Mar 2006
Posts: 6
thanks a lot for the help its appreciated
Reply With Quote
  #10 (permalink)  
Old 03-08-06, 21:18
kropes2001 kropes2001 is offline
Registered User
 
Join Date: Nov 2005
Location: Honolulu HI
Posts: 118
yep
thats what i was leaning towards... what Trent showed.

something i would add though.
"Purchase Detail"

OrderID
OrderItemCounter
ProductID
UnitPrice
Quantity
etc....

OrderItemCounter is the original order they appear in on the receipt or order. it may be important if you need to recal the 5th item in a list of 30 and do something with it.
__________________
.
.
http://www.GetMySiteOnline.com - Can you help me Get My Site Online ? (Yes. That is EXACTLY what we do.)

http://www.GetMySiteOnline.com/FightingSpam/
__________________________
caeli enarrant gloriam Dei !
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