HELP ME SOLVE THIS SQL QUESTION -- You manage a zoo. Each animal in the zoo comes from a different country. Here are the tables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

HELP ME SOLVE THIS SQL QUESTION -- You manage a zoo. Each animal in the zoo comes from a different country. Here are the tables

INSERT INTO Animals VALUES ('slim','giraffe','1'); SELECT Animals.name , Animals.type , Countries.country FROM Animals INNER JOIN Countries on Animals.country_id=Countries.id ORDER BY country;

15th Feb 2021, 11:36 AM
SIVA PRAKASH
SIVA PRAKASH - avatar
25 Answers
+ 18
This is the right answer: 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;
11th Mar 2021, 2:19 PM
Louba
Louba - avatar
+ 5
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; It's work
30th Jan 2022, 6:45 PM
Avrian Shandy
Avrian Shandy - avatar
+ 3
/* 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; Try this. Help you
17th Feb 2021, 3:07 AM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 3
slim should be Slim , giraffe should be Giraffe , don't miss the capital letters, try with capital letters, it will run
7th Apr 2021, 6:37 PM
Naveen kumar M
Naveen kumar M - avatar
+ 2
That shall be ok. Here are more similar questions. Probably the sql has a bug.
15th Feb 2021, 11:44 AM
JaScript
JaScript - avatar
+ 2
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;
11th Apr 2022, 11:14 AM
Raxmonjon Yusubjanov
+ 1
Try in this manner INSERT INTO Animals VALUES ( 'Slim' , 'Giraffe', 1); SELECT a.name, a.type, c.country FROM Animals as a INNER JOIN Countries as c ON a.country_id = c.id ORDER BY country;
16th Feb 2021, 3:00 AM
Luis Felipe Alzamora Milla
Luis Felipe Alzamora Milla - avatar
+ 1
/* 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;
15th Mar 2021, 5:56 PM
Syed Fahad Ahmed
Syed Fahad Ahmed - avatar
+ 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 Country;
16th Mar 2023, 3:37 PM
Samuel Osagie
Samuel Osagie - avatar
0
SIVA PRAKASH Do ORDER BY country.id DESC but I don't think it will run because SQL Compiler has problem.
15th Feb 2021, 11:43 AM
A͢J
A͢J - avatar
0
@i am aj Even after doing that it shows no input & no output
15th Feb 2021, 11:52 AM
SIVA PRAKASH
SIVA PRAKASH - avatar
0
sql right now is broken, thats why you get no output. we all waiting for fix.
15th Feb 2021, 3:01 PM
Артём Сильченко
Артём Сильченко - avatar
0
and btw in insert sentence the country_id (1) should be without quotes since its integer, it not need it
15th Feb 2021, 3:03 PM
Артём Сильченко
Артём Сильченко - avatar
0
Having the correct output but there is no input and it shows my project haven't completed so all the project is facing the same issue.
1st May 2021, 9:54 AM
Chooi Shi Hui
Chooi Shi Hui - avatar
0
Me too same problem, I don't know why doesn't work !!!! Plz anyone of you help us
2nd May 2021, 12:04 PM
Imad EL ADDOUNI
0
No compiler issues. It has no problem. The question is in a confusing complicated manner. That's only the challenge.
20th Jun 2021, 6:12 PM
Tony Abraham Varughese
Tony Abraham Varughese - avatar
0
INSERT INTO Animals (name, type, country_id) VALUES('Slim','Giraffe',1); SELECT initcap(a.name) as name, initcap(a.type) as type, CASE when a.country_id=3 then initcap('India') when a.country_id=2 then initcap('Russia') when a.country_id=1 then upper('USA') END AS country FROM Animals AS a inner join Countries AS c on a.country_id=c.id order by c.country Asc;
6th Aug 2021, 12:08 AM
Minhaz
0
Still having the same issue as they did in February. I thought I was going crazy
22nd Sep 2021, 12:03 AM
Max Sietsema
Max Sietsema - avatar
0
Insert into animal(name,type,country_id) Values
12th Nov 2021, 9:50 PM
Mwingwa Amissi
Mwingwa Amissi - avatar
0
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; This code work fine.. Solve 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. Each animal in the zoo comes from a different country. Here are the tables
3rd Jun 2022, 8:47 AM
Narayan Das
Narayan Das - avatar