Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. HOW TO IMPLEMENT MULTIVALUED ATTRIBUTES

HOW TO IMPLEMENT MULTIVALUED ATTRIBUTES

Scheduled Pinned Locked Moved Database
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    robin700
    wrote on last edited by
    #1

    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))

    L G 2 Replies Last reply
    0
    • R robin700

      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))

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • R robin700

        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))

        G Offline
        G Offline
        Ganu Sharma
        wrote on last edited by
        #3

        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 }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups