SELECT (Transact-SQL)

  • JoseACJr

    SSC Eights!

    Points: 932

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

  • Ron McCullough

    SSC Guru

    Points: 63877

    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]

  • JoseACJr

    SSC Eights!

    Points: 932

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

  • TomThomson

    SSC Guru

    Points: 104707

    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

  • SQLRNNR

    SSC Guru

    Points: 281106

    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

  • kalyani.k478

    Default port

    Points: 1400

    Easy question..thanks:)

  • Lokesh Vij

    SSChampion

    Points: 10835

    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

  • malleswarareddy_m

    SSCertifiable

    Points: 5847

    Easy question.Thanks

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

  • kapil_kk

    SSC-Insane

    Points: 21316

    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/

  • demonfox

    SSCertifiable

    Points: 6289

    I found the glitch ..

    nice question...

    thanks

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

  • Koen Verbeeck

    SSC Guru

    Points: 258854

    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

  • Koen Verbeeck

    SSC Guru

    Points: 258854

    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

  • Lokesh Vij

    SSChampion

    Points: 10835

    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

  • kapil_kk

    SSC-Insane

    Points: 21316

    Thanks Koen and Lokesh 🙂

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

  • Lokesh Vij

    SSChampion

    Points: 10835

    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 34 total)

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