WizIQ helps you learn and teach online - any subject you can think of!
Join for FREE

Sql Server 2005-Simple Where Clause

Add to Favourites
Post to:

Description
Basic datatypes in Sql Server 2005 and Simple Select Statements

Comments
Presentation Transcript Presentation Transcript

TSQL-Part2 : TSQL-Part2 Filtering data from Sql Server 2005 using simple 'Where Clause' By Nitin Sharma

The 'Where Clause' : The 'Where Clause' SELECT Statement, Selects Records from table(s). 'Where Clause' is used to filter data being retrieved by a Select Statement. 'Where Clause' uses 'predicates' or 'conditions' to restrict data being retrieved. Predicates use Relational, Boolean and Special Operators to define a condition. Ex: Select * from customers where city='London'

The 'Where Clause' (Cont..)‏ : The 'Where Clause' (Cont..)‏

The 'Where Clause' (Cont..)‏ : The 'Where Clause' (Cont..)‏ Note that string field values in a 'Where Clause' are written inside single quotes for example 'London'. By default in SQL Server the where clauses are case-insensitive when it comes to searching data so City='London' and City='LONDON' will yield the same results. Where clause uses relation operators =,>,<,>=,<=,<> in the predicates.

The 'Where Clause' (Cont..)‏ : The 'Where Clause' (Cont..)‏

The 'Where Clause' (Cont..)‏ : The 'Where Clause' (Cont..)‏ You may also combine predicates in a 'Where Clause' by Boolean operators (AND, OR and NOT). Ex: Select * from products where unitprice>10 and unitprice<20 'NOT' is a special boolean operator which negates a condition for example Select * from products where NOT unitprice>10

The 'Where Clause' (Cont..)‏ : The 'Where Clause' (Cont..)‏ Note: You can add comments in a TSQL window by enclosing between /* and */ characters. This way the comments can span multiple lines.

The 'Where Clause' (Cont..)‏ : The 'Where Clause' (Cont..)‏ Note: You can add single line comments in a TSQL window by starting them with -- characters.

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no.:


Area code Number
Subject you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
1 Follower

Your Facebook Friends on WizIQ

Explore Similar Courses