Jump to content
  • Advertisement
Sign in to follow this  
Farrenco

[web] inner join question

This topic is 3652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a question about inner join, I have the following tables: Users : name, citycode, carcode City : citycode, name Cars : carcode, name Are the following queries the same, or are they different in a way? they give the same result. 1. SELECT name, city.name, cars.name FROM users INNER JOIN city ON users.citycode = city.citycode INNER JOIN cars ON users.carcode = cars.carcode 2. SELECT users.name, city.name, cars.name FROM cars INNER JOIN (users INNER JOIN city ON city.code = users.code) ON users.citycode = city.citycode

Share this post


Link to post
Share on other sites
Advertisement
The queries should be the same. The database engine will analyze the query, figure out what tables will need to be joined, and then figure out what way is the best way to do that (by actually guessing how long several different ways will take). Both queries join the same tables so the engine should analyze them in the same way.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!