- 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 ;
15 odpowiedzi
+ 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
+ 2
It worked, thank you
+ 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;
+ 1
There is a temporary bug in sql code-coach.
Even correct code aren't satisfying test cases . hope sololearn will fix it soon.
+ 1
The only thing i see is that you inserted the same giraffe twice. But i don't know is that's your issue.
+ 1
Still not working, my output and the expected output are same. There might be some big in the test case.
+ 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.
+ 1
ERROR: column "Slim" does not exist
0
I've used these 2 approaches separately.
Both were not working, so i posted it here.
0
Not working for me either. This is pretty frustrating
0
doesn't work
0
Thanks all of you
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; 🤔
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 ;
0
It worked thank you