我们的系统中有下表
表对象
object_id object_description
1 "Car"
2 "Person"
Run Code Online (Sandbox Code Playgroud)
表属性
attribute_id attribute_name
1 "hair_color"
2 "height"
3 "number_of_doors"
4 "engine_size"
Run Code Online (Sandbox Code Playgroud)
表attribute_value
attribute_id attribute_value_id value
1 1 "black"
1 2 "blonde"
2 1 "more than 1 meter"
2 2 "less than 1 meter"
3 1 "5 doors"
3 2 "3 doors"
4 1 "more than 1.9"
4 2 "less than 1.9"
Run Code Online (Sandbox Code Playgroud)
表object_attribute
object_id attribute_id attribute_value_id
1 3 1 -- Car, number of doors,5
1 3 2 -- Car, …Run Code Online (Sandbox Code Playgroud) I'm trying to understand some concepts of DB desing.
I have three tables:
Movies (id,title)
1 - The godfather
2 - Matrix
Attribute (id,name)
1 - Country
2 - Type
Attribute Value(attribute_id,id,value)
1,1,USA
1,2,Japan
2,1,Thriller
2,2,Comedy
Run Code Online (Sandbox Code Playgroud)
and I would like to link movies with one and just one attribute and with one attribute value
IE: Godfather, Country: USA, Type: Crime
I'm trying to find out which of the next is the best solution for linking attributes to a movie. I …