HOW TO IMPLEMENT MULTIVALUED ATTRIBUTES
-
i have to create a table item which has an attribute item category....category is a multivalued attribute...can anyone tell how to implement this? create table item_info(itemno varchar(5),item_sno varchar(30),condition varchar(20), color varchar(15), corigin varchar(20), Year_prod integer, PRIMARY KEY(itemno,item_sno))
-
i have to create a table item which has an attribute item category....category is a multivalued attribute...can anyone tell how to implement this? create table item_info(itemno varchar(5),item_sno varchar(30),condition varchar(20), color varchar(15), corigin varchar(20), Year_prod integer, PRIMARY KEY(itemno,item_sno))
you need to create a lookup table to store the category values and then a bridge table to store the categories for items.
CREATE TABLE Categories (
CategoryID int,
CategoryName varchar(100)
)CREATE TABLE ItemCategories (
Itemno varchar(5),
CategoryID int
)You can store multiple rows in the ItemCategories table for each item.
-
i have to create a table item which has an attribute item category....category is a multivalued attribute...can anyone tell how to implement this? create table item_info(itemno varchar(5),item_sno varchar(30),condition varchar(20), color varchar(15), corigin varchar(20), Year_prod integer, PRIMARY KEY(itemno,item_sno))
Create two tables as: Item_Category {ItemID int identity(1,1) primary key, Item_CategoryName NVARCHAR(100)) AND another one is Item { ItemSrNo int identity(1,1) primary key, ItemID int, --foreign key references values from Item_Catory Table Column3, ,,,n }