•
•
•
•
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
![]() |
•
•
Join Date: Aug 2008
Posts: 19
Reputation:
Rep Power: 1
Solved Threads: 0
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:
Just looking for some feedback by the experienced.. Not sure which way to go with this one..
Thanks
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.
•
•
Join Date: Nov 2007
Posts: 11
Reputation:
Rep Power: 2
Solved Threads: 2
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)
![]() |
•
•
•
•
•
•
•
•
DaniWeb Database Design Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: how is this for a home accounting ER Diagram?
- Next Thread: Many-to-Many relation with extra info


Linear Mode