Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Question of the month September 2011 - Find out problamatic query

Sep 14 2011 1:45AM by Madhivanan   

Out of these four queries, only one query will throw an error. Without running these queries find out the query and error message that it would generate.

Queries

Query 1 : select top 1 1 from sysobjects,syscolumns where 1=1
Query 2 : select top 1 1 from syscolumns,syscolumns where 1=1
Query 3 : select top 1 1 from sysobjects inner join syscolumns on 1=1
Query 4 : select top 1 1 from sysobjects cross join syscolumns where 1=1

Tags: t-sql, sql_server, sqlserver, tsql, #SQLServer, question,


Madhivanan
3 · 40% · 12936
6
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

9  Comments  

  • Query 2 : select top 1 1 from syscolumns,syscolumns where 1=1

    commented on Sep 14 2011 2:10AM
    Paresh Prajapati
    6 · 23% · 7464
  • QUERY 2 : Error ambigus col name

    commented on Sep 14 2011 6:05AM
    Dipenshah
    2220 · 0% · 6
  • Query 2 : select top 1 1 from syscolumns,syscolumns where 1=1

    commented on Sep 14 2011 6:15AM
    Ritesh
    1251 · 0% · 20
  • Query 2 : select top 1 1 from syscolumns,syscolumns where 1=1 Ambiguous col. name?

    commented on Sep 14 2011 6:19AM
    Dipenshah
    2220 · 0% · 6
  • Query 2 : select top 1 1 from syscolumns,syscolumns where 1=1

    commented on Sep 14 2011 7:43AM
    mrajesh
    660 · 0% · 51
  • Nice question.

    Answer is query 2. Same table name used two times so need to use alias in one of the table name.

    commented on Sep 15 2011 11:37PM
    Hardik Doshi
    20 · 9% · 2864
  • The correct answer is that query #2 will produce an Ambiguous column name error. The reason is simple - the column #1 for both queries would have the same name and come from the same table, resulting in SQL Server to be confused on what it should pick.

    The good thing about trying to answer questions without executing the queries in them is that it forces you to think about what's going on under the hood. So, keep them coming!

    commented on Sep 18 2011 4:59AM
    Nakul Vachhrajani
    4 · 36% · 11645
  • Option 2

    commented on Oct 12 2011 4:02AM
    krishnavamshi24
    534 · 0% · 70
  • Query 2 throws error.If we need to use a table more than once in a query, need to use alias name.

    commented on Oct 18 2011 5:50AM
    Sineetha
    106 · 2% · 492

Your Comment


Sign Up or Login to post a comment.

"Question of the month September 2011 - Find out problamatic query" rated 5 out of 5 by 6 readers
Question of the month September 2011 - Find out problamatic query , 5.0 out of 5 based on 6 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]