Thursday, February 22, 2018

sql - what is the advantage of inner join tables

Answer



imagine I have 2 simple tables



users (id,username,password)
shopping(user_id,product_id)



and I use inner join to find each username buys which product :



select username,product_id
from shopping
inner join users
on users.id=shopping.user_id


but I can write a more simple query without using inner join and it works




select username,product_id
from shopping,users
where shopping.user_id=users.id


and result is the same
I wonder to know what's the advantage of using inner join !!

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...