User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 456,470 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,806 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser: Programming Forums
Views: 596 | Replies: 1
Reply
Join Date: Aug 2008
Posts: 19
Reputation: Scooby08 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Scooby08 Scooby08 is offline Offline
Newbie Poster

Should items table be divided into categories??

  #1  
Aug 2nd, 2008
I am currently working on an invoice type of database and was wondering the proper way to set up the items table..

As of now I have all my items in one table and am using the auto_increment id of each item for that specific item's id.. Everything works fine, but I was thinking that this seems sort of half ass.. What if down the line I wanted to add more items to the table.. Then this huge list of items would start to become scattered.. Would this slow down my queries?? Should I divide all the item categories into their own individual table, or will the queries handle the scattered table of items just fine??

I've been reading about indexes, but I'm not quite understanding how to use them to my advantage.. Can one table have multiple indexes?? And if so would that solve my problem??

Here is my items table:

CREATE TABLE `dw_items` (
  `item_id` INTEGER unsigned NOT NULL auto_increment,
  `item_category` varchar(255) NOT NULL default '',
  `item_description` text NOT NULL,
  `item_price` float default NULL,
  PRIMARY KEY  (`item_id`)
)

Just looking for some feedback by the experienced.. Not sure which way to go with this one..

Thanks
Last edited by Scooby08 : Aug 2nd, 2008 at 5:14 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Posts: 11
Reputation: unixmonkey is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
unixmonkey unixmonkey is offline Offline
Newbie Poster

Re: Should items table be divided into categories??

  #2  
Aug 11th, 2008
I think you would be okay with that setup, but you may want to consider having a category table that is seperate and use an FK to link them. That way you can change the name of the category without worry, and you'll also save server storage that way to (you won't be storing the word "blanket" 50 times)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Database Design Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Database Design Forum

All times are GMT -4. The time now is 2:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC