Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unanswered: Table in 3rd normal form

    Hello everyone, i'm trying to put the following information into tables in third normal form in an oracle database and would really appreciate suggestions on how to do that.
    desert Ingridients
    cake sugar 500g,eggs 8, flour 200g,butter 300g
    pudding egg 4, butter 210g, milk 1 cup
    pancake flour 230g, eggs 5, milk 2 cup
    ,
    Last edited by dbafresh; 11-16-10 at 10:02.

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    This is how tables might look like:
    Code:
    SQL> create table ingredient
      2    (id number,
      3     i_name varchar2(20),
      4     jmj    varchar2(5)
      5    );
    
    Table created.
    
    SQL> create table meal
      2    (id number,
      3     m_name varchar2(20)
      4    );
    
    Table created.
    
    SQL> create table recipe
      2    (id_m number,
      3     id_i number,
      4     kol  number
      5    );
    
    Table created.
    
    SQL>
    I entered a few sample records:
    Code:
    SQL> select * from ingredient;
    
            ID I_NAME               JMJ
    ---------- -------------------- -----
             1 sugar                g
             2 egg                  kom
             3 flour                g
             4 butter               g
             5 milk                 cup
    
    SQL> select * from meal;
    
            ID M_NAME
    ---------- --------------------
             1 cake
             2 pudding
             3 pancake
    
    SQL> select * from recipe;
    
          ID_M       ID_I        KOL
    ---------- ---------- ----------
             1          1        500
             1          2          8
             1          3        200
             1          4        300
             2          2          4
             2          4        210
             2          5          1
    
    7 rows selected.
    
    SQL>
    So what do we need to make some pudding?
    Code:
    SQL> select m.m_name, i.i_name, i.jmj, r.kol
      2  from meal m,
      3       ingredient i,
      4       recipe r
      5  where m.id = r.id_m
      6    and i.id = r.id_i
      7    and m.m_name = 'pudding';
    
    M_NAME               I_NAME               JMJ          KOL
    -------------------- -------------------- ----- ----------
    pudding              egg                  kom            4
    pudding              butter               g            210
    pudding              milk                 cup            1
    
    SQL>
    What else do you need? Constraints! That part I'll leave to you.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    I hope you get a good grade on this homework assignment.
    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.

  4. #4
    Join Date
    Nov 2010
    Posts
    2
    Dear One with borrowed wise words. If you know so much, shouldn't you be busy filling up narrow minded ones like you with knowledge. you are not suppose to be here.

Posting Permissions

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