END OF MODULE PROJECT | Sololearn: Learn to code for FREE!

0

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.

sql

2/15/2021 6:04:34 AM

Justin Victor S. Mancilla

16 Answers

New Answer

+1

/* 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

+1

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

0

Answer plzzz

0

/* 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

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 Countries.country;

0

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

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

-1

Hi! Your attempt?

-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

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