January 9, 2013 at 7:16 am
Koen Verbeeck (1/8/2013)
Not sure what this question tries to teach us....
I guess.. this; if the aliases are been removed in SELECT block, it gives below error on ambiguity for couple of column names. (some sort.... author might had in mind)
Msg 209, Level 16, State 1, Line 3
Ambiguous column name 'Name2'.
Msg 209, Level 16, State 1, Line 4
Ambiguous column name 'Name3'.
(looks like this was one of the "out of the box" experience π )
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
January 9, 2013 at 7:40 am
Koen Verbeeck (1/8/2013)
Not sure what this question tries to teach us.I spend 5 minutes looking for a mistake, only to finally decide there wasn't one, all joins seemed legit. I got it right, but I suddenly was surprised the question was about table aliases.
I'm with Koen on this one. I spent a few minutes (I think more than 5) analyzing the queries and looking for that "gotcha" that sticks out once you find it, but no such luck on that.
January 9, 2013 at 7:49 am
I concur with many here. It were somewhat of a disappointment to end up with some alias-stuff after spending quite some time looking for the column not being aggregated, or, as I thought first, some union with disparaging column definitions or some such. But no, just straight aliasing.
I am quite used to aliasing a lot of tables, and also making sure to get the right columns from the right tables when the names clashes, sΓ₯ the alias stuff were the last thing on my mind.
But thank you for the question anyway. A good friday question, even on a wednesday π
/Keld
January 9, 2013 at 7:55 am
Koen Verbeeck (1/8/2013)
Not sure what this question tries to teach us.I spend 5 minutes looking for a mistake, only to finally decide there wasn't one, all joins seemed legit. I got it right, but I suddenly was surprised the question was about table aliases.
Same here... and since we went to wide short monitors I had to keep scrolling up and down to make sure I could keep the entire schema in my head.
Koen Verbeeck (1/8/2013)
Maybe I was more surprised that apparently the criteria for a query to run succesfully is to get your table aliases correct π
Among other things π
January 9, 2013 at 8:02 am
Thanks for an easy question.
However, I noticed then if the QotD offers choice 'this will run' and 'this will not run', in most cases the answer is 'it will', so the question is reduced to 'is there an egregious problem?'. Which takes a good deal of fun out of figuring out the correct answer.
January 9, 2013 at 8:28 am
Thanks for all comments. we use aliases in joins. Aliases are not for columns where there is only one column possible. But it is nice to have all aliases listed just for maintainability in joins.
--------------------------------------
;-)βEverything has beauty, but not everyone sees it.β β Confucius
January 9, 2013 at 8:59 am
sqlnaive (1/9/2013)
Dineshbabu (1/8/2013)
Andre Ranieri (1/8/2013)
Nice question - I wonder if the question category should have been table aliases instead of joins πThanks,
Andre Ranieri
+1
I agree with both Andre and Dineshbabu. Was looking for any issues in the joins for couple of minutes but found no issues.
+1
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 9, 2013 at 9:46 am
chgn01 (1/9/2013)
Aliases are not for columns where there is only one column possible.
Whyever not?
January 9, 2013 at 9:46 am
chgn01 (1/9/2013)
Thanks for all comments. we use aliases in joins. Aliases are not for columns where there is only one column possible. But it is nice to have all aliases listed just for maintainability in joins.
For my learning... how does using aliases affect maintainability?
Thanks,
Tom
January 9, 2013 at 9:50 am
Nice, had to think about it far a few minutes but got it.
Thanks
Not all gray hairs are Dinosaurs!
January 9, 2013 at 10:20 am
Revenant (1/9/2013)
Thanks for an easy question.However, I noticed then if the QotD offers choice 'this will run' and 'this will not run', in most cases the answer is 'it will', so the question is reduced to 'is there an egregious problem?'. Which takes a good deal of fun out of figuring out the correct answer.
Agreed.
Rob Schripsema
Propack, Inc.
January 9, 2013 at 1:10 pm
Good question, got it! Thanks
_______________________________________________________________
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." β Bill Gates
January 9, 2013 at 2:01 pm
Thanks for the easy question. Glad I didn't second guess myself.
January 9, 2013 at 6:45 pm
Easy one.. but good question..
Thanks..
January 9, 2013 at 11:41 pm
+1
Viewing 15 posts - 16 through 30 (of 33 total)
You must be logged in to reply to this topic. Login to reply