|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 2:11 AM
Points: 9,378,
Visits: 6,473
|
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Tuesday, January 01, 2013 11:12 PM
Points: 248,
Visits: 372
|
|
Really interesting and good question.
KSB ----------------------------- Thousands of candles can be lit from a single candle, and the life of the candle will not be shortened. Knowledge and happiness never decreases by being shared.” - Buddha
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Today @ 4:14 AM
Points: 1,852,
Visits: 988
|
|
Really its a good question about square brackets.we can use square brackets efficiently at any time.
Malleswarareddy I.T.Analyst MCITP(70-451)
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 3:35 AM
Points: 969,
Visits: 650
|
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Thursday, December 27, 2012 2:08 PM
Points: 428,
Visits: 625
|
|
saranya.megalai (5/14/2010) if flag is alias then can we use next statement like
select [flag='y'].some_data from [where]?
Yes it would look like:
Select [flag ='y' ].some_data from [where] [flag ='y' ]
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, December 16, 2011 1:25 AM
Points: 10,
Visits: 174
|
|
Creative statement good for braintraining but with a high theoretical fineness. Not any SQL developer with some common sense would name a table [where] nor would invent the alias [flag ='y' ]
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, May 03, 2013 7:37 AM
Points: 128,
Visits: 279
|
|
There is nothing special about flag='y'... it's text. It could be anything He's just aliasing the table.
The point is that by using square brackets you can alias something to even something crazy that looks like an expression.
--These are all the same...
Select * from [where] [flag ='y' ]
Select * from [where] [Beer]
Select [flag ='y' ].* from [where] [flag ='y' ]
Select [Beer].* from [where] [Beer]
Select table1.some_data from [where] table1
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 1:10 PM
Points: 2,673,
Visits: 2,418
|
|
| When I actually realized that [flag ='y' ] was an alias....I actually laughed. This is a situation so unlikely that it is humorous, but it teaches a good lesson. Great question for a Friday. Thanks.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 11:42 AM
Points: 1,058,
Visits: 2,575
|
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 3:57 PM
Points: 2,550,
Visits: 17,372
|
|
I love it! This ranks right up there with the Middle Join QOD, which is one of my all time favorites. I think someone actually tried to write a SQL Statement once that read as a poem using carefully named tables and a ton of table and column aliases, but I don't remember where I saw that now.
This is great, nicely done Roshan! Chad
|
|
|
|