1
I am creating a site and I have a problem in it, in this site I will display some characters of the game League of Legends and I will show which character is strong or weak in relation to others, for example Character 1 is strong against Character 2 but is weak against Character 3.
I own the table CAMPEOES
and registered there:
| champ_id | champ_nome | champ_descricao | champ_avatar |
To create this relationship I will need to create another table to relate them or I can do something on the championship table itself since it has the information I will need that are champ_nome
and champ_avatar
.
Characters can be related to several other characters at the same time.
I believe it is better to create another structure. Or a table, or two. A table (champ_id_principal, champ_id_secundario, relacao), where champ_id_principal is strong or weak in relation to the secondary, so the field relation. Or two tables. "tbl_fortes", champ_prin, champ_sec. where the main is stronger than sec, and the same idea for the "tbl_fracos". It’s up to you, it’s a matter of opinion what you’re looking for...
– Rafael Withoeft
Okay, I get it, but I can’t think of how
SELECT
to display the information, this question of relationship between tables confuses me enough.– Felipe Dumont
It depends on which structure you want to follow... you can define it and edit your question by placing the tables, which someone will help to assemble your select :)
– Rafael Withoeft
You are making the question broad by asking multiple questions on a single topic. At first you wanted to know how to do the relationship of two tables, now you are asking about how to perform the select. So the question about the relationship of the tables has been solved? The problem now is only the select?
– Renan Gomes
Yes Renan, sorry for this inconvenience the problem of the relationship was solved now I’m trying to figure out how would be the correct SELECT to bring the names of champions. I didn’t think it was right to ask another question to solve a related question.
– Felipe Dumont
@Felipedumont You can post the resolution as an answer to this question, giving details of how you solved the problem so it is useful for other users who experience situations similar to yours. You can mark your own answer as accepted. And then the subject of select could be discussed in a new question.
– Renan Gomes
OK Renan I’ll do it Thank you.
– Felipe Dumont
In this case I understand that the problem is the same, and would fit an issue in the question about select. If new answers appear with a better organization proposal, the separate question becomes obsolete.
– Bacco