+ 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;

9th Aug 2021, 11:51 PM
Ermias Kebede
Ermias Kebede - avatar
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.
10th Aug 2021, 2:42 AM
CLAD
CLAD - avatar
0
hvu
31st Aug 2021, 3:53 AM
Sandor Tarly
Sandor Tarly - avatar
0
create t able shashi
6th Oct 2021, 3:57 PM
shashi devi
shashi devi - avatar