sql statements

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tennis_blues
Forum Newbie
Posts: 21
Joined: Sun Oct 20, 2002 8:30 am

sql statements

Post by tennis_blues »

hi,
i am fairly new to mysql. can someone please point me in the right direction?

i have an SQL statement that queries multiple tables. does it matter how order the clauses in the where statement. i want the query to be as fast as possible.

here is an example:
SELECT Team.TeamName, Club.ClubName
FROM Team, Club
WHERE Team.TeamID = $TeamID and
Team.ClubID = Club.ClubID

I have TeamID indexed on the Team table and ClubID indexed on the Club table.

so, would my query be faster if i rearranged the where clause somehow? and if so, how should i rearrange it, please?

thanks so much!
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

Post by fractalvibes »

You might consider adding an index on the team.clubid

Phil J
Post Reply