1
How do I make a table with composite key, but I can’t repeat the combination of values.
I want to store FRIENDSHIPS, using a syntax similar to is:
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 you can give the idea of what it does to you. I’m using LIMIT in case I have 5 friends and the bank has more than 100 records and the system doesn’t have to search at all.