SQL zoo | Sololearn: Learn to code for FREE!

+4

SQL zoo

You manage a zoo. Each animal in the zoo comes from a different country. Here are the tables you have:

sql

1/19/2021 9:54:29 PM

Himanshu Thakur

13 Answers

New Answer

+11

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;

+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; use this ,it will help you

+1

........is working......... 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;

+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;

0

You don't have to quote 1 in VALUES. While writing SELECT name, type country_id, you have to mention table name also, like Animals.name, Animals.type. In the last ORDER BY Countries.country; Hope this is helpful.

0

Thank you Pallavi It works and I'll work hard to understand every tiny points for this SQL codes

0

thanks Islem M'HALLA

0

coding zoo please

0

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;

-2

/* name - "Slim", type - "Giraffe", country_id - 1 */ INSERT INTO animals (name, type, Country_id) VALUES ('Slim', 'Giraffe', '1'); SELECT name type country_id FROM animals INNER JOIN countries ON animal.country_id = countries.country; I'm getting error in "type"

-2

THANK YOU BHUMIKKUMAR KALOLA