Results 1 to 2 of 2

Thread: Column type

  1. #1
    Join Date
    May 2004
    Posts
    95

    Unanswered: Column type

    Hi everybody,

    I'm getting stuck, designing a DB for some work, because I can't get a simple solution for showing data and storing that data.

    The problem is as follows:
    I have a table on which I want to save some characteristics on a type of machinery, but this characteristics must be grouped in similarity and indicating if this a value of single choice, of multiple choice or an input value, for example fuel (petrol, gas, ethanol, etc), movement (forward, backward), weight (input). I was thinking on a nested table of varchar, no problem for storing and displaying on my application with this kind of approach.
    Code:
    CREATE TYPE characteristics AS TABLE OF VARCHAR2(100)
    /
    CREATE TABLE characteristic (id NUMBER, type_choice NUMBER
    , characteristic characteristics)
    COMMENT ON COLUMN type_choice 
    IS '1-single choice;2-multiple choice;3-value input'
    /
    insert into characteristic (id,type_choice,characteristic) 
    values (1, 1,characteristics('forward','backward')
    /
    insert into characteristic (id,type_choice,characteristic) 
    values (2, 3,characteristics('weight')
    /
    But I also want to characterize other data with this characteristics, for instance a specific machinery: BOBCAT can only move forward and weights 2500 kilos.

    I can do this:
    Code:
    CREATE TABLE machinery (id NUMBER, name VARCHAR2
    , characteristic VARCHAR2,value NUMBER)
    /
    insert into machinery (id,name,characteristic) 
    values (1, 'BOBCAT','forward')
    /
    insert into machinery (id,name,characteristic,value) 
    values (1, 'BOBCAT','weight',2500)
    /
    But how can I relate the two characteristics, the one on table characteristics and the one on table machinery?

    I will be very thankful for any idea.

    Thanks.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    GOOGLE "Third Normal Form" & design the data accordingly
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •