Wednesday 29 May 2013

WHERE Clause


  • Restrict the rows returned by using the WHERE Clause.
Syntax:

    SELECT *|{[DISTINCT] column|expression [alias],...}
   FROM table
   [WHERE condition(s)];

  • The WHERE clause follows the FROM clause.
WHERE     Restricts the query to rows that meet a condition.
conditions   is composed of column names, expressions, constants and a comparison operator.

Using the WHERE Clause


In the example, the SELECT statement retrieves the employee name, name, job and department number of all employees whose department number is 10.

Another Example:


In the above example the SELECT statement retrieves data according to string conditions and string data is enclosed with single quotes.

NOTE:
  • Character strings and data values are enclosed in single quotation marks.
  • Character values are case sensitives and date values are Format Sensitives.
  • The default date format is DD-MON-RR.





No comments:

Post a Comment