Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How does SELECT statement works with operators

Author  Topic 

nonkimono
Starting Member

1 Post

Posted - 2011-09-30 : 04:05:05
Person Table
ID Name Sex
-----------------------
1 Ricky Male
2 Steve Male
3 Anne Female
4 Tom Male
5 Cathy Female
6 Cindy Female

Hi All,
We already know that if you use this select statement:

SELECT * FROM Person WHERE Sex = 'Female'

The result will be:

ID Name Sex
-------------------
3 Anne Female
5 Cathy Female
6 Cindy Female

And if we use this select statement:

SELECT * FROM Person WHERE Sex <> 'Male'

The result will be same:

ID Name Sex
-------------------
3 Anne Female
5 Cathy Female
6 Cindy Female

Now, here's my question... how does SQL search/scan the table based on the operator used. i want to know the step-by-step process of this.

Thanks.

Ranjit.ileni
Posting Yak Master

183 Posts

Posted - 2011-09-30 : 04:13:33
Please refer

http://tsql.solidq.com/books/insidetsql2008/Logical%20Query%20Processing%20Poster.pdf

for logical query processing

--Ranjit
Go to Top of Page

jassi.singh
Posting Yak Master

122 Posts

Posted - 2011-09-30 : 04:25:30
You can view execution plan in sql server management studio
Refer:http://www.simple-talk.com/sql/performance/execution-plan-basics/


Please mark answer as accepted if it helped you.

Thanks,
Jassi Singh
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-09-30 : 06:01:41
"Please mark answer as accepted if it helped you."

Please stop asking people to do that. There is no facility for that on this forum, and that's not the way that this forum operates.
Go to Top of Page

Cindyaz
Yak Posting Veteran

73 Posts

Posted - 2011-09-30 : 11:35:52
[url]http://sqlinthewild.co.za/index.php/2009/01/19/index-columns-selectivity-and-equality-predicates/[/url]
This article by Gail Shaw nicely explains how sql server does searching.

Go to Top of Page
   

- Advertisement -