SQL - Transpose

后端 未结 3 1071
死守一世寂寞
死守一世寂寞 2021-01-26 23:33

i have small issues i have been trying to figure out in SQL. I have a table with Item Numbers, Attribute Names and Attribute values. Each Item Number might have same or differen

3条回答
  •  悲哀的现实
    2021-01-27 00:16

    You should probably be using two tables, the first one using the item number as the primary key with color, speed, mass, etc as it's columns. The second table could then have a one to many relationship with the first table on the item number and have the attribute names and attribute values as its columns. This will not only allow you to print out the data you need (by using a join), but it will make database maintenance easier over time as things change.

提交回复
热议问题