How do I make a table with a compound key, but I can not repeat the combination of values.
I want to store FRIENDS , using a syntax similar to this:
tb_amizades
id_usuario_um
id_usuario_dois
SELECT * FROM tb_amizades
WHERE id_usuario_um = id OR id_usuario_dois = id
LIMIT (qtd_de_amigos);
This SELECT is inconsistent, but gives you the idea of what you want it to do. I'm using LIMIT so if I have 5 friends and the bank has more than 100 records and the system does not have to search at all.