Help me please with inner join in sql | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

27th Aug 2022, 3:34 PM
Tamara Danielyan
4 Answers
0
animals have country_id as column name. But you using it as animal.countries_id
29th Aug 2022, 8:33 AM
Jayakrishna 🇮🇳
+ 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
29th Aug 2022, 12:26 PM
Shayan Ahmad Khan
Shayan Ahmad Khan - avatar
+ 1
Thank you very much!!!
31st Aug 2022, 3:27 PM
Tamara Danielyan
0
Only SELECT name, type, country. Don't include countries_id in the SELECT. Also remember to sort by country.
29th Aug 2022, 11:02 AM
Brian
Brian - avatar