- 3

1) A new animal has come in, with the following details: name - "Slim", type - "Giraffe", country_id - 1 Add him to the Animals

1) A new animal has come in, with the following details: name - "Slim", type - "Giraffe", country_id - 1 Add him to the Animals table. 2) You want to make a complete list of the animals for the zooā€™s visitors. Write a query to output a new table with each animal's name, type and country fields, sorted by countries. Expected Output name,type,country Bert,Tiger,India Candy,Elephant,India Vova,Bear,Russia Slim,Giraffe,USA Merlin,Lion,USA Pop,Horse,USA Table: Animals (Name, type, country_id) ('Candy', 'elephant', 3), ('pop', 'horse', 1), ('vova', 'bear', 2), ('Merlin', 'lion', 1), ('Bert', 'tiger', 3) Table: countries (id, country) (1, 'USA'), (2, 'Russia'), (3, 'India')

14th Sep 2022, 4:42 AM
Mohit Namdev
Mohit Namdev - avatar
4 Answers
+ 7
SoloProg , often discussed with you, but seems to be ignored by you repeatedly. please do not give ready-made codes here, as long as the op has not shown his attempt.
14th Sep 2022, 2:00 PM
Lothar
Lothar - avatar
+ 3
Hi! Where is your try?
14th Sep 2022, 5:27 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
22nd Sep 2022, 11:18 AM
CalviÕ²
CalviÕ² - avatar
+ 1
insert into Animals values ('Slim', 'Giraffe', 1); select a.name, a.type, c.country from Animals a inner join Countries c on c.id=a.country_id order by c.country;
14th Sep 2022, 1:52 PM
SoloProg
SoloProg - avatar