If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Many to Many relationship

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-24-03, 14:23
yupong yupong is offline
Registered User
 
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
Reply With Quote
  #2 (permalink)  
Old 08-26-03, 05:16
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Many to Many relationship

Quote:
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 );
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On