Hey guys
i d like to pick your brains about something..
Suppose i want to create a database for storing, lets say computer stuff, parts, hardware, peripherals etc....

Which way would be better?

1
------
Create a Basictable with all the common fields (like ProductName, Price,Guarantee....)
and then create multiple other tables with each categorie's specific fields and binding those tables with the Basictable with one-to-one relationships..

2
-------
Create just one table with all possible fields and keep Null values in the fields that are not needed for specific categories..

or maybe a third way.. ?

Thanx in advance..

I would suggest 3rd way (some changes to method 1).

zuko, I agree with debasisdas. To begin with, I would strong recommend against your approach #2 for many reasons. It is simply better practice and better database design to keep your data correctly "normalized". What that means is that instead of having one enormous table with every field, you should split the structure up into various tables that hold similarly categorized records, and that have correct foreign key associations. This way no data ever needs to be repeated either, which saves actual disk space, and also saves from having to update spread across multiple records unnecessarily, which will increase your performance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.