+ 1

I've tried nearly everything but still can't get this code right, can someone please point out to me what i'm missing. 😤

INSERT INTO Animals (name, type, country_id) VALUES (name, 'Slim', type, 'Giraffe', country_id, 1); SELECT * FROM Animals; SELECT name, type, country FROM Animals INNER JOIN Countries ON Animals.country_id = Countries.id ORDER BY Countries;

22nd Feb 2022, 6:33 PM
Jason Francis
Jason Francis - avatar
2 Respostas
+ 5
you are using the wrong values. you have three columns in Animals(name, type, country_id) VALUES should have three values. since they are predefined you can just write them between " " for string and numbers for int. VALUES("Slim", "Giraffe", 1) when you use name, type and country_id inside VALUES( ), they are treated as variables and they don't exist. you also don't have to use SELECT * FROM Animals;
22nd Feb 2022, 6:57 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
I appreciate the clarity in your answer, thank you! 👊
22nd Feb 2022, 7:58 PM
Jason Francis
Jason Francis - avatar