SQL query doubt | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

SQL query doubt

The SQL Zoo project in this app seems to have bug. Even though i have put correct SQL query and getting expected output but still not able to clear the test.. getting error 'try again' I have inserted below sql query INSERT into animals values ('slim','Giraffe',1); select Animals.name,Animals.type,countries.country from countries INNER join animals on countries.id=animals.country_id order by country; Please help.

18th Apr 2021, 3:52 AM
Chaitanya Joshi
Chaitanya Joshi - avatar
7 Answers
0
i wonder if it is case sensitive. maybe use lowercase a for animals. below is my attempt at the challenge. insert into animals values('Slim', 'Giraffe', '1'); select a.name, a.type, c.country from animals as a join countries as c on a.country_id = c.id order by c.country
18th Apr 2021, 4:19 AM
you are smart. you are brave.
you are smart. you are brave. - avatar
+ 1
i think you might need to include the column names in the insert statement. a slightly modified version of your code is provided below. INSERT into animals (name, type, country_id) values ('slim','Giraffe',1); select Animals.name,Animals.type,countries.country from countries INNER join animals on countries.id=animals.country_id order by country;
18th Apr 2021, 4:07 AM
you are smart. you are brave.
you are smart. you are brave. - avatar
+ 1
Try this 👇 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 ASC;
21st Apr 2021, 5:38 PM
Neha C Naik
Neha C Naik - avatar
0
Thanks Andrew but still getting same error, 'Try again' even though output is coming correctly.
18th Apr 2021, 4:14 AM
Chaitanya Joshi
Chaitanya Joshi - avatar
0
Thanks a ton Andrew, it worked.
18th Apr 2021, 4:25 AM
Chaitanya Joshi
Chaitanya Joshi - avatar
0
wonderful !
18th Apr 2021, 5:19 AM
you are smart. you are brave.
you are smart. you are brave. - avatar
0
Thanks Neha..its solved already.
22nd Apr 2021, 6:04 AM
Chaitanya Joshi
Chaitanya Joshi - avatar