Database Reference
In-Depth Information
The syntax for conditional statements is as follows:
IF expression THEN
Statements
ELSE
Statements
END IF;
The syntax for looping statements is as follows:
LOOP
Statements
END LOOP;
Conditions and expressions will be explained in detail in the
following sections.
Expressions
An expression can be a collection of one or more values, constants, variables,
operators, and PostgreSQL functions that evaluate as per rules of a language,
to a value that has a data type, which is one of the PostgreSQL base data types.
The following statement is an example of a Boolean expression; the part after the
WHERE clause evaluates the matching expression:
SELECT * FROM history WHERE amount = 1000;
The following statement is an example of a numeric expression (one that involves
mathematical calculation):
SELECT COUNT(*) FROM history;
Here, we used a built-in aggregate function that calculates all rows of the
history table.
The examples of expressions for the INSERT and UPDATE statements are given
as follows:
INSERT INTO table VALUES( expression [,...] );
INSERT INTO warehouse_tbl
(
warehouse_id,
warehouse_name,
year_created,
street_address,
 
Search WWH ::




Custom Search