+ 2
What's wrong in line of the sql project on zoo . The code is below
/* name - "Slim", type - "Giraffe", country_id - 1 */ insert into animals values(name="Slim",type="Giraffe",country_id ="1") SELECT animals.name ,animals.type,animals.country_id from animals inner join countries on animals .country_id = countries.id order by countries;
3 Respuestas
+ 2
First, the correct way to insert a record is:
insert into table
(column1, column2,...)
values(a, b, ...)
Your code will look like this:
insert into animals
(name, type, country_id)
values('Slim', 'Giraffe',1);
Second, in your select statement you need to reference the country name of the 'countries' table like this:
countries.country
Your code will look like:
SELECT
...
,countries.country
from
...
And finally to order you need to reference the same column
...
order by countries.country;
...
I hope this explanation solve your problem.
0
hvu
0
create t able shashi