Professional Documents
Culture Documents
1 Current 4/1/2001 7
1 Saving 8/1/2001 2
2 Current 8/1/2001 3
3 Saving 8/11/2001 4
4 Current 11/18/2001 5
6 Saving 1/1/2001 6
7 Current 5/1/2002 9
7 Saving 6/1/2002 8
Table: Transaction
Account ID Transaction DOT Amount
Type
2 D 1/1/2001 Rs. 2,000.00
2 D 1/5/2001 Rs. 5,000.00
2 W 1/5/2002 Rs. 1,100.00
3 D 1/5/2001 Rs. 2,000.00
3 W 4/5/2002 Rs. 1,300.00
3 D 5/5/2002 Rs. 5,000.00
4 W 6/6/2002 Rs. 1,600.00
4 D 1/1/2002 Rs. 3,000.00
4 W 5/1/2002 Rs. 1,000.00
SELECT Statement
Retrieves rows from the database and allows
the selection of one or many rows or
columns from one or many tables. The full
syntax of the SELECT statement is complex,
but the main clauses can be summarized as:
SELECT select_list
FROM table_source
[ WHERE search_condition ]
[ GROUP BY group_by_expression ]
[ HAVING search_condition ]
[ ORDER BY order_expression [ ASC | DESC ] ]
SELECT Clause
Syntax:
SELECT [ ALL | DISTINCT ] < select_list >
< select_list > ::=
{*| { table_name | view_name | table_alias }.*
| { column_name | expression | ROWNUM }
[ [ AS ] column_alias ] } [ ,...n ]
FROM Clause
Specifies the table(s) from which to
retrieve rows.
Syntax
FROM { < table_source > } [ ,...n ]
Syntax
match_expression [ NOT ] LIKE pattern
[ ESCAPE escape_character ]
ESCAPE 'escape_character'
Allows a wildcard character to be searched
for in a character string instead of
functioning as a wildcard.
escape_character is the character that is
placed in front of the wildcard character to
denote this special use.
BETWEEN Operator
Syntax
test_expression [ NOT ]
BETWEEN begin_expression
AND end_expression
IN Operator
Determines if a given value matches
any value in a subquery or a list.
Syntax
test_expression [ NOT ] IN
(subquery | expression [ ,...n ])
ALL Operator
Compares a scalar value with a single
column set of values.
Syntax
scalar_expression
{ = | <> | != | > | >= | !> | < | <= |
!< } ALL ( subquery )
SOME | ANY Operator
Compares a scalar value with a single
column set of values.
Syntax
scalar_expression { = | < > | ! = |
>|>=|!>|<|<=|!<}
{ SOME | ANY } ( subquery )
EXISTS Operator
Syntax
EXISTS subquery
GROUP BY Clause
[ GROUP BY [ ALL ]
group_by_expression [ ,...n ]
HAVING Clause
Specifies a search condition for a group or
an aggregate. HAVING is usually used with
the GROUP BY clause.
Syntax
[ HAVING < search_condition > ]
ORDER BY Clause
[ ORDER BY { order_by_expression
[ ASC | DESC ]} [ ,...n] ]