Apr 9, 2011

Sqlserver how to use WHERE key word

The WHERE clause is used to extract only those records that fulfill a specified criterion.

Syntax :

SELECT column_name(s)
FROM table_name
WHERE column_name operator value

Example :

SELECT aircraft_code from flight_detials
WHERE fair >5000
NOTE :- SQL uses single quotes around text values.
Although, numeric values should not be enclosed in quotes.

Operators Allowed in the WHERE Clause

With the WHERE clause, the following operators can be used:
OperatorDescription
=Equal
<>Not equal
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
BETWEENBetween an inclusive range
LIKESearch for a pattern
INIf you know the exact value you want to return for at least one of the columns
Note: In some versions of SQL the <> operator may be written as !=

No comments:

Post a Comment