I want some tips on my database design.
One solution is to create columns for each piece of hardware, i.e. cpu, ram, hdd etc etc. Then just run simple SELECT queries against them. The problem is that a computer may have many HDDs/CDs etc, and also other type of equipment may be entered in the database like switches and routers.
Another solution is to specify the valuetype + value in one table having a relation to another table containing the actual machines/routers/switches. The problem here is that I can't do numeric comparisons this way since "11" is less than "2", ("all computers with a cpu faster than 500Mhz").
Any suggestions?Table Computer
(ComputerID
...)
Table HardwareType
(TypeID
Description)
Table ComputerHardware
(ComputerID
TypeID
Description
NumericValue NULL)
Only use the NumericValue for items where it's relevant, like CPU speed or HDD size and not for things like Keyboards.|||How would I write my SQL statement to get the SQL Server to treat the values as Numeric then?|||They should be stored as numeric values. That's the column 'NumericValue'...
Make it a decimal 18,4 or something similar
No comments:
Post a Comment