Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What is difference bw thease SQL Queries?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: What is difference bw thease SQL Queries?
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: 1753
Location: Bloomington, IL

PostPosted: Tue Sep 13, 2011 9:14 pm    Post subject: Re: What is difference bw thease SQL Queries?
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    Post subject:
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: 1280
Location: Belgium

PostPosted: Wed Sep 14, 2011 11:51 am    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need help with below queries ashek15 DB2 3 Thu Mar 23, 2017 1:38 am
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts Difference Between CICS WebSupport an... sachinji84 CICS 1 Mon Mar 07, 2016 7:25 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us