0

I'm creating a huge database with many kinds of elements, so I have a few tables with the data. Something like the following:

Table1
-name
-number
Table2
-name
-address
-number
Table3
-address
-state
-color

Now I'm trying to create another table with links out of my database. Every link has the same attributes (title,url,element), but can be connected to any of the elements. Is it better to use one table for all links and determine the correct element via an attribute, or should I create many tables, one for every element?

Links
-elementKey
-url
-elementType

or

Links1
-elementKey
-url
Links2
-elementKey
-url
Aslanex
  • 79
  • 2
  • 9

1 Answers1

0

Neither of the two solutions are good. Use a relation table instead.

More can be found here: MySQL multiple foreign keys

Community
  • 1
  • 1
Aslanex
  • 79
  • 2
  • 9