- 3
SQL zoo
You manage a zoo. Each animal in the zoo comes from a different country. Here are the tables you have:
24 Answers
+ 20
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;
+ 3
........is working.........
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;
+ 2
You don't have to quote 1 in VALUES.
While writing SELECT name, type country_id, you have to mention table name also, like Animals.name, Animals.type.
In the last ORDER BY Countries.country;
Hope this is helpful.
+ 2
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;
+ 2
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;
It`s working
+ 2
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
Thank you Pallavi It works and I'll work hard to understand every tiny points for this SQL codes
+ 1
thanks Islem M'HALLA
+ 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;
use this ,it will help you
+ 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
coding zoo please
+ 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 animals.country_id desc;
+ 1
Working code, that system accepts:
/* name - "Slim", type - "Giraffe", country_id - 1 */
INSERT into animals
VALUES ('Slim','Giraffe',1);
SELECT a.name, a.type, c.country
from animals a
INNER JOIN Countries c
on a.country_id=c.id
ORDER by c.country;
0
/* name - "Slim", type - "Giraffe", country_id - 1 */
INSERT INTO animals (name, type, Country_id)
VALUES ('Slim', 'Giraffe', '1');
SELECT name type country_id
FROM animals
INNER JOIN countries
ON animal.country_id = countries.country;
I'm getting error in "type"
0
THANK YOU BHUMIKKUMAR KALOLA
0
Select … from
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;
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
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;
0
Hi! you can use one of these options below:
NOTE:
Check capital letters on values!
Option 1:
-- name - "Slim", type - "Giraffe", country_id - 1 into table
insert into Animals (name, type, country_id) values ('Slim', 'Giraffe',1 );
-- a query to output a new table with each animal's name, type and country fields, sorted by countries.
select animals.name, animals.type, countries.country into newtable from animals inner join countries
on animals.country_id = countries.id order by countries.country;
select* from newtable;
Option 2:
-- name - "Slim", type - "Giraffe", country_id - 1 into table
insert into Animals (name, type, country_id) values ('Slim', 'Giraffe',1 );
-- a query to output a new table with each animal's name, type and country fields, sorted by countries.
create table newtable as (select animals.name, animals.type, countries.country from animals inner join countries
on animals.country_id = countries.id order by countries.country);
select* from newtable;