0

What is wrong vth thz quiery

/* name - "Slim", type - "Giraffe", country_id - 1 */ INSERT INTO Animals(name,type,country_id) VALUES ("Slim","Giraffe",1); SELECT * FROM Animals,Countries WHERE Animals.country_id=Countries.id;

8th Jun 2021, 3:08 AM
Madikanti Rohith
7 Antworten
+ 4
We can't do SELECT * on multiple tables. You might need to use JOIN for selecting columns from multiple tables. https://www.sololearn.com/learn/SQL/1865/?ref=app Also, we usually use single quotes for string/date values in INSERT UPDATE operation etc. VALUES( 'Slim', 'Giraffe', 1 )
8th Jun 2021, 3:35 AM
Ipang
+ 2
Please refer to the link on how to join tables, you are still not using JOIN in the query.
8th Jun 2021, 5:22 AM
Ipang
+ 2
I can, but I'm sure you can get through this once you learned how to join tables. And you'd be progressing ahead by learning. If you still can't solve this, I suggest you to search the forum. Someone must have tried and solved it earlier 👍 P.S. Also fix the double quotes in INSERT statement.
8th Jun 2021, 5:30 AM
Ipang
+ 2
Good job! 👍 And here are some previous discussion over this topic. https://www.sololearn.com/Discuss/2785990/?ref=app https://www.sololearn.com/Discuss/2771912/?ref=app
8th Jun 2021, 5:41 AM
Ipang
+ 1
/* name - "Slim", type - "Giraffe", country_id - 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; Still not working
8th Jun 2021, 3:48 AM
Madikanti Rohith
+ 1
Done now it's working
8th Jun 2021, 5:39 AM
Madikanti Rohith
0
Can u edit it plzz?
8th Jun 2021, 5:25 AM
Madikanti Rohith