| |
SQL Where Clause
|
| Tips>>SQL |
|
WHERE clause is used to collect the records from the
table based on some condition specified by the where clause.
The WHERE clause allows you to filter the results from
an SQL statement - select, insert, update, or delete
statement. To conditionally select data from a table, a WHERE
clause can be added to the SELECT statement.
The Syntax OF SQL WHERE Clause is :-
| SELECT column FROM table WHERE column operator value |
With the WHERE clause, the following operators can
be used :-
|
Operator
|
Description
|
|
=
|
Equal
|
|
<>
|
Not Equal
|
|
>
|
Greater than
|
|
<
|
Less than
|
|
>=
|
Greater Than or Equal
|
|
<=
|
Less Than or Equal
|
|
BETWEEN
|
Between an exclusive range
|
|
LIKE
|
Search for a pattern
|
Example#I :-
Here is the table
|
SR. No
|
NAME |
GRADE
|
PERCENTAGE
|
|
1
|
Deepali Bhayani |
A
|
80.89%
|
|
2
|
Nirav Thakkar |
B
|
64.90%
|
|
3
|
Nilesh Kanani |
A
|
78.00%
|
|
4
|
Bhumika Ghelani |
C
|
45.34%
|
|
5
|
Dhvani Karia |
A
|
74.78%
|
|
6
|
Anish Ruparalia |
B
|
62.90%
|
The SQL Command :-
| SELECT * from student where Grade ="A" |
RESULT:-
|
SR. NO
|
NAME |
GRADE
|
PERCENTAGE
|
|
1
|
Deepali Bhayani |
A
|
80.89%
|
|
2
|
Nilesh Kanani |
A
|
78.00%
|
|
3
|
Dhvani Karia |
A
|
74.78%
|
If you don't find what you are looking for. Please click
here to submit your query, our experts will reply soon.
|
|
|
|
SQL WHERE CLAUSE
|
|
WHERE clause is used to collect the records from the table
based on some condition specified by the where clause. The WHERE
clause allows you to filter the results from an SQL statement
- select, insert, update, or delete statement. To conditionally
select data from a table, a WHERE clause can be added to the SELECT
statement.
The Syntax OF SQL WHERE Clause is :-
| SELECT column FROM table WHERE column operator value |
With the WHERE clause, the following operators can be used
:-
|
Operator
|
Description
|
|
=
|
Equal
|
|
<>
|
Not Equal
|
|
>
|
Greater than
|
|
<
|
Less than
|
|
>=
|
Greater Than or Equal
|
|
<=
|
Less Than or Equal
|
|
BETWEEN
|
Between an exclusive range
|
|
LIKE
|
Search for a pattern
|
Example#I :-
Here is the table
|
SR. No
|
NAME |
GRADE
|
PERCENTAGE
|
|
1
|
Deepali Bhayani |
A
|
80.89%
|
|
2
|
Nirav Thakkar |
B
|
64.90%
|
|
3
|
Nilesh Kanani |
A
|
78.00%
|
|
4
|
Bhumika Ghelani |
C
|
45.34%
|
|
5
|
Dhvani Karia |
A
|
74.78%
|
|
6
|
Anish Ruparalia |
B
|
62.90%
|
The SQL Command :-
| SELECT * from student where Grade ="A" |
RESULT:-
|
SR. NO
|
NAME |
GRADE
|
PERCENTAGE
|
|
1
|
Deepali Bhayani |
A
|
80.89%
|
|
2
|
Nilesh Kanani |
A
|
78.00%
|
|
3
|
Dhvani Karia |
A
|
74.78%
|
If you don't find what you are looking for. Please click
here to submit your query, our experts will reply soon.
|
|
| |
E-mail : sales at virtualsplat dot com
Phone : +91 022 28067978