If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Query speed when using aliases for tables.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-11-07, 06:21
Nevisen Nevisen is offline
Registered User
 
Join Date: Dec 2007
Posts: 3
Query speed when using aliases for tables.

Hi,

Does queries become slower when you type them like this:

SELECT concat(U.Firstname, ' ', U.Lastname) AS 'Full Name', L.Username FROM tbusers U, tblogin L WHERE U.ID = L.UserID AND L.iActive = 1

rather than typing them out fully like this:

SELECT concat(tbusers.Firstname, ' ', tbusers.Lastname) AS 'Full Name', tblogin.Username FROM tbusers JOIN tblogin on tbusers.ID = tblogin.UserID WHERE tblogin.iActive = 1

And why are there 2 ways to do the same query ?
Reply With Quote
  #2 (permalink)  
Old 12-11-07, 06:56
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
1. no, there is no difference in speed, but there is a dramatic increase in understandability

besides, you confused two questions into one: use of longer table aliases, and use of JOIN syntax

2. actually, there are more than 2 ways to do the same query
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On