- 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')
4 Respostas
+ 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.
+ 3
Hi! Where is your try?
+ 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;