Extracts specified substring. (same as <literal>substring(<parameter>string</parameter> from <parameter>from</parameter> for <parameter>count</parameter>)</literal>)
The to_ascii() support conversion from LATIN1, LATIN2, WIN1250 (CP1250) only.
If you have pattern matching needs that go beyond this, or want to
make pattern-driven substitutions or translations, consider
writing a user-defined function in Perl or Tcl.
</para>
</sect1>
</tip>
<sect1 id="datetime-functions">
<title>Date/Time Functions</title>
<sect2 id="functions-like">
<title>Pattern Matching with <function>LIKE</function></title>
<synopsis>
<replaceable>string</replaceable> LIKE <replaceable>pattern</replaceable> <optional> ESCAPE <replaceable>escape-character</replaceable> </optional>
<replaceable>string</replaceable> NOT LIKE <replaceable>pattern</replaceable> <optional> ESCAPE <replaceable>escape-character</replaceable> </optional>
</synopsis>
<para>
The date/time functions provide a powerful set of tools
for manipulating various date/time types.
Every <replaceable>pattern</replaceable> defines a set of strings.
The <function>LIKE</function> expression returns true if the
<replaceable>string</replaceable> is contained in the set of
strings represented by <replaceable>pattern</replaceable>. (As
expected, the <function>NOT LIKE</function> expression returns
false if <function>LIKE</function> returns true, and vice versa.
An equivalent expression is <literal>NOT
(<replaceable>string</replaceable> LIKE
<replaceable>pattern</replaceable>)</literal>.)
</para>
<para>
<table tocentry="1">
<title>Date/Time Functions</title>
<tgroup cols="4">
If <replaceable>pattern</replaceable> does not contain percent
signs or underscore then the pattern only represents the string
itself; in that case <function>LIKE</function> acts like the
equals operator. An underscore (<literal>_</literal>) in
<replaceable>pattern</replaceable> stands for (matches) any single
character, a percent sign (<literal>%</literal>) matches zero or
more characters.
</para>
<informalexample>
<para>
Some examples:
<programlisting>
'abc' LIKE 'abc' <lineannotation>true</lineannotation>
'abc' LIKE 'a%' <lineannotation>true</lineannotation>
'abc' LIKE '_b_' <lineannotation>true</lineannotation>
'abc' LIKE 'c' <lineannotation>false</lineannotation>
</programlisting>
</para>
</informalexample>
<para>
<function>LIKE</function> pattern matches always cover the entire
string. On order to match a pattern anywhere within a string, the
pattern must therefore start and end with a percent sign.
</para>
<para>
In order to match a literal underscore or percent sign, the
respective character in <replaceable>pattern</replaceable> must be
preceded by the active escape character. The default escape
character is the backslash but a different one may be selected by
using the <literal>ESCAPE</literal> clause. When using the
backslash as escape character in literal strings it must be
doubled, because the backslash already has a special meaning in
string literals.
</para>
<para>
The keyword <token>ILIKE</token> can be used instead of
<token>LIKE</token> to make the match case insensitive according
to the active locale. This is a
<productname>Postgres</productname> extension.
</para>
<para>
The operator <literal>~~</literal> is equivalent to
<function>LIKE</function>, <literal>~~*</literal> corresponds to
<literal>ILIKE</literal>. Finally, there are also
<literal>!~~</literal> and <literal>!~~*</literal> operators to
represent <function>NOT LIKE</function> and <function>NOT
ILIKE</function>. All of these are also
<productname>Postgres</productname>-specific.
</para>
</sect2>
<sect2 id="functions-regexp">
<title>POSIX Regular Expressions</title>
<para>
POSIX regular expressions provide a more powerful means for
pattern matching than the <function>LIKE</function> function.
Many Unix tools such as <command>egrep</command>,
<command>sed</command>, or <command>awk</command> use a pattern
matching language that is similar to the one described here.
</para>
<para>
A regular expression is a character sequence that is an
abbreviated definition of a set of strings (a <firstterm>regular
set</firstterm>). A string is said to match a regular expression
if it is a member of the regular set described by the regular
expression. Unlike the <function>LIKE</function> operator, a
regular expression also matches anywhere within a string, unless
the regular expression is explicitly anchored to the beginning or
<entry>Same as the data type of the input expression.</entry>
<entry>The maximum value of <replaceable class="parameter">expression</replaceable> across all selected rows.</entry>
<entry>MAX(age)</entry>
<entry>Finding the maximum value is supported on the following data types: int8, int4, int2, float4, float8, date, time, timetz, money, timestamp, interval, text, numeric.</entry>
<entry>the maximum value of <replaceable class="parameter">expression</replaceable> across all input values</entry>
<entry>
Available for all numeric, string, and date/time types. The
<entry>Same as the data type of the input expression.</entry>
<entry>The minimum value of <replaceable class="parameter">expression</replaceable> across all selected rows.</entry>
<entry>MIN(age)</entry>
<entry>Finding the minimum value is supported on the following data types: int8, int4, int2, float4, float8, date, time, timetz, money, timestamp, interval, text, numeric.</entry>
<entry>the minimum value of <replaceable class="parameter">expression</replaceable> across all input values</entry>
<entry>
Available for all numeric, string, and date/time types. The