View previous topic :: View next topic
|
Author |
Message |
willsdonaldabc
New User
Joined: 05 Oct 2010 Posts: 10 Location: chennai
|
|
|
|
Query:
Emp table:
column:eno
Data:1,1,1,2,2,2,3,3,3
i)SELECT distinct(eno) FROM emp
ii)SELECT eno FROM emp GROUYP BY eno
Both the queries are giving same output.then what is diff , advantages and disadvantages
similarly which is the best in performance wise
IN and NOT IN |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
willsdonaldabc wrote: |
Query:
Emp table:
column:eno
Data:1,1,1,2,2,2,3,3,3
i)SELECT distinct(eno) FROM emp
ii)SELECT eno FROM emp GROUYP BY eno
Both the queries are giving same output.then what is diff , advantages and disadvantages |
And what answer, beyond a deer-in-the-headlights stare, did you offer?
Quote: |
similarly which is the best in performance wise
IN and NOT IN |
Ditto. |
|
Back to top |
|
|
cvishu
Active User
Joined: 31 Jul 2007 Posts: 136 Location: india
|
|
|
|
Quote:
similarly which is the best in performance wise
IN and NOT IN
As far as i know IN gives better performance. Negative conditions almost always degrade performance , because u have too many possibilities to check when you negate. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
In general "group by" gives better performance. |
|
Back to top |
|
|
willsdonaldabc
New User
Joined: 05 Oct 2010 Posts: 10 Location: chennai
|
|
|
|
the output for the both queries is going to be 1,2,3
Please could any in explain me ?which one should i use when and why? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
this is the second rather nebulous all-encompassing question that you have posed.
This is similar to the question about queues and cics and CALLs from batch.
we generally like to answer specific questions which require knowledge of fundamentals and their interaction.
we are not here to help you carry-on a high level theoretical discussion.
especially when you obviously have not carried out the prerequisite exploration of fundamentals.
in the case of this question, GuyC already gave you the answer. |
|
Back to top |
|
|
|