Should I create many tables with an ID in the name or should I put the ID in a column?
The ID does not have to be escaped.
It depends on what you're trying to do.
The number of tables that will be created is unknown and could be very high
are you sure you can't store your data in another way and avoid so many tables?
you can often combine a lot more than you think in a table if it's layouted in the right way...
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
The issue is that i have many A and A has many B and B has a C with many D.
So should i just add an ID to the tables? Is there anything to avoid duplication of this key?
Sounds to me that you have a parent-child-relation there. link them together in the same table with a parentID, and reuse the datafield for all types, add a type field if you want to know if they are a A or B or so from the beginning. Top level posts then has parentid 0
Example:
id
type
parentid
datafield
to avoid duplicates, use the counter/auto_increment (name depending on database) option to the posts.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks