1
I’m not very good with database relationship and am starting my studies.
I wonder why developers shorten when calling tables or if this is the mandatory?
SELECT p.*, c.`nome` AS categoria, u.`nome` AS usuario FROM `produtos` AS p
INNER JOIN `categorias` AS c ON p.`categoria_id` = c.`id`
INNER JOIN `usuarios` AS u ON p.`usuario_id` = u.`id`
WHERE (p.`ativo` = 1) ORDER BY p.`nome` ASC
this is very confusing, I know that there he is joining 2 tables in a query but I do not understand this:
p.* , p.´nome´, c.`nome`, u.`nome`
Rafael, it’s not mandatory! I prefer to put names in the table because I don’t need to write all your text. The idea is to abbreviate.
– Marconi