tter to have one
    example that covers all the points discussed step by step rather
    than having many different ones that might mix up in mind.</P
><P
>For the example, we need a little <TT
CLASS="LITERAL"
>min</TT
> function that
returns the lower of 2 integer values. We create that as:

</P><PRE
CLASS="PROGRAMLISTING"
>CREATE FUNCTION min(integer, integer) RETURNS integer AS $$
    SELECT CASE WHEN $1 &lt; $2 THEN $1 ELSE $2 END
$$ LANGUAGE SQL STRICT;</PRE
><P></P
><P
>    The real tables we need in