In SQL Zoo problem, my code is not working, don't know why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

In SQL Zoo problem, my code is not working, don't know why?

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; INSERT into animals (name, type, country_id) values ('Slim', 'Giraffe',1); CREATE view detail as SELECT a.name, a.type, c.country FROM animals as a inner join countries as c on a.country_id = c.id order by c.country; SELECT * from detail ;

1st May 2021, 3:25 PM
Sneha Nath
Sneha Nath - avatar
15 Answers
+ 2
Sneha Nath I ran into the same problem. I think it's a bug. It won't take the string input as it is, it converts it into lowercase. That was the problem I was facing. So, I used INITCAP() in my code and it worked.!! Here is how to use it: INITCAP('hello world') will return - Hello World. So in the VALUES statement, add it like this: VALUES( INITCAP ('Slim'), INITCAP ('Giraffe'), 1) Now, it is forced to take the input string as it is. See the code I wrote here: https://code.sololearn.com/W3wNGan42yrY/?ref=app
5th May 2021, 11:17 AM
Hanuma Ukkadapu
Hanuma Ukkadapu - avatar
+ 2
It worked, thank you
6th May 2021, 11:52 AM
Sneha Nath
Sneha Nath - avatar
+ 2
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;
25th May 2021, 11:21 PM
Gilbert García
Gilbert García - avatar
+ 1
There is a temporary bug in sql code-coach. Even correct code aren't satisfying test cases . hope sololearn will fix it soon.
1st May 2021, 3:30 PM
TOLUENE
TOLUENE - avatar
+ 1
The only thing i see is that you inserted the same giraffe twice. But i don't know is that's your issue.
1st May 2021, 3:35 PM
Jerry Hobby
Jerry Hobby - avatar
+ 1
Still not working, my output and the expected output are same. There might be some big in the test case.
2nd May 2021, 4:40 AM
Sneha Nath
Sneha Nath - 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, Countries WHERE id = country_id ORDER by Country; This a neat way to do it. it works.
17th Mar 2022, 8:10 AM
Ademola Aderogba
Ademola Aderogba - avatar
+ 1
ERROR: column "Slim" does not exist
3rd Sep 2022, 7:05 PM
Shaya Mario
Shaya Mario - avatar
0
I've used these 2 approaches separately. Both were not working, so i posted it here.
1st May 2021, 4:09 PM
Sneha Nath
Sneha Nath - avatar
0
Not working for me either. This is pretty frustrating
4th May 2021, 8:03 AM
Frederick Shanks
Frederick Shanks - avatar
0
doesn't work
17th Aug 2021, 1:41 AM
Stephen Goslin
Stephen Goslin - avatar
0
Thanks all of you
13th Feb 2022, 8:19 PM
Eminjon Karimov
0
/* 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 country; 🤔
20th Apr 2022, 3:21 AM
Ermek Yankov
Ermek Yankov - avatar
0
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 ;
19th Jul 2022, 10:52 AM
Emre EKEN
Emre EKEN - avatar
0
It worked thank you
29th Jul 2022, 5:02 AM
Swaroop Bhatawadekar
Swaroop Bhatawadekar - avatar