Is it possible to retrieve fields other than the foreign key?

Asked

Viewed 20 times

0

The doubt is as follows:

I own these two tables:

inserir a descrição da imagem aqui

Note that carro_id is a foreign key in the table "person"... If I want to bring a query like for example:

"Name of Person, Birth, Brand of Car and Year of Car" Can I? Since by the relation I only have the column ID referenced in the person table...

1 answer

1

It would be something like

select Pessoa.Nome, Carro.Marca from Pessoa 
    inner join Carro
       on Pessoa.Carro_id = Carro.Carro_id

?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.