+ 1
END OF MODULE PROJECT
Please help me :(( 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.
20 Antworten
0
Answerpl
0
Answer plzzz
0
This will works
0
/* name - "Slim", type - "Giraffe", country_id - 1 */
INSERT INTO Animals (name, type, country_id) VALUES('Slim', 'Giraffe', '1');
SELECT name, type, country FROM Animals, Countries where Countries.id = Animals.country_id order by Countries.id DESC;
this works perfectly for me and it easy
0
INSERT INTO Animals (name, type, country_id)
VALUES ('Slim', 'Giraffe', 1);
select animals.name as name, animals.type as type,
countries.country as country
from animals
inner join countries
on animals.country_id=countries.id
order by countries.country;
0
With my code, why is the output changing the format of the info? USA should be all caps. How do I get the output to not change from capitals?
/* 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 Countries.country;
0
This is what I used and it works!
insert into animals 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
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;
0
Pls can someone show me where I went wrong here, Sololearn kept seeing errors, pointing out that Slim is not a column or not seeing input at all
INSERT INTO Animals (name,type,country_id)
VALUES ('Slim','Giraffe',1);
Pls tell me what went wrong
0
i use this and works
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_id DESC;
0
INSERT INTO Animals (name, type, country_id) VALUES('Slim', 'Giraffe', '1');
SELECT name, type, country FROM Animals, Countries where Countries.id = Animals.country_id order by Countries.id DESC;
0
/* name - "Slim", type - "Giraffe", country_id - 1 */
INSERT into animals VALUES ('Slim', 'Giraffe', 1);
SELECT name, type, country from animals INNER JOIN countries
on animals.country_id = countries.id
ORDER by country
0
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
- 1
Here's my answer but it is not taking it:
/* name - "Slim", type - "Giraffe", country_id - 1 */
Insert into animals
values ('Slim', 'Girrafe', 1);
select animals.name, animals.type, countries.country
from animals inner join countries
on animals.country_id=countries.id
order by country;
ERROR: syntax error at or near "select"
LINE 5: select animals.name, animals.type, countries.country
^
- 1
/* name - "Slim", type - "Giraffe", country_id - 1 */
Insert into animals
values ('Slim', 'Girrafe', 1);
select animals.name AS name, animals.type as type, countries.country as country
from animals
INNER JOIN countries
ON animals.country_id=countries.id
order by countries.country;
- 1
/* name - "Slim", type - "Giraffe", country_id - 1 */
Insert into animals
values ('Slim', 'Girraffe', 1);
select animals.name AS name, animals.type as type, countries.country as country
from animals
INNER JOIN countries
ON animals.country_id=countries.id
order by countries.country;
Good answer
- 1
Here is my second attempt. Everything looks good except the USA outputs Usa. Any ideas?
/* name - "Slim", type - "Giraffe", country_id - 1 */
INSERT INTO Animals (name,type,country_id)
VALUES ('Slim','Giraffe',1);
SELECT INITCAP (Animals.name) AS name, INITCAP (Animals.type) AS type, INITCAP (Countries.country) AS country
FROM Animals
INNER JOIN Countries
ON Animals.country_id = Countries.id
ORDER BY Countries.Country
- 2
Hi! Your attempt?
- 2
/* 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;