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

Zoo question

I think this Zoo question in SQL don’t have an answer Can someone help me out? /* name - "Slim", type - "Giraffe", country_id - 1 */ INSERT INTO Animals VALUES ("slim", "Giraffe" ,1) ; SELECT country FROM countries INNER JOIN Animals ON countries.ID = Animals.Country_id ORDER BY country ;

4th Aug 2021, 12:52 AM
Ejeh Wayne
Ejeh Wayne - avatar
4 Answers
+ 9
You need to check animal type, animal name and it's country based on the given database Finally you have have to check it using conditions by comparing given id match the countries id or not and lastly sort it in descending order INSERT INTO Animals (name, type, country_id) VALUES ('Slim', 'Giraffe', 1); SELECT animals.name, animals.type, countries.country FROM animals, countries WHERE animals.country_id=countries.id order by animals.country_id desc I hope it clears your doubt
4th Aug 2021, 1:13 AM
Aysha
Aysha - avatar
+ 5
Ejeh Wayne most welcome
4th Aug 2021, 1:42 AM
Aysha
Aysha - avatar
+ 1
Aysha 💕 it sure did clear my doubt
4th Aug 2021, 1:42 AM
Ejeh Wayne
Ejeh Wayne - avatar
0
А вопрос где? Тут какие-то отрывки без смысла: Ни структуры таблиц Ни чем они заполнены И вообще, внутреннее соединение подразумевает наличие данных, идентичных, в обеих таблицах. Предлагая пустую таблицу стран запрос вернет пустую выборку
5th Aug 2021, 6:29 PM
Александр J
Александр J - avatar