Here's a quick solution that may work for you. You'll still have to code the SQL around it but at least it's a start.
Tables
Code:
-- store all your basic details for hardware in here
create table Hardware(
id varchar(20),
name varchar(100),
description varchar(255),
hardwareType varchar(20),
price float,
supplier varchar(20),
...
)
-- motherboard, case, cpu, internal disk, etc
create table HardwareType(
hardwareType varchar(20),
description varchar(255)
)
-- store standards available for each hardware type ie
-- internal disk: SATA, IDE, 3.5", 2.5" etc
create table StandardsAvailable(
hardwareType varchar(20),
standardName varchar(20)
)
-- a piece of hardware might comply with lots of standards ie
-- a particular hard disk might store: SATA and 3.5"
create table HardwareStandards(
id varchar(20),
standardName varchar(20)
)
-- optional entries for when a particular item that normally should be
-- compatible really isn't - the relationship might be "incompatible"
-- You could have other entries for recommended etc
create table HardwareSpecialRel(
id_main varchar(20),
id_sub varchar(20),
relationship varchar(20)
)
-- lookup ie incompatible, recommended etc
create table relationshipType(
relationship varchar(20)
)
Comments
You might want a standard ie USB to apply to all hardware types so you could use some special logic here. I'm not sure if a standard applies just to one hardware type ie SATA applies just to internal disk drives or between two hardware types ie internal disk and motherboards. I'll leave it to you to do the indexing etc.
Searching for hardware will need to include the hardware type fields and the standards table so users could search for SATA disk drives. Users may prefer a hierarchical menu where you start with hardware type and then pick a standard and then view all the items that match.
Showing info on an item of hardware should also list the types of hardware that have common standards to the one you are viewing. So viewing a motherboard might list CPU, memory, disk drives etc.
Selecting a related hardware type would just show the hardware that has common standards to the previous item.
Another option is just to display all the standards that an item of hardware complies to and then let the user pick other items with the same standards ie
the dabs site.
Quote:
Originally posted by victorius
One of my tasks at my new job is ... I'm a relative beginner in database design and I have no clue as to how to contstruct my tables and the logic to accomplish this.
|
I doubt you'll find code for this anywhere on the web. Is it a good idea to go for a job knowing you can't do it - it sounds like a stressful life to me!
Mike