IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is difference bw thease SQL Queries?


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
willsdonaldabc

New User


Joined: 05 Oct 2010
Posts: 10
Location: chennai

PostPosted: Tue Sep 13, 2011 8:44 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Sep 13, 2011 9:14 pm
Reply with quote

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
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Sep 14, 2011 11:26 am
Reply with quote

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
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Sep 14, 2011 11:51 am
Reply with quote

In general "group by" gives better performance.
Back to top
View user's profile Send private message
willsdonaldabc

New User


Joined: 05 Oct 2010
Posts: 10
Location: chennai

PostPosted: Sat Sep 17, 2011 12:39 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Sep 17, 2011 1:16 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Difference between CEE3250C and CEE3204S COBOL Programming 2
Search our Forums:

Back to Top