Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2010
    Posts
    49

    Junction Table Help

    Can I use the information from one table in two different junction tables? Basically i have a table that holds 15 entries that can be used by two other tables for two different reason.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    hard to tell from such a meager amount of information

    but 15 columns for different reasons sounds wrong -- you should probably codify the reason and include it in the foreign keys
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    in essence I'd suggest two sub tables, one for each parent,. otherwise you sll loose the referential integrity constraints in the DB.
    one table per reason.
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Apr 2010
    Posts
    49
    Sorry, that was totally vague of me :P

    There's a table that holds the names of fifteen notes (music)

    There's another table holds all the names of the scales in music

    The parent table will use this information to pull note names for keys and scales.

    Example: a song could be in the key of C but use a B minor Pentatonic scale for soloing. 2 different notes and uses pulled from the same note name table.

    The parent table will use the scale information to pull the name of the key and scales used. Example: a song is in C major and uses the C major scale and B Minor Pentatonic scale.


    Will that work? I'll use a junction table to relate the parenttableID to notenameID and scalenameID and then another junction to relate parenttableID to notenameID to scalenameID (which in this table functions as the key name)

    Note: for non music people, scales and keys can share the same name. That's why i want to use one table to populate the available choices for each
    Last edited by .:RoKsTaR:.; 03-01-12 at 14:14.

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    the music theory went whoosh, right over my head, in the key of OMG

    how about you please show us the table layout (column names and datatypes) for each of your tables and then ask the question again
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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