- 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;
25 Respostas
+ 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;
+ 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
+ 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
+ 3
slim should be Slim , giraffe should be Giraffe , don't miss the capital letters, try with capital letters, it will run
+ 2
That shall be ok. Here are more similar questions. Probably the sql has a bug.
+ 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;
+ 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;
+ 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;
+ 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
SIVA PRAKASH
Do ORDER BY country.id DESC but I don't think it will run because SQL Compiler has problem.
0
@i am aj Even after doing that it shows no input & no output
0
sql right now is broken, thats why you get no output. we all waiting for fix.
0
and btw in insert sentence the country_id (1) should be without quotes since its integer, it not need it
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.
0
Me too same problem, I don't know why doesn't work !!!!
Plz anyone of you help us
0
No compiler issues. It has no problem. The question is in a confusing complicated manner. That's only the challenge.
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;
0
Still having the same issue as they did in February. I thought I was going crazy
0
Insert into animal(name,type,country_id)
Values
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