SELECT (Transact-SQL)

  • Comments posted to this topic are about the item SELECT (Transact-SQL)

  • Here we go back to the basics once again ....

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • It was necessary to practice the basics to get where he is today!

  • Nice clean question.

    But maybe a little too easy. If one assumes that T-SQL has the sort of consistent syntax that most programming languages have, then only the second and fourth options are possible answers (since if either of the otherw was wrong then so would at leat one more be wrong, and the radio buttons allow for only one); so the only question is whether the "as" keyword can be omitted or whether "a as b" and "b as a" mean the same thing - but letting those mean the same thing would mean one couldn't cope with renaming a column with another solumn's name, whic would be rather odd, so the principle of minimising oddity (which in my experience applies to all languages except C++) tells us the answer straight away.

    Tom

  • Thanks for the question.

    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

  • Easy question..thanks:)

  • An easy one for Friday 🙂

    Apparantly, I noticed that there were 4 select statements in the question and 5 select statements as the answer choice 😀

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Easy question.Thanks

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

  • One question, I am confused on this...

    select ID, name name from person

    select ID ID, name name from person

    Both these statements dont give any error message and run successfully...

    wht is it so?

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • I found the glitch ..

    nice question...

    thanks

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

  • An easy one to close the week, thanks!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • kapil_kk (10/25/2012)


    One question, I am confused on this...

    select ID, name name from person

    select ID ID, name name from person

    Both these statements dont give any error message and run successfully...

    wht is it so?

    Think both statements as the following:

    select ID, name [AS] name from person;

    select ID [AS] ID, name [AS] name from person

    The AS keyword is optional when used for aliases in the SELECT statement.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • kapil_kk (10/25/2012)


    One question, I am confused on this...

    select ID, name name from person

    select ID ID, name name from person

    Both these statements dont give any error message and run successfully...

    wht is it so?

    'coz they are syntactically correct. They follow the belew rule

    SELECT <column_name> [optional "AS" keyword] [optional <alias_name>]

    FROM <table_name>

    Alias_name can be same as that of column_name. Hope it is clear now

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Thanks Koen and Lokesh 🙂

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • demonfox (10/25/2012)


    I found the glitch ..

    nice question...

    thanks

    A trick to catch the glitch.

    1) Use SSMS, go to "Query" and select "IntelliSense Enabled"

    2) Copy paste the code

    3) the syntax error in the query (with error) will be highlighted with zig-zag red line 🙂

    Check the attached image.

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

Viewing 15 posts - 1 through 15 (of 33 total)

You must be logged in to reply to this topic. Login to reply