0
Help me please with inner join in sql
INSERT INTO Animals(name,type,country_id) VALUES ('Slim','Giraffe',1); SELECT * FROM Animals SELECT animals.name, animals.type, animals.countries_id, countries.country FROM Animals INNER JOIN Countries ON animals.country_id=countries.id
4 ответов
0
animals have country_id as column name. But you using it as animal.countries_id
+ 1
insert into Animals (name, type, country_id )
values ('Slim', 'Giraffe', 1);
SELECT Animals.name, Animals.type, countries.country from Animals
inner join countries on Animals.country_id=countries.id
order by countries.country
+ 1
Thank you very much!!!
0
Only SELECT name, type, country. Don't include countries_id in the SELECT. Also remember to sort by country.