Subscribe:

Tuesday, September 27, 2011

Where

Where
You can restrict the rows returned from a query by using a where clause in SQL statement By inserting a WHERE clause into a SQL statement, you can specify a condition that must be met, and only the rows the condition are returned. This is also known as a selection.The where clause directly follows the FROM clause in SQL statement syntax. The WHERE clause consists of the WHERE keyword and condition or conditions.

Check the below example.

Select empno,ename,deptno
From emp
Where deptno=30;
- Content of a condition
1- a column name like depton in above example. That specifies the column that you want to restrict.
2- Comparison operator like = in above example .that specifies which rows are to be returned.
3- Constant like 30 in above example .that specifies which rows are to be restricted.
When you run the above query you will get the results for only department 30









No comments:

Post a Comment