What's wrong in my code? ZOO | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What's wrong in my code? ZOO

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 ;

16th May 2021, 12:25 PM
srishti gupta
srishti gupta - avatar
5 Answers
+ 5
Thanks both of you... ☺☺
16th May 2021, 12:33 PM
srishti gupta
srishti gupta - avatar
+ 2
INSERT into animals (name,type,country_id) VALUES ('Slim','Giraffe',1); SELECT a.name, a.type, c.country FROM animals as a INNER JOIN countries AS c ON a.country_id = c.id ORDER BY id DESC;
16th May 2021, 12:29 PM
axita
axita - avatar
+ 2
Add strings into quotes ' ' Missing ; at the end of first query And specify countries in descending order I'd.
16th May 2021, 12:34 PM
axita
axita - avatar
+ 2
Only two mistakes in my code first is quotes and second terminated symbol (;) Thanks for helping me
16th May 2021, 12:37 PM
srishti gupta
srishti gupta - avatar
+ 1
Your question is not quite clear. While inserting an element, if it's a string/varchar then you should write 'Slim' and 'Giraffe'.
16th May 2021, 12:30 PM
Sharique