Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Posts
    1

    Many to Many relationship

    hi,

    I have a question on a table design.

    I am developing a web application. There are many jsp files and some tables in mySQL.

    In my application, there is a feature to delete the tables. So if the user want to delete the tables, it will warn the user what jsp files are using the table.

    The situation is one table can associate with many files and one file can use many tables. So this is a many to many relationship.

    Let's say i have a table called 'PersonalDetail', the fields in the table are 'Name', 'DOB', 'Address', 'Age'. There are 3 files are using this table.

    So i add a new table called 'LinkedPersonDetail' to store the associated files in this table to resolve the many to many relationship.

    The fields in the table 'LinkedPersonDetail' are 'FileUsing', 'FilePath'. One drawback of this solution i can think now is when i add a new table in the database, i should add one more linked table.

    Can anyone suggest another good way to solve the problem?

    ypc

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171

    Re: Many to Many relationship

    Originally posted by yupong
    hi,

    I have a question on a table design.

    I am developing a web application. There are many jsp files and some tables in mySQL.

    In my application, there is a feature to delete the tables. So if the user want to delete the tables, it will warn the user what jsp files are using the table.

    The situation is one table can associate with many files and one file can use many tables. So this is a many to many relationship.

    Let's say i have a table called 'PersonalDetail', the fields in the table are 'Name', 'DOB', 'Address', 'Age'. There are 3 files are using this table.

    So i add a new table called 'LinkedPersonDetail' to store the associated files in this table to resolve the many to many relationship.

    The fields in the table 'LinkedPersonDetail' are 'FileUsing', 'FilePath'. One drawback of this solution i can think now is when i add a new table in the database, i should add one more linked table.

    Can anyone suggest another good way to solve the problem?

    ypc
    This is metadata - data about data. So why not have just one intersection table, plus a new table of table names:

    Table( TableName PK );
    LinkedTable( TableName FK, FileUsing, FilePath );

Posting Permissions

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