Instead of SELECT tla_foo FROM ThreeLetterAcronym JOIN ... I prefer SELECT tla.foo -- Note "." instead of "_" FROM ThreeLetterAcronym AS tla JOIN ...
Using aliases is mandatory when a "self join" is used. > -----Original Message----- > From: Johan De Meersman [mailto:vegiv...@tuxera.be] > Sent: Monday, May 21, 2012 5:27 AM > To: Rick James > Cc: da...@lorenso.com; mysql@lists.mysql.com > Subject: Re: create alias for columns bound to database? > > ----- Original Message ----- > > From: "Rick James" <rja...@yahoo-inc.com> > > > > * should not begin with the table name > > Personally, I tend to prefix all column names with three-letter > abbreviations of the table name, so that they are both unique across > joins, and it's obvious what table they're from wherever they appear. > > > * ids should be spelled the same between tables (`foo_id` both where > > it is the PK, and where it is a FK) > > Yeps, and together with the above convention it is also immediately > clear what table that key links to. > > Beyond that, make names descriptive. Don't use field_1, field_2 and > field_3; call them name, age and gender. > > -- > Bier met grenadyn > Is als mosterd by den wyn > Sy die't drinkt, is eene kwezel > Hy die't drinkt, is ras een ezel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql