x

Stupid table aliases

OK I admit this is a commentary more than a question, but I have to get it off my chest.

When you're aliasing a table, for pity's sake put some thought into it. I've seen two unrelated databases in the last two days which both have tables called notes. And the code all over the place aliases notes as not. For the sake of two characters you lose an awful lot of readability. That's all I'm saying. No it isn't. As for you meddling miscreants (and you know who you are) who alias every table as T1, T2, and T3. Come on, please. What does that tell anybody?

Am I the only one who gets annoyed by this kind of thing or should I get myself some real problems to worry about? :-)

more ▼

asked Jun 28, 2011 at 07:47 PM in Default

avatar image

GPO
4.8k 40 49 56

Sounds like you mess with BMC product called Remedy maybe. They created all their views with Letter+NumberSequence

Jun 28, 2011 at 07:50 PM Shawn_Melton

@meltondba hateful, hateful POS. shudder

Jun 29, 2011 at 12:45 AM ThomasRushton ♦♦

Any database that is made for Health professionals or in any way with the involvement of Health professionals will suffer maladies like these. ("Oh but we're different. Anything you've ever learnt about database design you can forget. Those rules don't apply in our world.") I don't know "Remedy" but maybe the name gives something away?

Jun 29, 2011 at 01:09 AM GPO
  • for coming on here and venting your frustration rather than at a client. Is the SQLTherapy domain taken I wonder?

Jun 29, 2011 at 02:43 AM Fatherjack ♦♦

Remedy has nothing to do with health. It's a piece of support / helpdesk type software, that does incident / problem / change management things. Hateful.

Jun 29, 2011 at 05:34 AM ThomasRushton ♦♦
(comments are locked)
10|1200 characters needed characters left

4 answers: sort voted first

Your examples are about as bad as what I encounter. A previous DBA at my company used the alphabet. Everything started with A and worked its way up. I mean really, do I need a legend to have to reference which table is C and which is E, etc. I agree with you. Table aliases need to be meaningful just like table names, indexes, etc. You are not alone.

more ▼

answered Jun 28, 2011 at 07:50 PM

avatar image

Tim
40.4k 39 84 166

49 seconds. thought that PASS steak dinner would slow you down some :)

Jun 28, 2011 at 07:51 PM KenJ

Now if it was turkey maybe, but a 16 ounce filet perfectly cooked. YUM.

Jun 28, 2011 at 07:54 PM Tim
(comments are locked)
10|1200 characters needed characters left

With all due respect, I'd lean towards getting some real problems. Life is too short to get all wrapped up in these kinds of details.

As you come to these crazy aliases, just leave the code cleaner than you found it and move on, knowing you've done the right thing for yourself and your profession

more ▼

answered Jun 28, 2011 at 07:51 PM

avatar image

KenJ
24.5k 3 10 19

(comments are locked)
10|1200 characters needed characters left

Get your team an editor that auto generates aliases for tables. I know mine does it (press TAB after any identifier) and I'm pretty sure SQL Prompt does it.

That makes it a little bit better.

Then, when you've done that, get your team an editor that allows alias name refactoring.

more ▼

answered Jun 29, 2011 at 12:04 AM

avatar image

Matt Whitfield ♦♦
29.5k 62 66 88

yeah Prompt does it but be careful, it uses Camel Cased letters to generate aliases so you end up with some distasteful ones - only last week one alias I got was JLS. You can fix your own in Prompt too so a certain table always gets a defined alias.

Jun 29, 2011 at 02:42 AM Fatherjack ♦♦

@Fatherjack Explain it to the poor stupid American, why is JLS bad?

Jun 29, 2011 at 04:50 AM Grant Fritchey ♦♦

Ha Ha. @fatherjack, I can see your point about JLS.

Jun 29, 2011 at 05:17 AM Tim
(comments are locked)
10|1200 characters needed characters left

I had to deal with a "logical" modeling team that insisted on the stupidest standardized abbreviations you've ever seen, but my favorite was the abbreviation for "Deductible." It was turned into "ddltbl."

Maybe it's just me, but should an abbreviation ADD letters? Where did the second "L" come from?

Oh, and best of all, we were required to use this, regardless of the fact that it was screwed up. So you can go to company X today and see "ddltbl" all over the place.

In short, I feel your pain.

more ▼

answered Jun 29, 2011 at 04:49 AM

avatar image

Grant Fritchey ♦♦
137k 20 43 81

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1066
x31
x3

asked: Jun 28, 2011 at 07:47 PM

Seen: 2196 times

Last Updated: Jun 28, 2011 at 07:47 PM

Copyright 2016 Redgate Software. Privacy Policy