Monday, February 18, 2013

The SELECT Statement


Select statement retrieves data from database. The set of data retrieved via select statement is referred to as result set.
Syntax:
Select <one or more Column names>
From <One or more table names>
Where <one or more condition apply>
The result sets generated by queries contains columns from one or more tables. While most elements in SELECT clauses will typically be simple column references, a SELECT clause may also include:

  • Literal Values, such as numbers (1) or strings (‘abc’)
  • Expressions, such as length * 3.14
  • Functions, such as TO_DATE(’01-Jan-2013’,’DD-MON-YYYY)
  • Pseudo columns, such as ROWID, ROWNUM or LEVEL
     For example
SELECT 1 num, 'abc' str
FROM customer;

No comments:

Post a Comment