1
Answering your question:
What do you want is not subselect and yes JOIN.
Example of JOIN whereas your sale table will always have 1 book for sale:
SELECT *
FROM VENDAS VD
INNER JOIN LIVROS LV ON LV.IDLIVRO = VD.IDLIVRO
Filtering some fields:
SELECT VD.IDVENDA, LV.TITULO, LV.PRECO
FROM VENDAS VD
JOIN LIVROS LV ON LV.IDLIVRO = VD.IDLIVRO
(In the examples see that I used INNER JOIN and JOIN. In this case it works the same way, because using only JOIN he assumes as if he were INNER.)
Extra examples:
To bring ALL values of table VENDAS even though nay completed the field IDLIVRO on the table VENDAS, use the LEFT JOIN:
SELECT *
FROM VENDAS VD
LEFT JOIN LIVROS LV ON LV.IDLIVRO = VD.IDLIVRO
To bring ALL values of table LIVROS even though nay completed the field IDLIVRO on the table VENDAS, use the RIGHT JOIN:
SELECT *
FROM VENDAS VD
RIGHT JOIN LIVROS LV ON LV.IDLIVRO = VD.IDLIVRO
Reference on JOINS it would be nice to see as an example:


would not be a Join and not a subselect?
– Ricardo Pontual
If I’m not mistaken the command to do this is the
INNER JOIN.– Thiago Fernandes