I'm confused about how to structure a database when the items I'm adding are similar but not identical types. Consider adding toys to a Toys database. I have:
- Cars
- Dolls
- Balls
All are toys, but a car needs to record whether it is a remote control or manual car, A Barbie needs to record whether she has accessories, and a ball needs to record what type it is. I feel I have two choices:
A toys table that stores all toys, but a column called 'Type' is only applicable to balls. The column 'Accessories' is only applicable to dolls. 'RemoteControl' is only applicable to vehicles. So I have lots of columns not being used and filled up with null values. Or columns with nondescript names, like Value1, Value2.
I have a table for each type of toy, such as a 'Vehicles' table and a 'Dolls' table. I have another table that stores the toy ID and type ID, which I use to identify which table I need to query to get its full details. The issue now is that when I decide to add Lego and fidget spinners to my database, I need to add two new tables.
I'm really confused about the best practice for this kind of situation. Any advice would be greatly appreciated.