December 11, 2009 at 7:44 pm
select 10 from emp;
Is it correct query?
If it is correct what will be the result of this query .............
specify reason also
December 11, 2009 at 8:22 pm
If emp is a table you will get exactly what you asked for, 10 for as many rows as are in emp.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 12, 2009 at 2:39 pm
care.shiv (12/11/2009)
select 10 from emp;Is it correct query?
If it is correct what will be the result of this query .............
specify reason also
Why don't you just try it instead of asking us a test/homework/interview question? 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
December 12, 2009 at 2:59 pm
If this is homework/exam/interview question, it's not our intent to do the work for you. As mentioned by Jeff, you should try it. If you can't try it, then perhaps you should not be asking us.
If you don't understand the results, then show us that you've tried it, what you think, and ask for an explanation. We are more than happy to help, but we do not want to do work for you.
December 13, 2009 at 4:06 pm
hi
select 10 from emp
I was tried this query and i got following result, So my question is what is logic behind this answer
10
---
10
10
10
10
10
10
10
10
10
10
10
10
December 13, 2009 at 4:17 pm
the logic is
SELECT xxx
from EMP
will return a row for every row in the EMP table. If xxx is a column, it returns the values from that column. In your case, you have listed a scalar value, so it is returned. Once for each row in emp.
December 13, 2009 at 5:26 pm
No way to explain it better than that, Steve.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply