#1
  1. No Profile Picture
    xale
    Guest
    Devshed Newbie (0 - 499 posts)
    good evening!

    i'm building my first sql (mysql) database
    and i'm faced with a little big problem.
    (but not the first one i query...)

    i'd like to have the following structure:

    id=1 nom=musique
    id=2 nom=theatre

    id=10 nom=disco ref=1
    id=11 nom=concert ref=1
    id=12 nom=theatre d'objets ref=2

    id=100 nom=pop ref=10&11
    id=101 nom=rock ref=10&11
    id=102 nom=punk ref=10


    so, pop and rock appear in the group
    disco an concert and the tree are under
    music... but punk can only appear in concert/music...

    can somebody help me? does anybody know
    where i can lern a little bit more of
    table architecture (if possible free and
    on-line! ... i have plenty of time and
    a litle bit less of money... sorry...)?

    thank you. ciaaaaaaao

    a.l.e
  2. #2
  3. No Profile Picture
    DesertFox
    Guest
    Devshed Newbie (0 - 499 posts)
    a.l.e.

    Hi,

    You can have 1 huge table and list all possible combinations.

    NOM1 NOM2 NOM3
    musique disco pop
    musique concert pop
    musique disco rock
    musique concert rock
    musique disco punk
    theatre theatre d'objets


    But, making 3 tables:

    First table will be:
    T1-ID NOM
    1 musique
    2 theatre

    Second Table:
    T2-ID NOM T1-ID
    10 disco 1
    11 concert 1
    12 theatre d'objets 2

    Third Table:
    T3-ID NOM T2-ID
    100 pop 10
    100 pop 11
    101 rock 10
    101 rock 11
    102 punk 10


    The various T?-ID are your "linking fields" (The fields that will relate all three tables together).

    Hope this helps.

Similar Threads

  1. Replies: 3
    Last Post: December 2nd, 2003, 12:17 PM
  2. How do I get a structure member out of a pointer?
    By insaneyogi in forum C Programming
    Replies: 1
    Last Post: September 12th, 2003, 03:04 AM
  3. segfault when assigning fields to a structure
    By m_breza in forum C Programming
    Replies: 3
    Last Post: July 5th, 2003, 09:26 AM
  4. reading structured arrays, changing their structure
    By _john007 in forum C Programming
    Replies: 1
    Last Post: May 15th, 2003, 04:53 PM
  5. Uknow Known MYSQLERROR
    By andyw in forum MySQL Help
    Replies: 7
    Last Post: January 23rd, 2001, 10:34 AM

IMN logo majestic logo threadwatch logo seochat tools logo