March 2, 2010 at 8:54 pm
Comments posted to this topic are about the item How many rows are returned from the query below?
Thanks,
Ashka Modi
Software Engineer || credEcard Technologies (india) Pvt. Ltd.
March 2, 2010 at 10:03 pm
I got an error when I tried in SQL Server 2005...!!!
March 2, 2010 at 10:48 pm
That query gives perfect result.
Thanks.
Mandar Kavishwar.
EC Infosolution
March 3, 2010 at 12:07 am
Seems to be a lot missing assumptions. Each given answer can be correct given different starting conditions.
Running the code as-is got me an error first (tblUsers does not exist. doh!).
I then created the table and got 0 rows as the result.
I added 1 row and got 1 row as the result.
Added another row and got 2 rows as the result.
Adding more rows kept the result at 2 rows.
March 3, 2010 at 1:02 am
WTF is tblUsers?
It can be a table or a view or nothing.
If it is anything defined (table or view) it can be empty (0 rows returned), it can contain just 1 row (1 row returned) or it can contain more rows (2 rows returned).
With these assumptions - three answers possible - tblUsers is undefined and the script returns an error message. QED
March 3, 2010 at 1:29 am
i fail to understand what is the learning in this question. anybody plz. suggest...
March 3, 2010 at 1:32 am
if the query contains a top 3
SELECT top 3 c.*, Users.* FROM reptec_changedim c, Users
then this will return 3 records...
March 3, 2010 at 2:21 am
I get an error saying tblUsers doesn't exist.. Is this a Version issue or missing information? im on SQL 2005
March 3, 2010 at 2:26 am
Aam-624390 (3/3/2010)
Seems to be a lot missing assumptions. Each given answer can be correct given different starting conditions.
Agreed, question is incomplete and I fail to see the point of it.
March 3, 2010 at 2:27 am
ziangij (3/3/2010)
i fail to understand what is the learning in this question. anybody plz. suggest...
No idea!!!! :w00t:
March 3, 2010 at 2:30 am
Aam-624390 (3/3/2010)
Seems to be a lot missing assumptions.
Well it seems a reasonable assumption that tblUsers exists, and is a table.
You then have to guess about data volumes - I thought that since a system generally has more than one user it was reasonable to assume that there were at least 2 rows.
Having made those assumptions then there could only be one answer - but I'm not sure what the question was meant to demonstrate? Did those who got it wrong just make different assumptions?
March 3, 2010 at 2:34 am
I think this was about cross join?
I use these kind of statements to generate the possible valid sales of products against a table of customers. The generated table/view becomes the 'pigeonhole' to hold incoming, actual sales.
March 3, 2010 at 2:42 am
Toreador (3/3/2010)
Aam-624390 (3/3/2010)
Seems to be a lot missing assumptions.Well it seems a reasonable assumption that tblUsers exists, and is a table.
You then have to guess about data volumes - I thought that since a system generally has more than one user it was reasonable to assume that there were at least 2 rows.
Having made those assumptions then there could only be one answer - but I'm not sure what the question was meant to demonstrate? Did those who got it wrong just make different assumptions?
Assumptions above are reasonable but not absolute. "tblAnything" can be a view. System may have many users but under some conditions the table will be empty.
Author is not able to fix conditions by using either temporary table or some system table (view).
I think that nobody will argument that there is no sysdatabases and it can be empty. Maybe some Oracle or HisSQL user 😛
March 3, 2010 at 2:52 am
A poorly conceived question. I'm not entirely sure of the authors intention.
March 3, 2010 at 3:13 am
I agree with the posters that claim that the question had more then 1 answer that could be correct. I guessed the answer because I assumed that the table exists and that it has more then 1 record. The fact that we need to make any assumptions means that the question should be re written. Especially when all the given answers could be correct with different assumptions.
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Viewing 15 posts - 1 through 15 (of 110 total)
You must be logged in to reply to this topic. Login to reply