0

I am creating a new application that have objects of different types. For example is monitor, mouse and keyboard. Different objects have its own properties.

Monitor: brand, resolution, color, etc Mouse: brand, type, wire/wireless Etc

Question: What is the best schema for different types of objects ?

  1. Single table
  2. Multiple table

Given single table (query performance reason), the properties would be db column type, but as object of different types are of different properties, how is this possible ? And there maybe unknown object at the design time that maybe added in the future. And would this result in a lot of columns ?

On other hand, would multiple table suffer from performance issue (querying multiple table) when listing all objects ?

Thanks in advance.

1 Answer 1

1

This sounds somewhat like Many-to-Many relationship and in this case you should be creating 3-table design,

ObjectList

  • ObjectID (PK)
  • ObjectName
  • other columns...

PropertyList

  • PropertyID (PK)
  • PropertyName
  • OtherColumns

Object_Property

  • ObjectID (FK) -- this sould be compound primary key with PropertyID
  • PropertyID (FK)
  • otherCOlumns...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.