New Message on dotNET User Group Hyd

Question Of The Day !!!! -- (14-12-2005)

Reply
  Reply to Sender   Recommend Message 4 in Discussion
From: SivaDude

Hi,
 
Basically "IN" clause helps us to determine if a given value matches any value in a subquery or a list.For example
 
a. In a list of values
SELECT au_lname, state
FROM authors
WHERE state IN ('CA', 'IN', 'MD')
 
b. in subquery returning a list of values
SELECT au_lname, au_fname
FROM authors
WHERE au_id IN
   (SELECT au_id
   FROM titleauthor )

Whereas "JOIN" clause/Condition helps to get the required resultset from two different tables with the help of a matching criteria. For example
 
The same above query in point b, can be re-written using JOIN, like
Finding all the authors who are associated with a title.
SELECT au_lname, au_fname
FROM authors a
INNER JOIN titleauthor t
ON a.au_id=t.au_id
 
When querying/using bigger tables it is always suggestible to use JOIN than IN with Subquery for better performance. And also JOIN has other benefits;Joins can be specified in either the FROM or WHERE clauses. The join conditions combine with the WHERE and HAVING search conditions to control the rows that are selected from the base tables referenced in the FROM clause
 
Hope this will be of some help.
Regards,
Siva

View other groups in this category.

Click Here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to