This question already has an answer here:
I'm looking for some advice on database design.
I'm working on a small asset management utility for learning and to simplify some tasks I do in tracking IT assets. I have a table for "Asset" which represents a physical asset and then "AssetTypes" which represent the different types (e.g. Phone, Computer, Laptop, Server). Each of the assets has some common information (Name, Make, Model, Value, Purchase date) and then unique values based on the Asset Type.
What is the best way to store this extra information (e.g. PC may have
HDD; a laptop would have those three attributes, plus
ScreenSize; and a monitor would just have
I see two ways to achieve, one is a separate table for each Asset Type, which means every-time I add an asset, I need to update my code. The other is to use an "Attributes" (or similar) table that has for each asset a list of the Extra columns. When you add an asset of Type X, it gives you all the additional attributes to fill in.
If I use the attributes, how should I define them and the data types they can use (e.g. Text, Int, Bool)?
I plan on using MS SQL Server as my DB, with a C#.NET front end.
Happy with any advice or thoughts.