MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Mike Diehl Date:August 4 2011 2:41pm
Subject:Re: Too many aliases
View as plain text  
Well, while we're on the subject of SQL style, can anyone tell me why I'm 
always seeing people prefixing the name of a table with something like "tbl?"

For example:

create table tblCUSTOMERS ( ... );

Seems to me that you should probably know that CUSTOMERS is a table, or is it 
just me?

Looking forward to your input.


On Thursday 04 August 2011 6:43:55 am David Lerer wrote:
> I agree. I use the same column name in all tables where it has the same
> function - but I consistently add a suffix or prefix. And yes, it is the
> old fashion way.... David.
> -----Original Message-----
> From: hsv@stripped [mailto:hsv@stripped]
> Sent: Thursday, August 04, 2011 8:26 AM
> To: rik@stripped
> Cc: mysql@stripped
> Subject: Re: Too many aliases
> >>>> 2011/08/03 12:46 +0200, Rik Wasmus >>>>
> But the
> main thing is it helps to distinguish tables  in joins having the same
> table
> more then once (and of course results from subqueries etc.):
> SELECT first.*
> FROM tablename first
> LEFT JOIN   tablename second
>    ON    first.some_id = second.some_id
>    AND !=
> <<<<<<<<
> Well, yes, here it is needful. But it seems to me from most of the
> examples that people here post, that they have the idea that it is the
> style always to use one-letter aliases, whether it is helpful or not.
> Now I do not do this, but I often see examples where a field for one
> purpose has in one table one name, and in another table another,
> slightly different, name, and then, too, I see alias used, although, in
> this case, no table name at all is needed. (I like to use the same field
> name in all tables where it has the same function.)


Take care and have fun,
Mike Diehl.
Which is betterAdarsh Sharma2 Aug
  • RE: Which is betterShafi AHMED2 Aug
  • Too many aliases(Halász Sándor)2 Aug
    • Re: Too many aliasesRik Wasmus3 Aug
      • RE: Too many aliasesDavid Lerer3 Aug
        • RE: Too many aliasesshawn wilson3 Aug
        • RE: Too many aliasesJerry Schwartz4 Aug
      • Re: Too many aliases(Halász Sándor)4 Aug
        • RE: Too many aliasesDavid Lerer4 Aug
          • Re: Too many aliasesMike Diehl4 Aug
            • Re: Too many aliasesJohnny Withers4 Aug
              • Re: Too many aliases(Halász Sándor)6 Aug
                • Re: Too many aliasesJohnny Withers7 Aug
  • Re: Which is betterMySQL)2 Aug
    • RE: Which is betterDavid Lerer2 Aug
Re: Which is betterPrabhat Kumar2 Aug