Sql zoo | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Sql zoo

/* name - "Slim", type - "Giraffe", country_id - 1 */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 Is it right

22nd Apr 2021, 5:29 AM
Garima
Garima - avatar
8 Answers
+ 6
Garima Try this one : /* name - "Slim", type - "Giraffe", country_id - 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; Happy Coding 👍
23rd Apr 2021, 10:33 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 4
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 asc ;
7th Oct 2021, 6:57 PM
Veronika Ulasik
Veronika Ulasik - avatar
+ 3
Garima No there should be s caps in slim 2nd you have to use INNER JOIN 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 Animals.country_id DESC;
22nd Apr 2021, 5:34 AM
A͢J
A͢J - avatar
+ 2
This zoo project is making me bored It really made me feel bad for solo learn I have tried all my plans yet nothing is happening I have got the required output I think solo learn should check against the output not the code cause coding is an art
5th Aug 2022, 12:16 AM
Wavei Haruna
Wavei Haruna - avatar
+ 1
/* This lines is to insert data into the three columns in the animals table*/ INSERT INTO animals VALUES ('Slim', 'Giraffe', 1); /* This lines is to select the columns we wish to JOIN*/ SELECT animals.name, animals.type, countries.country FROM countries /* This lines is to match the data types we are JOINING*/ INNER JOIN animals ON animals.country_id = countries.id /*This line is to order our table by the name of the countries*/ ORDER BY countries.country;
17th Aug 2023, 10:34 AM
Afonso Pena
Afonso Pena - avatar
0
Hey can any one provide correct answer for this zoo project kindly message me . I have tried all queries but not work getting same answer with non capital letters.
2nd May 2021, 2:00 PM
Ahsan Tariq
Ahsan Tariq - avatar
0
/* name - "Slim", type - "Giraffe", country_id - 1 */ here we are inserting info into tables : => insert into Animals (name,type,country_id) values ('Slim','Giraffe',1); for result we use select & unner join to take from Countries table country and use it in animals table : => SELECT Animals.name,Animals.type,Countries.country FROM Animals INNER JOIN Countries ON Animals.country_id=Countries.id order by Countries.country;
19th Oct 2021, 5:53 PM
AL-Mahdi Ait-ounzar
AL-Mahdi Ait-ounzar - avatar
0
it is 'Slim' not 'slim'
22nd Nov 2021, 8:01 PM
Vali Mikayilov
Vali Mikayilov - avatar