All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.h2.res.help.csv Maven / Gradle / Ivy

The newest version!
# Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
# and the EPL 1.0 (https://h2database.com/html/license.html).
# Initial Developer: H2 Group

"SECTION","TOPIC","SYNTAX","TEXT","EXAMPLE"

"Commands (DML)","SELECT","
SELECT [ DISTINCT @h2@ [ ON ( expression [,...] ) ] | ALL ]
selectExpression [,...]
[ FROM tableExpression [,...] ]
[ WHERE expression ]
[ GROUP BY groupingElement [,...] ] [ HAVING expression ]
[ WINDOW { { windowName AS windowSpecification } [,...] } ]
@h2@ [ QUALIFY expression ]
[ { UNION [ ALL ] | EXCEPT | INTERSECT } query ]
[ ORDER BY selectOrder [,...] ]
[ OFFSET expression { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS }
    { ONLY | WITH TIES } ]
@h2@ [ FOR UPDATE [ NOWAIT | WAIT secondsNumeric | SKIP LOCKED ] ]
","
Selects data from a table or multiple tables.

Command is executed in the following logical order:

1. Data is taken from table value expressions that are specified in the FROM clause, joins are executed.
If FROM clause is not specified a single row is constructed.

2. WHERE filters rows. Aggregate or window functions are not allowed in this clause.

3. GROUP BY groups the result by the given expression(s).
If GROUP BY clause is not specified, but non-window aggregate functions are used or HAVING is specified
all rows are grouped together.

4. Aggregate functions are evaluated.

5. HAVING filters rows after grouping and evaluation of aggregate functions.
Non-window aggregate functions are allowed in this clause.

6. Window functions are evaluated.

7. QUALIFY filters rows after evaluation of window functions.
Aggregate and window functions are allowed in this clause.

8. DISTINCT removes duplicates.
If DISTINCT ON is used only the specified expressions are checked for duplicates;
ORDER BY clause, if any, is used to determine preserved rows.
First row is each DISTINCT ON group is preserved.
In absence of ORDER BY preserved rows are not determined, database may choose any row from each DISTINCT ON group.

9. UNION, EXCEPT, and INTERSECT combine the result of this query with the results of another query.
INTERSECT has higher precedence than UNION and EXCEPT.
Operators with equal precedence are evaluated from left to right.

10. ORDER BY sorts the result by the given column(s) or expression(s).

11. Number of rows in output can be limited with OFFSET and FETCH clauses.
OFFSET specifies how many rows to skip.
Please note that queries with high offset values can be slow.
FETCH FIRST/NEXT limits the number of rows returned by the query.
If PERCENT is specified number of rows is specified as a percent of the total number of rows
and should be an integer value between 0 and 100 inclusive.
WITH TIES can be used only together with ORDER BY and means that all additional rows that have the same sorting position
as the last row will be also returned.

WINDOW clause specifies window definitions for window functions and window aggregate functions.
This clause can be used to reuse the same definition in multiple functions.

If FOR UPDATE is specified, the tables or rows are locked for writing.
If some rows are locked by another session, this query will wait some time for release of these locks,
unless NOWAIT or SKIP LOCKED is specified.
If SKIP LOCKED is specified, these locked rows will be excluded from result of this query.
If NOWAIT is specified, presence of these rows will stop execution of this query immediately.
If WAIT with timeout is specified and some rows are locked by another session,
this timeout will be used instead of default timeout for this session.
Please note that with current implementation the timeout doesn't limit execution time of the whole query,
it only limits wait time for completion of particular transaction that holds a lock on a row selected by this query.

This clause is not allowed in DISTINCT queries and in queries with non-window aggregates, GROUP BY, or HAVING clauses.
Only the selected rows are locked as in an UPDATE statement.
Rows from the right side of a left join and from the left side of a right join, including nested joins, aren't locked.
Locking behavior for rows that were excluded from result using OFFSET / FETCH / LIMIT / TOP or QUALIFY is undefined,
to avoid possible locking of excessive rows try to filter out unneeded rows with the WHERE criteria when possible.
Rows are processed one by one. Each row is read, tested with WHERE criteria, locked, read again and re-tested,
because its value may be changed by concurrent transaction before lock acquisition.
Note that new uncommitted rows from other transactions are not visible unless read uncommitted isolation level is used
and therefore cannot be selected and locked.
Modified uncommitted rows from other transactions that satisfy the WHERE criteria cause this SELECT to wait for
commit or rollback of those transactions.
","
SELECT * FROM TEST;
SELECT * FROM TEST ORDER BY NAME;
SELECT ID, COUNT(*) FROM TEST GROUP BY ID;
SELECT NAME, COUNT(*) FROM TEST GROUP BY NAME HAVING COUNT(*) > 2;
SELECT 'ID' COL, MAX(ID) AS MAX FROM TEST UNION SELECT 'NAME', MAX(NAME) FROM TEST;
SELECT * FROM TEST OFFSET 1000 ROWS FETCH FIRST 1000 ROWS ONLY;
SELECT A, B FROM TEST ORDER BY A FETCH FIRST 10 ROWS WITH TIES;
SELECT * FROM (SELECT ID, COUNT(*) FROM TEST
    GROUP BY ID UNION SELECT NULL, COUNT(*) FROM TEST)
    ORDER BY 1 NULLS LAST;
SELECT DISTINCT C1, C2 FROM TEST;
SELECT DISTINCT ON(C1) C1, C2 FROM TEST ORDER BY C1;
SELECT ID, V FROM TEST WHERE ID IN (1, 2, 3) FOR UPDATE WAIT 0.5;
"

"Commands (DML)","INSERT","
INSERT INTO [schemaName.]tableName [ ( columnName [,...] ) ]
{ [ overrideClause ] { insertValues | @h2@ [ DIRECT ] query } }
    | DEFAULT VALUES
","
Inserts a new row / new rows into a table.

When using DIRECT, then the results from the query are directly applied in the target table without any intermediate step.
","
INSERT INTO TEST VALUES(1, 'Hello')
"

"Commands (DML)","UPDATE","
UPDATE [schemaName.]tableName [ [ AS ] newTableAlias ] SET setClauseList
[ WHERE expression ] @c@ [ ORDER BY sortSpecificationList ]
@h2@ FETCH { FIRST | NEXT } [ expression ] { ROW | ROWS } ONLY
","
Updates data in a table.
ORDER BY is supported for MySQL compatibility, but it is ignored.
If FETCH is specified, at most the specified number of rows are updated (no limit if null or smaller than zero).
","
UPDATE TEST SET NAME='Hi' WHERE ID=1;
UPDATE PERSON P SET NAME=(SELECT A.NAME FROM ADDRESS A WHERE A.ID=P.ID);
"

"Commands (DML)","DELETE","
DELETE FROM [schemaName.]tableName
[ WHERE expression ]
@h2@ FETCH { FIRST | NEXT } [ expression ] { ROW | ROWS } ONLY
","
Deletes rows form a table.
If FETCH is specified, at most the specified number of rows are deleted (no limit if null or smaller than zero).
","
DELETE FROM TEST WHERE ID=2
"

"Commands (DML)","BACKUP","
@h2@ BACKUP TO fileNameString
","
Backs up the database files to a .zip file. Objects are not locked, but
the backup is transactionally consistent because the transaction log is also copied.
Admin rights are required to execute this command.
","
BACKUP TO 'backup.zip'
"

"Commands (DML)","CALL","
CALL expression
","
Calculates a simple expression. This statement returns a result set with one row,
except if the called function returns a result set itself.
If the called function returns an array, then each element in this array is returned as a column.
","
CALL 15*25
"

"Commands (DML)","EXECUTE IMMEDIATE","
EXECUTE IMMEDIATE sqlString
","
Dynamically prepares and executes the SQL command specified as a string. Query commands may not be used.
","
EXECUTE IMMEDIATE 'ALTER TABLE TEST DROP CONSTRAINT ' ||
    QUOTE_IDENT((SELECT CONSTRAINT_NAME
        FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
        WHERE TABLE_SCHEMA = 'PUBLIC' AND TABLE_NAME = 'TEST'
            AND CONSTRAINT_TYPE = 'UNIQUE'));
"

"Commands (DML)","EXPLAIN","
@h2@ EXPLAIN { [ PLAN FOR ] | ANALYZE }
@h2@ { query | insert | update | delete | mergeInto | mergeUsing }
","
Shows the execution plan for a statement.
When using EXPLAIN ANALYZE, the statement is actually executed, and the query plan
will include the actual row scan count for each table.
","
EXPLAIN SELECT * FROM TEST WHERE ID=1
"

"Commands (DML)","MERGE INTO","
@h2@ MERGE INTO [schemaName.]tableName [ ( columnName [,...] ) ]
@h2@ [ KEY ( columnName [,...] ) ]
@h2@ { insertValues | query }
","
Updates existing rows, and insert rows that don't exist. If no key column is
specified, the primary key columns are used to find the row. If more than one
row per new row is affected, an exception is thrown.
","
MERGE INTO TEST KEY(ID) VALUES(2, 'World')
"

"Commands (DML)","MERGE USING","
MERGE INTO [schemaName.]targetTableName [ [AS] targetAlias]
USING tableExpression
ON expression
mergeWhenClause [,...]
","
Updates or deletes existing rows, and insert rows that don't exist.

The ON clause specifies the matching column expression.

Different rows from a source table may not match with the same target row
(this is not ensured by H2 if target table is an updatable view).
One source row may be matched with multiple target rows.

If statement doesn't need a source table a DUAL table can be substituted.
","
MERGE INTO TARGET_TABLE AS T USING SOURCE_TABLE AS S
    ON T.ID = S.ID
    WHEN MATCHED AND T.COL2 <> 'FINAL' THEN
        UPDATE SET T.COL1 = S.COL1
    WHEN MATCHED AND T.COL2 = 'FINAL' THEN
        DELETE
    WHEN NOT MATCHED THEN
        INSERT (ID, COL1, COL2) VALUES(S.ID, S.COL1, S.COL2);
MERGE INTO TARGET_TABLE AS T USING (SELECT * FROM SOURCE_TABLE) AS S
    ON T.ID = S.ID
    WHEN MATCHED AND T.COL2 <> 'FINAL' THEN
        UPDATE SET T.COL1 = S.COL1
    WHEN MATCHED AND T.COL2 = 'FINAL' THEN
        DELETE
    WHEN NOT MATCHED THEN
        INSERT VALUES (S.ID, S.COL1, S.COL2);
MERGE INTO TARGET T USING (VALUES (1, 4), (2, 15)) S(ID, V)
    ON T.ID = S.ID
    WHEN MATCHED THEN UPDATE SET V = S.V
    WHEN NOT MATCHED THEN INSERT VALUES (S.ID, S.V);
MERGE INTO TARGET_TABLE USING DUAL ON ID = 1
    WHEN NOT MATCHED THEN INSERT VALUES (1, 'Test')
    WHEN MATCHED THEN UPDATE SET NAME = 'Test';
"

"Commands (DML)","RUNSCRIPT","
@h2@ RUNSCRIPT FROM fileNameString scriptCompressionEncryption
@h2@ [ CHARSET charsetString ]
@h2@ { [ QUIRKS_MODE ] [ VARIABLE_BINARY ] | FROM_1X }
","
Runs a SQL script from a file. The script is a text file containing SQL
statements; each statement must end with ';'. This command can be used to
restore a database from a backup. The password must be in single quotes; it is
case sensitive and can contain spaces.

Instead of a file name, a URL may be used.
To read a stream from the classpath, use the prefix 'classpath:'.
See the [Pluggable File System](https://h2database.com/html/advanced.html#file_system) section.

The compression algorithm must match the one used when creating the script.
Instead of a file, a URL may be used.

If ""QUIRKS_MODE"" is specified, the various compatibility quirks for scripts from older versions of H2 are enabled.
Use this clause when you import script that was generated by H2 1.4.200 or an older version into more recent version.

If ""VARIABLE_BINARY"" is specified, the ""BINARY"" data type will be parsed as ""VARBINARY"".
Use this clause when you import script that was generated by H2 1.4.200 or an older version into more recent version.

If ""FROM_1X"" is specified, quirks for scripts exported from H2 1.*.* are enabled.
Use this flag to populate a new database with the data exported from 1.*.* versions of H2.
This flag also enables ""QUIRKS_MODE"" and ""VARIABLE_BINARY"" implicitly.

Admin rights are required to execute this command.
","
RUNSCRIPT FROM 'backup.sql'
RUNSCRIPT FROM 'classpath:/com/acme/test.sql'
RUNSCRIPT FROM 'dump_from_1_4_200.sql' FROM_1X
"

"Commands (DML)","SCRIPT","
@h2@ SCRIPT { [ NODATA ] | [ SIMPLE ] [ COLUMNS ] }
@h2@ [ NOPASSWORDS ] @h2@ [ NOSETTINGS ]
@h2@ [ DROP ] @h2@ [ BLOCKSIZE blockSizeInt ]
@h2@ [ TO fileNameString scriptCompressionEncryption
    [ CHARSET charsetString ] ]
@h2@ [ TABLE [schemaName.]tableName [, ...] ]
@h2@ [ SCHEMA schemaName [, ...] ]
","
Creates a SQL script from the database.

NODATA will not emit INSERT statements.
SIMPLE does not use multi-row insert statements.
COLUMNS includes column name lists into insert statements.
If the DROP option is specified, drop statements are created for tables, views,
and sequences. If the block size is set, CLOB and BLOB values larger than this
size are split into separate blocks.
BLOCKSIZE is used when writing out LOB data, and specifies the point at the
values transition from being inserted as inline values, to be inserted using
out-of-line commands.
NOSETTINGS turns off dumping the database settings (the SET XXX commands)

If no 'TO fileName' clause is specified, the
script is returned as a result set. This command can be used to create a backup
of the database. For long term storage, it is more portable than copying the
database files.

If a 'TO fileName' clause is specified, then the whole
script (including insert statements) is written to this file, and a result set
without the insert statements is returned.

The password must be in single quotes; it is case sensitive and can contain spaces.

This command locks objects while it is running.
Admin rights are required to execute this command.

When using the TABLE or SCHEMA option, only the selected table(s) / schema(s) are included.
","
SCRIPT NODATA
"

"Commands (DML)","SHOW","
@c@ SHOW { SCHEMAS | TABLES [ FROM schemaName ] |
    COLUMNS FROM tableName [ FROM schemaName ] }
","
Lists the schemas, tables, or the columns of a table.
","
SHOW TABLES
"

"Commands (DML)","Explicit table","
TABLE [schemaName.]tableName
[ ORDER BY selectOrder [,...] ]
[ OFFSET expression { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS }
    { ONLY | WITH TIES } ]
","
Selects data from a table.

This command is an equivalent to SELECT * FROM tableName.
See [SELECT](https://h2database.com/html/commands.html#select) command for description of ORDER BY, OFFSET, and FETCH.
","
TABLE TEST;
TABLE TEST ORDER BY ID FETCH FIRST ROW ONLY;
"

"Commands (DML)","Table value","
VALUES rowValueExpression [,...]
[ ORDER BY selectOrder [,...] ]
[ OFFSET expression { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS }
    { ONLY | WITH TIES } ]
","
A list of rows that can be used like a table.
See See [SELECT](https://h2database.com/html/commands.html#select) command for description of ORDER BY, OFFSET, and FETCH.
The column list of the resulting table is C1, C2, and so on.
","
VALUES (1, 'Hello'), (2, 'World');
"

"Commands (DML)","WITH","
WITH [ RECURSIVE ] { name [( columnName [,...] )] AS ( query ) [,...] }
{ query | @h2@ { insert | update | delete | mergeInto | mergeUsing | createTable } }
","
Can be used to create a recursive or non-recursive query (common table expression).
For recursive queries the first select has to be a UNION.
One or more common table entries can be referred to by name.
Column name declarations are now optional - the column names will be inferred from the named select queries.
The final action in a WITH statement can be a select, insert, update, merge, delete or create table.
","
WITH RECURSIVE cte(n) AS (
        SELECT 1
    UNION ALL
        SELECT n + 1
        FROM cte
        WHERE n < 100
)
SELECT sum(n) FROM cte;

Example 2:
WITH cte1 AS (
        SELECT 1 AS FIRST_COLUMN
), cte2 AS (
        SELECT FIRST_COLUMN+1 AS FIRST_COLUMN FROM cte1
)
SELECT sum(FIRST_COLUMN) FROM cte2;
"

"Commands (DDL)","ALTER DOMAIN","
ALTER DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName
{ SET DEFAULT expression }
    | { DROP DEFAULT }
    | @h2@ { SET ON UPDATE expression }
    | @h2@ { DROP ON UPDATE }
","
Changes the default or on update expression of a domain.
Schema owner rights are required to execute this command.

SET DEFAULT changes the default expression of a domain.

DROP DEFAULT removes the default expression of a domain.
Old expression is copied into domains and columns that use this domain and don't have an own default expression.

SET ON UPDATE changes the expression that is set on update if value for this domain is not specified in update
statement.

DROP ON UPDATE removes the expression that is set on update of a column with this domain.
Old expression is copied into domains and columns that use this domain and don't have an own on update expression.

This command commits an open transaction in this connection.
","
ALTER DOMAIN D1 SET DEFAULT '';
ALTER DOMAIN D1 DROP DEFAULT;
ALTER DOMAIN D1 SET ON UPDATE CURRENT_TIMESTAMP;
ALTER DOMAIN D1 DROP ON UPDATE;
"

"Commands (DDL)","ALTER DOMAIN ADD CONSTRAINT","
ALTER DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName
ADD [ constraintNameDefinition ]
CHECK (condition) @h2@ [ CHECK | NOCHECK ]
","
Adds a constraint to a domain.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER DOMAIN D ADD CONSTRAINT D_POSITIVE CHECK (VALUE > 0)
"

"Commands (DDL)","ALTER DOMAIN DROP CONSTRAINT","
ALTER DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName
DROP CONSTRAINT @h2@ [ IF EXISTS ] [schemaName.]constraintName
","
Removes a constraint from a domain.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER DOMAIN D DROP CONSTRAINT D_POSITIVE
"

"Commands (DDL)","ALTER DOMAIN RENAME","
@h2@ ALTER DOMAIN [ IF EXISTS ] [schemaName.]domainName RENAME TO newName
","
Renames a domain.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER DOMAIN TEST RENAME TO MY_TYPE
"

"Commands (DDL)","ALTER DOMAIN RENAME CONSTRAINT","
@h2@ ALTER DOMAIN [ IF EXISTS ] [schemaName.]domainName
@h2@ RENAME CONSTRAINT [schemaName.]oldConstraintName
@h2@ TO newConstraintName
","
Renames a constraint.
This command commits an open transaction in this connection.
","
ALTER DOMAIN D RENAME CONSTRAINT FOO TO BAR
"

"Commands (DDL)","ALTER INDEX RENAME","
@h2@ ALTER INDEX [ IF EXISTS ] [schemaName.]indexName RENAME TO newIndexName
","
Renames an index.
This command commits an open transaction in this connection.
","
ALTER INDEX IDXNAME RENAME TO IDX_TEST_NAME
"

"Commands (DDL)","ALTER SCHEMA RENAME","
@h2@ ALTER SCHEMA [ IF EXISTS ] schemaName RENAME TO newSchemaName
","
Renames a schema.
Schema admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER SCHEMA TEST RENAME TO PRODUCTION
"

"Commands (DDL)","ALTER SEQUENCE","
ALTER SEQUENCE @h2@ [ IF EXISTS ] [schemaName.]sequenceName alterSequenceOption [...]
","
Changes the parameters of a sequence.
Schema owner rights are required to execute this command.
This command does not commit the current transaction; however the new value is used by other
transactions immediately, and rolling back this command has no effect.
","
ALTER SEQUENCE SEQ_ID RESTART WITH 1000
"

"Commands (DDL)","ALTER TABLE ADD","
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName ADD [ COLUMN ]
{ @h2@ [ IF NOT EXISTS ] columnName columnDefinition @h2@ [ USING initialValueExpression ]
    | @h2@ { ( { columnName columnDefinition | tableConstraintDefinition } [,...] ) } }
@h2@ [ { { BEFORE | AFTER } columnName } | FIRST ]
","
Adds a new column to a table.
This command commits an open transaction in this connection.

If USING is specified the provided expression is used to generate initial value of the new column for each row.
The expression may reference existing columns of the table.
Otherwise the DEFAULT expression is used, if any.
If neither USING nor DEFAULT are specified, the NULL is used.
","
ALTER TABLE TEST ADD CREATEDATE TIMESTAMP
"

"Commands (DDL)","ALTER TABLE ADD CONSTRAINT","
ALTER TABLE @h2@ [ IF EXISTS ] tableName ADD tableConstraintDefinition @h2@ [ CHECK | NOCHECK ]
","
Adds a constraint to a table. If NOCHECK is specified, existing rows are not
checked for consistency (the default is to check consistency for existing rows).
The required indexes are automatically created if they don't exist yet.
It is not possible to disable checking for unique constraints.
This command commits an open transaction in this connection.
","
ALTER TABLE TEST ADD CONSTRAINT NAME_UNIQUE UNIQUE(NAME)
"

"Commands (DDL)","ALTER TABLE RENAME CONSTRAINT","
@h2@ ALTER TABLE [ IF EXISTS ] [schemaName.]tableName
@h2@ RENAME CONSTRAINT [schemaName.]oldConstraintName
@h2@ TO newConstraintName
","
Renames a constraint.
This command commits an open transaction in this connection.
","
ALTER TABLE TEST RENAME CONSTRAINT FOO TO BAR
"

"Commands (DDL)","ALTER TABLE ALTER COLUMN","
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName
ALTER COLUMN @h2@ [ IF EXISTS ] columnName
{ @h2@ { columnDefinition }
    | @h2@ { RENAME TO name }
    | SET GENERATED { ALWAYS | BY DEFAULT } [ alterIdentityColumnOption [...] ]
    | alterIdentityColumnOption [...]
    | DROP IDENTITY
    | @h2@ { SELECTIVITY int }
    | { SET DEFAULT expression }
    | { DROP DEFAULT }
    | DROP EXPRESSION
    | @h2@ { SET ON UPDATE expression }
    | @h2@ { DROP ON UPDATE }
    | @h2@ { SET DEFAULT ON NULL }
    | @h2@ { DROP DEFAULT ON NULL }
    | { SET NOT NULL }
    | { DROP NOT NULL } | @c@ { SET NULL }
    | { SET DATA TYPE dataTypeOrDomain @h2@ [ USING newValueExpression ] }
    | @h2@ { SET { VISIBLE | INVISIBLE } } }
","
Changes the data type of a column, rename a column,
change the identity value, or change the selectivity.

Changing the data type fails if the data can not be converted.

SET GENERATED ALWAYS, SET GENERATED BY DEFAULT, or identity options convert the column into identity column
(if it wasn't an identity column) and set new values of specified options for its sequence.

DROP IDENTITY removes identity status of a column.

SELECTIVITY sets the selectivity (1-100) for a column.
Setting the selectivity to 0 means the default value.
Selectivity is used by the cost based optimizer to calculate the estimated cost of an index.
Selectivity 100 means values are unique, 10 means every distinct value appears 10 times on average.

SET DEFAULT changes the default value of a column.
This command doesn't affect generated and identity columns.

DROP DEFAULT removes the default value of a column.

DROP EXPRESSION converts generated column into base column.

SET ON UPDATE changes the value that is set on update if value for this column is not specified in update statement.
This command doesn't affect generated and identity columns.

DROP ON UPDATE removes the value that is set on update of a column.

SET DEFAULT ON NULL makes NULL value work as DEFAULT value is assignments to this column.

DROP DEFAULT ON NULL makes NULL value work as NULL value in assignments to this column.

SET NOT NULL sets a column to not allow NULL. Rows may not contain NULL in this column.

DROP NOT NULL and SET NULL set a column to allow NULL.
The column may not be part of a primary key and may not be an identity column.

SET DATA TYPE changes the data type of a column, for each row old value is converted to this data type
unless USING is specified with a custom expression.
USING expression may reference previous value of the modified column by its name and values of other columns.

SET INVISIBLE makes the column hidden, i.e. it will not appear in SELECT * results.
SET VISIBLE has the reverse effect.

This command commits an open transaction in this connection.
","
ALTER TABLE TEST ALTER COLUMN NAME CLOB;
ALTER TABLE TEST ALTER COLUMN NAME RENAME TO TEXT;
ALTER TABLE TEST ALTER COLUMN ID RESTART WITH 10000;
ALTER TABLE TEST ALTER COLUMN NAME SELECTIVITY 100;
ALTER TABLE TEST ALTER COLUMN NAME SET DEFAULT '';
ALTER TABLE TEST ALTER COLUMN NAME SET NOT NULL;
ALTER TABLE TEST ALTER COLUMN NAME SET NULL;
ALTER TABLE TEST ALTER COLUMN NAME SET VISIBLE;
ALTER TABLE TEST ALTER COLUMN NAME SET INVISIBLE;
"

"Commands (DDL)","ALTER TABLE DROP COLUMN","
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName
DROP [ COLUMN ] @h2@ [ IF EXISTS ]
@h2@ { ( columnName [,...] ) } | columnName @c@ [,...]
","
Removes column(s) from a table.
This command commits an open transaction in this connection.
","
ALTER TABLE TEST DROP COLUMN NAME
ALTER TABLE TEST DROP COLUMN (NAME1, NAME2)
"

"Commands (DDL)","ALTER TABLE DROP CONSTRAINT","
ALTER TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName DROP
CONSTRAINT @h2@ [ IF EXISTS ] [schemaName.]constraintName [ RESTRICT | CASCADE ] | @c@ { PRIMARY KEY }
","
Removes a constraint or a primary key from a table.
If CASCADE is specified, unique or primary key constraint is dropped together with all
referential constraints that reference the specified constraint.
This command commits an open transaction in this connection.
","
ALTER TABLE TEST DROP CONSTRAINT UNIQUE_NAME RESTRICT
"

"Commands (DDL)","ALTER TABLE SET","
@h2@ ALTER TABLE [ IF EXISTS ] [schemaName.]tableName
SET REFERENTIAL_INTEGRITY
@h2@ { FALSE | TRUE } @h2@ [ CHECK | NOCHECK ]
","
Disables or enables referential integrity checking for a table. This command can
be used inside a transaction. Enabling referential integrity does not check
existing data, except if CHECK is specified. Use SET REFERENTIAL_INTEGRITY to
disable it for all tables; the global flag and the flag for each table are
independent.

This command commits an open transaction in this connection.
","
ALTER TABLE TEST SET REFERENTIAL_INTEGRITY FALSE
"

"Commands (DDL)","ALTER TABLE RENAME","
@h2@ ALTER TABLE [ IF EXISTS ] [schemaName.]tableName RENAME TO newName
","
Renames a table.
This command commits an open transaction in this connection.
","
ALTER TABLE TEST RENAME TO MY_DATA
"

"Commands (DDL)","ALTER USER ADMIN","
@h2@ ALTER USER userName ADMIN { TRUE | FALSE }
","
Switches the admin flag of a user on or off.

Only unquoted or uppercase user names are allowed.
Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER USER TOM ADMIN TRUE
"

"Commands (DDL)","ALTER USER RENAME","
@h2@ ALTER USER userName RENAME TO newUserName
","
Renames a user.
After renaming a user, the password becomes invalid and needs to be changed as well.

Only unquoted or uppercase user names are allowed.
Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER USER TOM RENAME TO THOMAS
"

"Commands (DDL)","ALTER USER SET PASSWORD","
@h2@ ALTER USER userName SET { PASSWORD string | SALT bytes HASH bytes }
","
Changes the password of a user.
Only unquoted or uppercase user names are allowed.
The password must be enclosed in single quotes. It is case sensitive
and can contain spaces. The salt and hash values are hex strings.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER USER SA SET PASSWORD 'rioyxlgt'
"

"Commands (DDL)","ALTER VIEW RECOMPILE","
@h2@ ALTER VIEW [ IF EXISTS ] [schemaName.]viewName RECOMPILE
","
Recompiles a view after the underlying tables have been changed or created.
Schema owner rights are required to execute this command.
This command is used for views created using CREATE FORCE VIEW.
This command commits an open transaction in this connection.
","
ALTER VIEW ADDRESS_VIEW RECOMPILE
"

"Commands (DDL)","ALTER VIEW RENAME","
@h2@ ALTER VIEW [ IF EXISTS ] [schemaName.]viewName RENAME TO newName
","
Renames a view.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
ALTER VIEW TEST RENAME TO MY_VIEW
"

"Commands (DDL)","ANALYZE","
@h2@ ANALYZE [ TABLE [schemaName.]tableName ] [ SAMPLE_SIZE rowCountInt ]
","
Updates the selectivity statistics of tables.
If no table name is given, all tables are analyzed.
The selectivity is used by the
cost based optimizer to select the best index for a given query. If no sample
size is set, up to 10000 rows per table are read. The value 0 means all rows are
read. The selectivity can be set manually using ALTER TABLE ALTER COLUMN
SELECTIVITY. Manual values are overwritten by this statement. The selectivity is
available in the INFORMATION_SCHEMA.COLUMNS table.

This command commits an open transaction in this connection.
","
ANALYZE SAMPLE_SIZE 1000
"

"Commands (DDL)","COMMENT ON","
@h2@ COMMENT ON
@h2@ { { COLUMN [schemaName.]tableName.columnName }
    | { { TABLE | VIEW | CONSTANT | CONSTRAINT | ALIAS | INDEX | ROLE
    | SCHEMA | SEQUENCE | TRIGGER | USER | DOMAIN } [schemaName.]objectName } }
@h2@ IS expression
","
Sets the comment of a database object. Use NULL or empty string to remove the comment.

Admin rights are required to execute this command if object is a USER or ROLE.
Schema owner rights are required to execute this command for all other types of objects.
This command commits an open transaction in this connection.
","
COMMENT ON TABLE TEST IS 'Table used for testing'
"

"Commands (DDL)","CREATE AGGREGATE","
@h2@ CREATE AGGREGATE [ IF NOT EXISTS ] [schemaName.]aggregateName FOR classNameString
","
Creates a new user-defined aggregate function. The method name must be the full
qualified class name. The class must implement the interface
""org.h2.api.Aggregate"" or ""org.h2.api.AggregateFunction"".

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
CREATE AGGREGATE SIMPLE_MEDIAN FOR 'com.acme.db.Median'
"

"Commands (DDL)","CREATE ALIAS","
@h2@ CREATE ALIAS [ IF NOT EXISTS ] [schemaName.]functionAliasName
@h2@ [ DETERMINISTIC ]
@h2@ { FOR classAndMethodString | AS sourceCodeString }
","
Creates a new function alias. If this is a ResultSet returning function,
by default the return value is cached in a local temporary file.

DETERMINISTIC - Deterministic functions must always return the same value for the same parameters.

The method name must be the full qualified class and method name,
and may optionally include the parameter classes as in
""java.lang.Integer.parseInt(java.lang.String, int)"". The class and the method
must both be public, and the method must be static. The class must be available
in the classpath of the database engine (when using the server mode,
it must be in the classpath of the server).

When defining a function alias with source code, the Sun ""javac"" is compiler
is used if the file ""tools.jar"" is in the classpath. If not, ""javac"" is run as a separate process.
Only the source code is stored in the database; the class is compiled each time
the database is re-opened. Source code is usually passed
as dollar quoted text to avoid escaping problems. If import statements are used,
then the tag @CODE must be added before the method.

If the method throws an SQLException, it is directly re-thrown to the calling application;
all other exceptions are first converted to a SQLException.

If the first parameter of the Java function is a ""java.sql.Connection"", then a
connection to the database is provided. This connection must not be closed.
If the class contains multiple methods with the given name but different
parameter count, all methods are mapped.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.

If you have the Groovy jar in your classpath, it is also possible to write methods using Groovy.
","
CREATE ALIAS MY_SQRT FOR 'java.lang.Math.sqrt';
CREATE ALIAS MY_ROUND FOR 'java.lang.Math.round(double)';
CREATE ALIAS GET_SYSTEM_PROPERTY FOR 'java.lang.System.getProperty';
CALL GET_SYSTEM_PROPERTY('java.class.path');
CALL GET_SYSTEM_PROPERTY('com.acme.test', 'true');
CREATE ALIAS REVERSE AS 'String reverse(String s) { return new StringBuilder(s).reverse().toString(); }';
CALL REVERSE('Test');
CREATE ALIAS tr AS '@groovy.transform.CompileStatic
    static String tr(String str, String sourceSet, String replacementSet){
        return str.tr(sourceSet, replacementSet);
    }
'
"

"Commands (DDL)","CREATE CONSTANT","
@h2@ CREATE CONSTANT [ IF NOT EXISTS ] [schemaName.]constantName
VALUE expression
","
Creates a new constant.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
CREATE CONSTANT ONE VALUE 1
"

"Commands (DDL)","CREATE DOMAIN","
CREATE DOMAIN @h2@ [ IF NOT EXISTS ] [schemaName.]domainName
[ AS ] dataTypeOrDomain
[ DEFAULT expression ]
@h2@ [ ON UPDATE expression ]
@h2@ [ COMMENT expression ]
[ CHECK (condition) ] [...]
","
Creates a new domain to define a set of permissible values.
Schema owner rights are required to execute this command.
Domains can be used as data types.
The domain constraints must evaluate to TRUE or to UNKNOWN.
In the conditions, the term VALUE refers to the value being tested.

This command commits an open transaction in this connection.
","
CREATE DOMAIN EMAIL AS VARCHAR(255) CHECK (POSITION('@', VALUE) > 1)
"

"Commands (DDL)","CREATE INDEX","
@h2@ CREATE [ UNIQUE [ nullsDistinct ] | SPATIAL ] INDEX
@h2@ [ [ IF NOT EXISTS ] [schemaName.]indexName ]
@h2@ ON [schemaName.]tableName ( indexColumn [,...] )
@h2@ [ INCLUDE ( indexColumn [,...] ) ]
","
Creates a new index.
This command commits an open transaction in this connection.

INCLUDE clause may only be specified for UNIQUE indexes.
With this clause additional columns are included into index, but aren't used in unique checks.
If nulls distinct clause is not specified, the default is NULLS DISTINCT, excluding some compatibility modes.

Spatial indexes are supported only on GEOMETRY columns.
They may contain only one column and are used by the
[spatial overlapping operator](https://h2database.com/html/grammar.html#compare).
","
CREATE INDEX IDXNAME ON TEST(NAME)
"

"Commands (DDL)","CREATE LINKED TABLE","
@h2@ CREATE [ FORCE ] [ [ GLOBAL | LOCAL ] TEMPORARY ]
@h2@ LINKED TABLE [ IF NOT EXISTS ]
@h2@ [schemaName.]tableName ( driverString, urlString, userString, passwordString,
@h2@ [ originalSchemaString, ] @h2@ originalTableString )
@h2@ [ EMIT UPDATES | READONLY ] [ FETCH_SIZE sizeInt] [AUTOCOMMIT ON|OFF]
","
Creates a table link to an external table. The driver name may be empty if the
driver is already loaded. If the schema name is not set, only one table with
that name may exist in the target database.

FORCE - Create the LINKED TABLE even if the remote database/table does not exist.

EMIT UPDATES - Usually, for update statements, the old rows are deleted first and then the new
rows are inserted. It is possible to emit update statements (except on
rollback), however in this case multi-row unique key updates may not always
work. Linked tables to the same database share one connection.

READONLY - is set, the remote table may not be updated. This is enforced by H2.

FETCH_SIZE - the number of rows fetched, a hint with non-negative number of rows to fetch from the external table
at once, may be ignored by the driver of external database. 0 is default and means no hint.
The value is passed to ""java.sql.Statement.setFetchSize()"" method.

AUTOCOMMIT - is set to ON, the auto-commit mode is enable. OFF is disable.
The value is passed to ""java.sql.Connection.setAutoCommit()"" method.

If the connection to the source database is lost, the connection is re-opened
(this is a workaround for MySQL that disconnects after 8 hours of inactivity by default).

If a query is used instead of the original table name, the table is read only.
Queries must be enclosed in parenthesis: ""(SELECT * FROM ORDERS)"".

To use JNDI to get the connection, the driver class must be a
javax.naming.Context (for example ""javax.naming.InitialContext""), and the URL must
be the resource name (for example ""java:comp/env/jdbc/Test"").

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
CREATE LINKED TABLE LINK('org.h2.Driver', 'jdbc:h2:./test2',
    'sa', 'sa', 'TEST');
CREATE LINKED TABLE LINK('', 'jdbc:h2:./test2', 'sa', 'sa',
    '(SELECT * FROM TEST WHERE ID>0)');
CREATE LINKED TABLE LINK('javax.naming.InitialContext',
    'java:comp/env/jdbc/Test', NULL, NULL,
    '(SELECT * FROM TEST WHERE ID>0)');
"

"Commands (DDL)","CREATE ROLE","
CREATE ROLE @h2@ [ IF NOT EXISTS ] newRoleName
","
Creates a new role.
This command commits an open transaction in this connection.
","
CREATE ROLE READONLY
"

"Commands (DDL)","CREATE SCHEMA","
CREATE SCHEMA @h2@ [ IF NOT EXISTS ]
{ name [ AUTHORIZATION ownerName ] | [ AUTHORIZATION ownerName ] }
@h2@ [ WITH tableEngineParamName [,...] ]
","
Creates a new schema.
Schema admin rights are required to execute this command.

If schema name is not specified, the owner name is used as a schema name.
If schema name is specified, but no owner is specified, the current user is used as an owner.

Schema owners can create, rename, and drop objects in the schema.
Schema owners can drop the schema itself, but cannot rename it.
Some objects may still require admin rights for their creation,
see documentation of their CREATE statements for details.

Optional table engine parameters are used when CREATE TABLE command
is run on this schema without having its engine params set.

This command commits an open transaction in this connection.
","
CREATE SCHEMA TEST_SCHEMA AUTHORIZATION SA
"

"Commands (DDL)","CREATE SEQUENCE","
CREATE SEQUENCE @h2@ [ IF NOT EXISTS ] [schemaName.]sequenceName
[ { AS dataType | sequenceOption } [...] ]
","
Creates a new sequence.
Schema owner rights are required to execute this command.

The data type of a sequence must be a numeric type, the default is BIGINT.
Sequence can produce only integer values.
For TINYINT the allowed values are between -128 and 127.
For SMALLINT the allowed values are between -32768 and 32767.
For INTEGER the allowed values are between -2147483648 and 2147483647.
For BIGINT the allowed values are between -9223372036854775808 and 9223372036854775807.
For NUMERIC and DECFLOAT the allowed values depend on precision,
but cannot exceed the range of BIGINT data type (from -9223372036854775808 to 9223372036854775807);
the scale of NUMERIC must be 0.
For REAL the allowed values are between -16777216 and 16777216.
For DOUBLE PRECISION the allowed values are between -9007199254740992 and 9007199254740992.

Used values are never re-used, even when the transaction is rolled back.

This command commits an open transaction in this connection.
","
CREATE SEQUENCE SEQ_ID;
CREATE SEQUENCE SEQ2 AS INTEGER START WITH 10;
"

"Commands (DDL)","CREATE TABLE","
CREATE @h2@ [ CACHED | MEMORY ] [ @c@ { TEMP } | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE @h2@ [ IF NOT EXISTS ] [schemaName.]tableName
[ ( { columnName [columnDefinition] | tableConstraintDefinition } [,...] ) ]
@h2@ [ ENGINE tableEngineName ]
@h2@ [ WITH tableEngineParamName [,...] ]
@h2@ [ NOT PERSISTENT ] @h2@ [ TRANSACTIONAL ]
[ AS ( query ) [ WITH [ NO ] DATA ] ]","
Creates a new table.

Admin rights are required to execute this command
if and only if ENGINE option is used or custom default table engine is configured in the database.
Schema owner rights or ALTER ANY SCHEMA rights are required for creation of regular tables and GLOBAL TEMPORARY tables.

Cached tables (the default for regular tables) are persistent,
and the number of rows is not limited by the main memory.
Memory tables (the default for temporary tables) are persistent,
but the index data is kept in main memory,
that means memory tables should not get too large.

Temporary tables are deleted when closing or opening a database.
Temporary tables can be global (accessible by all connections)
or local (only accessible by the current connection).
The default for temporary tables is global.
Indexes of temporary tables are kept fully in main memory,
unless the temporary table is created using CREATE CACHED TABLE.

The ENGINE option is only required when custom table implementations are used.
The table engine class must implement the interface ""org.h2.api.TableEngine"".
Any table engine parameters are passed down in the tableEngineParams field of the CreateTableData object.

Either ENGINE, or WITH (table engine params), or both may be specified. If ENGINE is not specified
in CREATE TABLE, then the engine specified by DEFAULT_TABLE_ENGINE option of database params is used.

Tables with the NOT PERSISTENT modifier are kept fully in memory, and all
rows are lost when the database is closed.

The column definitions are optional if a query is specified.
In that case the column list of the query is used.
If the query is specified its results are inserted into created table unless WITH NO DATA is specified.

This command commits an open transaction, except when using
TRANSACTIONAL (only supported for temporary tables).
","
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))
"

"Commands (DDL)","CREATE TRIGGER","
CREATE TRIGGER @h2@ [ IF NOT EXISTS ] [schemaName.]triggerName
{ BEFORE | AFTER | INSTEAD OF }
{ INSERT | UPDATE | DELETE | @h2@ { SELECT | ROLLBACK } }
@h2@ [,...] ON [schemaName.]tableName [ FOR EACH { ROW | STATEMENT } ]
@c@ [ QUEUE int ] @h2@ [ NOWAIT ]
@h2@ { CALL triggeredClassNameString | AS sourceCodeString }
","
Creates a new trigger.
Admin rights are required to execute this command.

The trigger class must be public and implement ""org.h2.api.Trigger"".
Inner classes are not supported.
The class must be available in the classpath of the database engine
(when using the server mode, it must be in the classpath of the server).

The sourceCodeString must define a single method with no parameters that returns ""org.h2.api.Trigger"".
See CREATE ALIAS for requirements regarding the compilation.
Alternatively, javax.script.ScriptEngineManager can be used to create an instance of ""org.h2.api.Trigger"".
Currently JavaScript (included in older JREs or provided by org.graalvm.js:js-scriptengine library in newer JREs)
and ruby (with JRuby) are supported.
In that case the source must begin respectively with ""//javascript"" or ""#ruby"".

BEFORE triggers are called after data conversion is made, default values are set,
null and length constraint checks have been made;
but before other constraints have been checked.
If there are multiple triggers, the order in which they are called is undefined.

ROLLBACK can be specified in combination with INSERT, UPDATE, and DELETE.
Only row based AFTER trigger can be called on ROLLBACK.
Exceptions that occur within such triggers are ignored.
As the operations that occur within a trigger are part of the transaction,
ROLLBACK triggers are only required if an operation communicates outside of the database.

INSTEAD OF triggers are implicitly row based and behave like BEFORE triggers.
Only the first such trigger is called. Such triggers on views are supported.
They can be used to make views updatable.
These triggers on INSERT and UPDATE must update the passed new row to values that were actually inserted
by the trigger; they are used for [FINAL TABLE](https://h2database.com/html/grammar.html#data_change_delta_table)
and for retrieval of generated keys.

A BEFORE SELECT trigger is fired just before the database engine tries to read from the table.
The trigger can be used to update a table on demand.
The trigger is called with both 'old' and 'new' set to null.

The MERGE statement will call both INSERT and UPDATE triggers.
Not supported are SELECT triggers with the option FOR EACH ROW,
and AFTER SELECT triggers.

Committing or rolling back a transaction within a trigger is not allowed, except for SELECT triggers.

By default a trigger is called once for each statement, without the old and new rows.
FOR EACH ROW triggers are called once for each inserted, updated, or deleted row.

QUEUE is implemented for syntax compatibility with HSQL and has no effect.

The trigger need to be created in the same schema as the table.
The schema name does not need to be specified when creating the trigger.

This command commits an open transaction in this connection.
","
CREATE TRIGGER TRIG_INS BEFORE INSERT ON TEST FOR EACH ROW CALL 'MyTrigger';
CREATE TRIGGER TRIG_SRC BEFORE INSERT ON TEST AS
    'org.h2.api.Trigger create() { return new MyTrigger(""constructorParam""); }';
CREATE TRIGGER TRIG_JS BEFORE INSERT ON TEST AS '//javascript
return new (Java.type(""org.example.MyTrigger""))(""constructorParam"");';
CREATE TRIGGER TRIG_RUBY BEFORE INSERT ON TEST AS '#ruby
Java::MyPackage::MyTrigger.new(""constructorParam"")';
"
"Commands (DDL)","CREATE USER","
@h2@ CREATE USER [ IF NOT EXISTS ] newUserName
@h2@ { PASSWORD string | SALT bytes HASH bytes } @h2@ [ ADMIN ]
","
Creates a new user. For compatibility, only unquoted or uppercase user names are allowed.
The password must be in single quotes. It is case sensitive and can contain spaces.
The salt and hash values are hex strings.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
CREATE USER GUEST PASSWORD 'abc'
"

"Commands (DDL)","CREATE VIEW","
CREATE @h2@ [ OR REPLACE ] @h2@ [ FORCE ]
VIEW @h2@ [ IF NOT EXISTS ] [schemaName.]viewName
[ ( columnName [,...] ) ] AS query
","
Creates a new view. If the force option is used, then the view is created even
if the underlying table(s) don't exist.
Schema owner rights are required to execute this command.

If the OR REPLACE clause is used an existing view will be replaced, and any
dependent views will not need to be recreated. If dependent views will become
invalid as a result of the change an error will be generated, but this error
can be ignored if the FORCE clause is also used.

Views are not updatable except when using 'instead of' triggers.

This command commits an open transaction in this connection.
","
CREATE VIEW TEST_VIEW AS SELECT * FROM TEST WHERE ID < 100
"

"Commands (DDL)","CREATE MATERIALIZED VIEW","
@h2@ CREATE [ OR REPLACE ]
@h2@ MATERIALIZED VIEW [ IF NOT EXISTS ] [schemaName.]viewName
[ ( columnName [,...] ) ] AS query
","
Creates a new materialized view.
Schema owner rights are required to execute this command.

If the OR REPLACE clause is used an existing view will be replaced.

Views are not updatable except using REFRESH MATERIALIZED VIEW.

This command commits an open transaction in this connection.
","
CREATE MATERIALIZED VIEW TEST_VIEW AS SELECT * FROM TEST WHERE ID < 100
"

"Commands (DDL)","DROP AGGREGATE","
@h2@ DROP AGGREGATE [ IF EXISTS ] aggregateName
","
Drops an existing user-defined aggregate function.
Schema owner rights are required to execute this command.

This command commits an open transaction in this connection.
","
DROP AGGREGATE SIMPLE_MEDIAN
"

"Commands (DDL)","DROP ALIAS","
@h2@ DROP ALIAS [ IF EXISTS ] [schemaName.]aliasName
","
Drops an existing function alias.
Schema owner rights are required to execute this command.

This command commits an open transaction in this connection.
","
DROP ALIAS MY_SQRT
"

"Commands (DDL)","DROP ALL OBJECTS","
@h2@ DROP ALL OBJECTS [ DELETE FILES ]
","
Drops all existing views, tables, sequences, schemas, function aliases, roles,
user-defined aggregate functions, domains, and users (except the current user).
If DELETE FILES is specified, the database files will be removed when the last
user disconnects from the database. Warning: this command can not be rolled
back.

Admin rights are required to execute this command.
","
DROP ALL OBJECTS
"

"Commands (DDL)","DROP CONSTANT","
@h2@ DROP CONSTANT [ IF EXISTS ] [schemaName.]constantName
","
Drops a constant.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
DROP CONSTANT ONE
"

"Commands (DDL)","DROP DOMAIN","
DROP DOMAIN @h2@ [ IF EXISTS ] [schemaName.]domainName [ RESTRICT | CASCADE ]
","
Drops a data type (domain).
Schema owner rights are required to execute this command.

The command will fail if it is referenced by a column or another domain (the default).
Column descriptors are replaced with original definition of specified domain if the CASCADE clause is used.
Default and on update expressions are copied into domains and columns that use this domain and don't have own
expressions. Domain constraints are copied into domains that use this domain and to columns (as check constraints) that
use this domain.
This command commits an open transaction in this connection.
","
DROP DOMAIN EMAIL
"

"Commands (DDL)","DROP INDEX","
@h2@ DROP INDEX [ IF EXISTS ] [schemaName.]indexName
","
Drops an index.
This command commits an open transaction in this connection.
","
DROP INDEX IF EXISTS IDXNAME
"

"Commands (DDL)","DROP ROLE","
DROP ROLE @h2@ [ IF EXISTS ] roleName
","
Drops a role.
Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
DROP ROLE READONLY
"

"Commands (DDL)","DROP SCHEMA","
DROP SCHEMA @h2@ [ IF EXISTS ] schemaName [ RESTRICT | CASCADE ]
","
Drops a schema.
Schema owner rights are required to execute this command.
The command will fail if objects in this schema exist and the RESTRICT clause is used (the default).
All objects in this schema are dropped as well if the CASCADE clause is used.
This command commits an open transaction in this connection.
","
DROP SCHEMA TEST_SCHEMA
"

"Commands (DDL)","DROP SEQUENCE","
DROP SEQUENCE @h2@ [ IF EXISTS ] [schemaName.]sequenceName
","
Drops a sequence.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
DROP SEQUENCE SEQ_ID
"

"Commands (DDL)","DROP TABLE","
DROP TABLE @h2@ [ IF EXISTS ] [schemaName.]tableName @h2@ [,...]
[ RESTRICT | CASCADE ]
","
Drops an existing table, or a list of tables.
The command will fail if dependent objects exist and the RESTRICT clause is used (the default).
All dependent views and constraints are dropped as well if the CASCADE clause is used.
This command commits an open transaction in this connection.
","
DROP TABLE TEST
"

"Commands (DDL)","DROP TRIGGER","
DROP TRIGGER @h2@ [ IF EXISTS ] [schemaName.]triggerName
","
Drops an existing trigger.
This command commits an open transaction in this connection.
","
DROP TRIGGER TRIG_INS
"

"Commands (DDL)","DROP USER","
@h2@ DROP USER [ IF EXISTS ] userName
","
Drops a user. The current user cannot be dropped.
For compatibility, only unquoted or uppercase user names are allowed.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
DROP USER TOM
"

"Commands (DDL)","DROP VIEW","
DROP VIEW @h2@ [ IF EXISTS ] [schemaName.]viewName [ RESTRICT | CASCADE ]
","
Drops an existing view.
Schema owner rights are required to execute this command.
All dependent views are dropped as well if the CASCADE clause is used (the default).
The command will fail if dependent views exist and the RESTRICT clause is used.
This command commits an open transaction in this connection.
","
DROP VIEW TEST_VIEW
"

"Commands (DDL)","DROP MATERIALIZED VIEW","
@h2@ DROP MATERIALIZED VIEW [ IF EXISTS ] [schemaName.]viewName
","
Drops an existing materialized view.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
DROP MATERIALIZED VIEW TEST_VIEW
"

"Commands (DDL)","REFRESH MATERIALIZED VIEW","
@h2@ REFRESH MATERIALIZED VIEW [ IF EXISTS ] [schemaName.]viewName
","
Recreates an existing materialized view.
Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
REFRESH MATERIALIZED VIEW TEST_VIEW
"

"Commands (DDL)","TRUNCATE TABLE","
TRUNCATE TABLE [schemaName.]tableName [ [ CONTINUE | RESTART ] IDENTITY ]
","
Removes all rows from a table.
Unlike DELETE FROM without where clause, this command can not be rolled back.
This command is faster than DELETE without where clause.
Only regular data tables without foreign key constraints can be truncated
(except if referential integrity is disabled for this database or for this table).
Linked tables can't be truncated.
If RESTART IDENTITY is specified next values for identity columns are restarted.

This command commits an open transaction in this connection.
","
TRUNCATE TABLE TEST
"

"Commands (Other)","CHECKPOINT","
@h2@ CHECKPOINT
","
Flushes the data to disk.

Admin rights are required to execute this command.
","
CHECKPOINT
"

"Commands (Other)","CHECKPOINT SYNC","
@h2@ CHECKPOINT SYNC
","
Flushes the data to disk and forces all system buffers be written
to the underlying device.

Admin rights are required to execute this command.
","
CHECKPOINT SYNC
"

"Commands (Other)","COMMIT","
COMMIT [ WORK ]
","
Commits a transaction.
","
COMMIT
"

"Commands (Other)","COMMIT TRANSACTION","
@h2@ COMMIT TRANSACTION transactionName
","
Sets the resolution of an in-doubt transaction to 'commit'.

Admin rights are required to execute this command.
This command is part of the 2-phase-commit protocol.
","
COMMIT TRANSACTION XID_TEST
"

"Commands (Other)","GRANT RIGHT","
GRANT { { SELECT | INSERT | UPDATE | DELETE } [,..] | ALL [ PRIVILEGES ] } ON
{ @h2@ { SCHEMA schemaName } | { [ TABLE ] [schemaName.]tableName @h2@ [,...] } }
TO { PUBLIC | userName | roleName }
","
Grants rights for a table to a user or role.

Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
GRANT SELECT ON TEST TO READONLY
"

"Commands (Other)","GRANT ALTER ANY SCHEMA","
@h2@ GRANT ALTER ANY SCHEMA TO userName
","
Grant schema admin rights to a user.

Schema admin can create, rename, or drop schemas and also has schema owner rights in every schema.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
GRANT ALTER ANY SCHEMA TO Bob
"

"Commands (Other)","GRANT ROLE","
GRANT { roleName [,...] } TO { PUBLIC | userName | roleName }
","
Grants a role to a user or role.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
GRANT READONLY TO PUBLIC
"

"Commands (Other)","HELP","
@h2@ HELP [ anything [...] ]
","
Displays the help pages of SQL commands or keywords.
","
HELP SELECT
"

"Commands (Other)","PREPARE COMMIT","
@h2@ PREPARE COMMIT newTransactionName
","
Prepares committing a transaction.
This command is part of the 2-phase-commit protocol.
","
PREPARE COMMIT XID_TEST
"

"Commands (Other)","REVOKE RIGHT","
REVOKE { { SELECT | INSERT | UPDATE | DELETE } [,..] | ALL [ PRIVILEGES ] } ON
{ @h2@ { SCHEMA schemaName } | { [ TABLE ] [schemaName.]tableName @h2@ [,...] } }
FROM { PUBLIC | userName | roleName }
","
Removes rights for a table from a user or role.

Schema owner rights are required to execute this command.
This command commits an open transaction in this connection.
","
REVOKE SELECT ON TEST FROM READONLY
"

"Commands (Other)","REVOKE ALTER ANY SCHEMA","
@h2@ REVOKE ALTER ANY SCHEMA FROM userName
","
Removes schema admin rights from a user.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
GRANT ALTER ANY SCHEMA TO Bob
"

"Commands (Other)","REVOKE ROLE","
REVOKE { roleName [,...] } FROM { PUBLIC | userName | roleName }
","
Removes a role from a user or role.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
REVOKE READONLY FROM TOM
"

"Commands (Other)","ROLLBACK","
ROLLBACK [ WORK ] [ TO SAVEPOINT savepointName ]
","
Rolls back a transaction. If a savepoint name is used, the transaction is only
rolled back to the specified savepoint.
","
ROLLBACK
"

"Commands (Other)","ROLLBACK TRANSACTION","
@h2@ ROLLBACK TRANSACTION transactionName
","
Sets the resolution of an in-doubt transaction to 'rollback'.

Admin rights are required to execute this command.
This command is part of the 2-phase-commit protocol.
","
ROLLBACK TRANSACTION XID_TEST
"

"Commands (Other)","SAVEPOINT","
SAVEPOINT savepointName
","
Create a new savepoint. See also ROLLBACK.
Savepoints are only valid until the transaction is committed or rolled back.
","
SAVEPOINT HALF_DONE
"

"Commands (Other)","SET @","
@h2@ SET @variableName [ = ] expression
","
Updates a user-defined variable.
Variables are not persisted and session scoped, that means only visible from within the session in which they are defined.
This command does not commit a transaction, and rollback does not affect it.
","
SET @TOTAL=0
"

"Commands (Other)","SET ALLOW_LITERALS","
@h2@ SET ALLOW_LITERALS { NONE | ALL | NUMBERS }
","
This setting can help solve the SQL injection problem. By default, text and
number literals are allowed in SQL statements. However, this enables SQL
injection if the application dynamically builds SQL statements. SQL injection is
not possible if user data is set using parameters ('?').

NONE means literals of any kind are not allowed, only parameters and constants
are allowed. NUMBERS mean only numerical and boolean literals are allowed. ALL
means all literals are allowed (default).

See also CREATE CONSTANT.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;ALLOW_LITERALS=NONE""
","
SET ALLOW_LITERALS NONE
"

"Commands (Other)","SET AUTOCOMMIT","
@h2@ SET AUTOCOMMIT { TRUE | ON | FALSE | OFF }
","
Switches auto commit on or off.
This setting can be appended to the database URL: ""jdbc:h2:./test;AUTOCOMMIT=OFF"" -
however this will not work as expected when using a connection pool
(the connection pool manager will re-enable autocommit when returning
the connection to the pool, so autocommit will only be disabled the first
time the connection is used.
","
SET AUTOCOMMIT OFF
"

"Commands (Other)","SET CACHE_SIZE","
@h2@ SET CACHE_SIZE int
","
Sets the size of the cache in KB (each KB being 1024 bytes) for the current database.
The default is 65536 per available GB of RAM, i.e. 64 MB per GB.
The value is rounded to the next higher power of two.
Depending on the virtual machine, the actual memory required may be higher.

This setting is persistent and affects all connections as there is only one cache per database.
Using a very small value (specially 0) will reduce performance a lot.
This setting only affects the database engine (the server in a client/server environment;
in embedded mode, the database engine is in the same process as the application).
It has no effect for in-memory databases.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;CACHE_SIZE=8192""
","
SET CACHE_SIZE 8192
"

"Commands (Other)","SET CLUSTER","
@h2@ SET CLUSTER serverListString
","
This command should not be used directly by an application, the statement is
executed automatically by the system. The behavior may change in future
releases. Sets the cluster server list. An empty string switches off the cluster
mode. Switching on the cluster mode requires admin rights, but any user can
switch it off (this is automatically done when the client detects the other
server is not responding).

This command is effective immediately, but does not commit an open transaction.
","
SET CLUSTER ''
"

"Commands (Other)","SET BUILTIN_ALIAS_OVERRIDE","
@h2@ SET BUILTIN_ALIAS_OVERRIDE { TRUE | FALSE }
","
Allows the overriding of the builtin system date/time functions
for unit testing purposes.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
SET BUILTIN_ALIAS_OVERRIDE TRUE
"

"Commands (Other)","SET CATALOG","
SET CATALOG { catalogString | @h2@ { catalogName } }
","
This command has no effect if the specified name matches the name of the database, otherwise it throws an exception.

This command does not commit a transaction.
","
SET CATALOG 'DB'
SET CATALOG DB_NAME
"

"Commands (Other)","SET COLLATION","
@h2@ SET [ DATABASE ] COLLATION
@h2@ { OFF | collationName
    [ STRENGTH { PRIMARY | SECONDARY | TERTIARY | IDENTICAL } ] }
","
Sets the collation used for comparing strings.
This command can only be executed if there are no tables defined.
See ""java.text.Collator"" for details about the supported collations and the STRENGTH
(PRIMARY is usually case- and umlaut-insensitive; SECONDARY is case-insensitive but umlaut-sensitive;
TERTIARY is both case- and umlaut-sensitive; IDENTICAL is sensitive to all differences and only affects ordering).

The ICU4J collator is used if it is in the classpath.
It is also used if the collation name starts with ICU4J_
(in that case, the ICU4J must be in the classpath, otherwise an exception is thrown).
The default collator is used if the collation name starts with DEFAULT_
(even if ICU4J is in the classpath).
The charset collator is used if the collation name starts with CHARSET_ (e.g. CHARSET_CP500). This collator sorts
strings according to the binary representation in the given charset.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;COLLATION='ENGLISH'""
","
SET COLLATION ENGLISH
SET COLLATION CHARSET_CP500
"

"Commands (Other)","SET DATABASE_EVENT_LISTENER","
@h2@ SET DATABASE_EVENT_LISTENER classNameString
","
Sets the event listener class. An empty string ('') means no listener should be
used. This setting is not persistent.

Admin rights are required to execute this command, except if it is set when
opening the database (in this case it is reset just after opening the database).
This setting can be appended to the database URL: ""jdbc:h2:./test;DATABASE_EVENT_LISTENER='sample.MyListener'""
","
SET DATABASE_EVENT_LISTENER 'sample.MyListener'
"

"Commands (Other)","SET DB_CLOSE_DELAY","
@h2@ SET DB_CLOSE_DELAY int
","
Sets the delay for closing a database if all connections are closed.
The value -1 means the database is never closed until the close delay is set to some other value or SHUTDOWN is called.
The value 0 means no delay (default; the database is closed if the last connection to it is closed).
Values 1 and larger mean the number of seconds the database is left open after closing the last connection.

If the application exits normally or System.exit is called, the database is closed immediately, even if a delay is set.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;DB_CLOSE_DELAY=-1""
","
SET DB_CLOSE_DELAY -1
"

"Commands (Other)","SET DEFAULT_LOCK_TIMEOUT","
@h2@ SET DEFAULT LOCK_TIMEOUT int
","
Sets the default lock timeout (in milliseconds) in this database that is used
for the new sessions. The default value for this setting is 1000 (one second).

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
","
SET DEFAULT_LOCK_TIMEOUT 5000
"

"Commands (Other)","SET DEFAULT_NULL_ORDERING","
@h2@ SET DEFAULT_NULL_ORDERING { LOW | HIGH | FIRST | LAST }
","
Changes the default ordering of NULL values.
This setting affects new indexes without explicit NULLS FIRST or NULLS LAST columns,
and ordering clauses of other commands without explicit null ordering.
This setting doesn't affect ordering of NULL values inside ARRAY or ROW values
(""ARRAY[NULL]"" is always considered as smaller than ""ARRAY[1]"" during sorting).

LOW is the default one, NULL values are considered as smaller than other values during sorting.

With HIGH default ordering NULL values are considered as larger than other values during sorting.

With FIRST default ordering NULL values are sorted before other values,
no matter if ascending or descending order is used.

WITH LAST default ordering NULL values are sorted after other values,
no matter if ascending or descending order is used.

This setting is not persistent, but indexes are persisted with explicit NULLS FIRST or NULLS LAST ordering
and aren't affected by changes in this setting.
Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting can be appended to the database URL: ""jdbc:h2:./test;DEFAULT_NULL_ORDERING=HIGH""
","
SET DEFAULT_NULL_ORDERING HIGH
"

"Commands (Other)","SET DEFAULT_TABLE_TYPE","
@h2@ SET DEFAULT_TABLE_TYPE { MEMORY | CACHED }
","
Sets the default table storage type that is used when creating new tables.
Memory tables are kept fully in the main memory (including indexes), however
the data is still stored in the database file. The size of memory tables is
limited by the memory. The default is CACHED.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
It has no effect for in-memory databases.
","
SET DEFAULT_TABLE_TYPE MEMORY
"

"Commands (Other)","SET EXCLUSIVE","
@h2@ SET EXCLUSIVE { 0 | 1 | 2 }
","
Switched the database to exclusive mode (1, 2) and back to normal mode (0).

In exclusive mode, new connections are rejected, and operations by
other connections are paused until the exclusive mode is disabled.
When using the value 1, existing connections stay open.
When using the value 2, all existing connections are closed
(and current transactions are rolled back) except the connection
that executes SET EXCLUSIVE.
Only the connection that set the exclusive mode can disable it.
When the connection is closed, it is automatically disabled.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
","
SET EXCLUSIVE 1
"

"Commands (Other)","SET IGNORECASE","
@h2@ SET IGNORECASE { TRUE | FALSE }
","
If IGNORECASE is enabled, text columns in newly created tables will be
case-insensitive. Already existing tables are not affected. The effect of
case-insensitive columns is similar to using a collation with strength PRIMARY.
Case-insensitive columns are compared faster than when using a collation.
String literals and parameters are however still considered case sensitive even if this option is set.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;IGNORECASE=TRUE""
","
SET IGNORECASE TRUE
"

"Commands (Other)","SET IGNORE_CATALOGS","
@c@ SET IGNORE_CATALOGS { TRUE | FALSE }
","
If IGNORE_CATALOGS is enabled, catalog names in front of schema names will be ignored. This can be used if
multiple catalogs used by the same connections must be simulated. Caveat: if both catalogs contain schemas of the
same name and if those schemas contain objects of the same name, this will lead to errors, when trying to manage,
access or change these objects.
This setting can be appended to the database URL: ""jdbc:h2:./test;IGNORE_CATALOGS=TRUE""
","
SET IGNORE_CATALOGS TRUE
"

"Commands (Other)","SET JAVA_OBJECT_SERIALIZER","
@h2@ SET JAVA_OBJECT_SERIALIZER { null | className }
","
Sets the object used to serialize and deserialize java objects being stored in column of type OTHER.
The serializer class must be public and implement ""org.h2.api.JavaObjectSerializer"".
Inner classes are not supported.
The class must be available in the classpath of the database engine
(when using the server mode, it must be both in the classpath of the server and the client).
This command can only be executed if there are no tables defined.

Admin rights are required to execute this command.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;JAVA_OBJECT_SERIALIZER='com.acme.SerializerClassName'""
","
SET JAVA_OBJECT_SERIALIZER 'com.acme.SerializerClassName'
"

"Commands (Other)","SET LAZY_QUERY_EXECUTION","
@h2@ SET LAZY_QUERY_EXECUTION int
","
Sets the lazy query execution mode. The values 0, 1 are supported.

If true, then large results are retrieved in chunks.

Note that not all queries support this feature, queries which do not are processed normally.

This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;LAZY_QUERY_EXECUTION=1""
","
SET LAZY_QUERY_EXECUTION 1
"

"Commands (Other)","SET LOCK_MODE","
@h2@ SET LOCK_MODE int
","
Sets the lock mode. The values 0, 1, 2, and 3 are supported. The default is 3.
This setting affects all connections.

The value 0 means no locking (should only be used for testing).
Please note that using SET LOCK_MODE 0 while at the same time
using multiple connections may result in inconsistent transactions.

The value 3 means row-level locking for write operations.

The values 1 and 2 have the same effect as 3.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;LOCK_MODE=0""
","
SET LOCK_MODE 0
"

"Commands (Other)","SET LOCK_TIMEOUT","
@h2@ SET LOCK_TIMEOUT int
","
Sets the lock timeout (in milliseconds) for the current session. The default
value for this setting is 1000 (one second).

This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;LOCK_TIMEOUT=10000""
","
SET LOCK_TIMEOUT 1000
"

"Commands (Other)","SET MAX_LENGTH_INPLACE_LOB","
@h2@ SET MAX_LENGTH_INPLACE_LOB int
","
Sets the maximum size of an in-place LOB object.

This is the maximum length of an LOB that is stored with the record itself,
and the default value is 256.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
","
SET MAX_LENGTH_INPLACE_LOB 128
"

"Commands (Other)","SET MAX_LOG_SIZE","
@h2@ SET MAX_LOG_SIZE int
","
Sets the maximum size of the transaction log, in megabytes.
If the log is larger, and if there is no open transaction, the transaction log is truncated.
If there is an open transaction, the transaction log will continue to grow however.
The default max size is 16 MB.
This setting has no effect for in-memory databases.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
","
SET MAX_LOG_SIZE 2
"

"Commands (Other)","SET MAX_MEMORY_ROWS","
@h2@ SET MAX_MEMORY_ROWS int
","
The maximum number of rows in a result set that are kept in-memory. If more rows
are read, then the rows are buffered to disk.
The default is 40000 per GB of available RAM.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
It has no effect for in-memory databases.
","
SET MAX_MEMORY_ROWS 1000
"

"Commands (Other)","SET MAX_MEMORY_UNDO","
@h2@ SET MAX_MEMORY_UNDO int
","
The maximum number of undo records per a session that are kept in-memory.
If a transaction is larger, the records are buffered to disk.
The default value is 50000.
Changes to tables without a primary key can not be buffered to disk.
This setting is not supported when using multi-version concurrency.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
It has no effect for in-memory databases.
","
SET MAX_MEMORY_UNDO 1000
"

"Commands (Other)","SET MAX_OPERATION_MEMORY","
@h2@ SET MAX_OPERATION_MEMORY int
","
Sets the maximum memory used for large operations (delete and insert), in bytes.
Operations that use more memory are buffered to disk, slowing down the
operation. The default max size is 100000. 0 means no limit.

This setting is not persistent.
Admin rights are required to execute this command, as it affects all connections.
It has no effect for in-memory databases.
This setting can be appended to the database URL: ""jdbc:h2:./test;MAX_OPERATION_MEMORY=10000""
","
SET MAX_OPERATION_MEMORY 0
"

"Commands (Other)","SET MODE","
@h2@ SET MODE { REGULAR | STRICT | LEGACY | DB2 | DERBY | HSQLDB | MSSQLSERVER | MYSQL | ORACLE | POSTGRESQL }
","
Changes to another database compatibility mode. For details, see
[Compatibility Modes](https://h2database.com/html/features.html#compatibility_modes).

This setting is not persistent.
Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting can be appended to the database URL: ""jdbc:h2:./test;MODE=MYSQL""
","
SET MODE HSQLDB
"

"Commands (Other)","SET NON_KEYWORDS","
@h2@ SET NON_KEYWORDS [ name [,...] ]
","
Converts the specified tokens from keywords to plain identifiers for the current session.
This setting may break some commands and should be used with caution and only when necessary.
Use [quoted identifiers](https://h2database.com/html/grammar.html#quoted_name) instead of this setting if possible.

This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;NON_KEYWORDS=KEY,VALUE""
","
SET NON_KEYWORDS KEY, VALUE
"

"Commands (Other)","SET OPTIMIZE_REUSE_RESULTS","
@h2@ SET OPTIMIZE_REUSE_RESULTS { 0 | 1 }
","
Enabled (1) or disabled (0) the result reuse optimization. If enabled,
subqueries and views used as subqueries are only re-run if the data in one of
the tables was changed. This option is enabled by default.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting can be appended to the database URL: ""jdbc:h2:./test;OPTIMIZE_REUSE_RESULTS=0""
","
SET OPTIMIZE_REUSE_RESULTS 0
"

"Commands (Other)","SET PASSWORD","
@h2@ SET PASSWORD string
","
Changes the password of the current user. The password must be in single quotes.
It is case sensitive and can contain spaces.

This command commits an open transaction in this connection.
","
SET PASSWORD 'abcstzri!.5'
"

"Commands (Other)","SET QUERY_STATISTICS","
@h2@ SET QUERY_STATISTICS { TRUE | FALSE }
","
Disabled or enables query statistics gathering for the whole database.
The statistics are reflected in the INFORMATION_SCHEMA.QUERY_STATISTICS meta-table.

This setting is not persistent.
This command commits an open transaction in this connection.
Admin rights are required to execute this command, as it affects all connections.
","
SET QUERY_STATISTICS FALSE
"

"Commands (Other)","SET QUERY_STATISTICS_MAX_ENTRIES","
@h2@ SET QUERY_STATISTICS int
","
Set the maximum number of entries in query statistics meta-table.
Default value is 100.

This setting is not persistent.
This command commits an open transaction in this connection.
Admin rights are required to execute this command, as it affects all connections.
","
SET QUERY_STATISTICS_MAX_ENTRIES 500
"

"Commands (Other)","SET QUERY_TIMEOUT","
@h2@ SET QUERY_TIMEOUT int
","
Set the query timeout of the current session to the given value. The timeout is
in milliseconds. All kinds of statements will throw an exception if they take
longer than the given value. The default timeout is 0, meaning no timeout.

This command does not commit a transaction, and rollback does not affect it.
","
SET QUERY_TIMEOUT 10000
"

"Commands (Other)","SET REFERENTIAL_INTEGRITY","
@h2@ SET REFERENTIAL_INTEGRITY { TRUE | FALSE }
","
Disabled or enables referential integrity checking for the whole database.
Enabling it does not check existing data. Use ALTER TABLE SET to disable it only
for one table.

This setting is not persistent.
This command commits an open transaction in this connection.
Admin rights are required to execute this command, as it affects all connections.
","
SET REFERENTIAL_INTEGRITY FALSE
"

"Commands (Other)","SET RETENTION_TIME","
@h2@ SET RETENTION_TIME int
","
How long to retain old, persisted data, in milliseconds.
The default is 45000 (45 seconds), 0 means overwrite data as early as possible.
It is assumed that a file system and hard disk will flush all write buffers within this time.
Using a lower value might be dangerous, unless the file system and hard disk flush the buffers earlier.
To manually flush the buffers, use CHECKPOINT SYNC,
however please note that according to various tests this does not always work as expected
depending on the operating system and hardware.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting is persistent.
This setting can be appended to the database URL: ""jdbc:h2:./test;RETENTION_TIME=0""
","
SET RETENTION_TIME 0
"

"Commands (Other)","SET SALT HASH","
@h2@ SET SALT bytes HASH bytes
","
Sets the password salt and hash for the current user. The password must be in
single quotes. It is case sensitive and can contain spaces.

This command commits an open transaction in this connection.
","
SET SALT '00' HASH '1122'
"

"Commands (Other)","SET SCHEMA","
SET SCHEMA { schemaString | @h2@ { schemaName } }
","
Changes the default schema of the current connection. The default schema is used
in statements where no schema is set explicitly. The default schema for new
connections is PUBLIC.

This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;SCHEMA=ABC""
","
SET SCHEMA 'PUBLIC'
SET SCHEMA INFORMATION_SCHEMA
"

"Commands (Other)","SET SCHEMA_SEARCH_PATH","
@h2@ SET SCHEMA_SEARCH_PATH schemaName [,...]
","
Changes the schema search path of the current connection. The default schema is
used in statements where no schema is set explicitly. The default schema for new
connections is PUBLIC.

This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;SCHEMA_SEARCH_PATH=ABC,DEF""
","
SET SCHEMA_SEARCH_PATH INFORMATION_SCHEMA, PUBLIC
"

"Commands (Other)","SET SESSION CHARACTERISTICS","
SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
{ READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE }
","
Changes the transaction isolation level of the current session.
The actual support of isolation levels depends on the database engine.

This command commits an open transaction in this session.
","
SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE
"

"Commands (Other)","SET THROTTLE","
@h2@ SET THROTTLE int
","
Sets the throttle for the current connection. The value is the number of
milliseconds delay after each 50 ms. The default value is 0 (throttling
disabled).

This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;THROTTLE=50""
","
SET THROTTLE 200
"

"Commands (Other)","SET TIME ZONE","
SET TIME ZONE { LOCAL | intervalHourToMinute | @h2@  { intervalHourToSecond | string } }
","
Sets the current time zone for the session.

This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;TIME ZONE='1:00'""

Time zone offset used for [CURRENT_TIME](https://h2database.com/html/functions.html#current_time),
[CURRENT_TIMESTAMP](https://h2database.com/html/functions.html#current_timestamp),
[CURRENT_DATE](https://h2database.com/html/functions.html#current_date),
[LOCALTIME](https://h2database.com/html/functions.html#localtime),
and [LOCALTIMESTAMP](https://h2database.com/html/functions.html#localtimestamp) is adjusted,
so these functions will return new values based on the same UTC timestamp after execution of this command.
","
SET TIME ZONE LOCAL
SET TIME ZONE '-5:00'
SET TIME ZONE INTERVAL '1:00' HOUR TO MINUTE
SET TIME ZONE 'Europe/London'
"

"Commands (Other)","SET TRACE_LEVEL","
@h2@ SET { TRACE_LEVEL_FILE | TRACE_LEVEL_SYSTEM_OUT } int
","
Sets the trace level for file the file or system out stream. Levels are: 0=off,
1=error, 2=info, 3=debug. The default level is 1 for file and 0 for system out.
To use SLF4J, append "";TRACE_LEVEL_FILE=4"" to the database URL when opening the database.

This setting is not persistent.
Admin rights are required to execute this command, as it affects all connections.
This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: ""jdbc:h2:./test;TRACE_LEVEL_SYSTEM_OUT=3""
","
SET TRACE_LEVEL_SYSTEM_OUT 3
"

"Commands (Other)","SET TRACE_MAX_FILE_SIZE","
@h2@ SET TRACE_MAX_FILE_SIZE int
","
Sets the maximum trace file size. If the file exceeds the limit, the file is
renamed to .old and a new file is created. If another .old file exists, it is
deleted. The default max size is 16 MB.

This setting is persistent.
Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting can be appended to the database URL: ""jdbc:h2:./test;TRACE_MAX_FILE_SIZE=3""
","
SET TRACE_MAX_FILE_SIZE 10
"

"Commands (Other)","SET TRUNCATE_LARGE_LENGTH","
@h2@ SET TRUNCATE_LARGE_LENGTH { TRUE | FALSE }
","
If ""TRUE"" is specified, the ""CHARACTER"", ""CHARACTER VARYING"", ""VARCHAR_IGNORECASE"", ""BINARY"",
"BINARY_VARYING", "JAVA_OBJECT"" and ""JSON"" data types with too large length will be treated as these data types with
maximum allowed length instead.
By default, or if ""FALSE"" is specified, such definitions throw an exception.
This setting can be used for compatibility with definitions from older versions of H2.

This setting can be appended to the database URL: ""jdbc:h2:./test;TRUNCATE_LARGE_LENGTH=TRUE""
","
SET TRUNCATE_LARGE_LENGTH TRUE
"

"Commands (Other)","SET VARIABLE_BINARY","
@h2@ SET VARIABLE_BINARY { TRUE | FALSE }
","
If ""TRUE"" is specified, the ""BINARY"" data type will be parsed as ""VARBINARY"" in the current session.
It can be used for compatibility with older versions of H2.

This setting can be appended to the database URL: ""jdbc:h2:./test;VARIABLE_BINARY=TRUE""
","
SET VARIABLE_BINARY TRUE
"

"Commands (Other)","SET WRITE_DELAY","
@h2@ SET WRITE_DELAY int
","
Set the maximum delay between a commit and flushing the log, in milliseconds.
This setting is persistent. The default is 500 ms.

Admin rights are required to execute this command, as it affects all connections.
This command commits an open transaction in this connection.
This setting can be appended to the database URL: ""jdbc:h2:./test;WRITE_DELAY=0""
","
SET WRITE_DELAY 2000
"

"Commands (Other)","SHUTDOWN","
@h2@ SHUTDOWN [ IMMEDIATELY | COMPACT | DEFRAG ]
","
This statement closes all open connections to the database and closes the
database. This command is usually not required, as the database is
closed automatically when the last connection to it is closed.

If no option is used, then the database is closed normally.
All connections are closed, open transactions are rolled back.

SHUTDOWN COMPACT fully compacts the database (re-creating the database may further reduce the database size).
If the database is closed normally (using SHUTDOWN or by closing all connections), then the database is also compacted,
but only for at most the time defined by the database setting ""h2.maxCompactTime"" in milliseconds (see there).

SHUTDOWN IMMEDIATELY closes the database files without any cleanup and without compacting.

SHUTDOWN DEFRAG is currently equivalent to COMPACT.

Admin rights are required to execute this command.
","
SHUTDOWN COMPACT
"

"Literals","Value","
string | @h2@ { dollarQuotedString } | numeric | dateAndTime | boolean | bytes
    | interval | array | @h2@ { geometry | json | uuid } | null
","
A literal value of any data type, or null.
","
10
"

"Literals","Approximate numeric","
[ + | - ] { { number [ . [ number ] ] } | { . number } }
E [ + | - ] expNumber
","
An approximate numeric value.
Approximate numeric values have [DECFLOAT](https://h2database.com/html/datatypes.html#decfloat_type) data type.
To define a [DOUBLE PRECISION](https://h2database.com/html/datatypes.html#double_precision_type) value, use
""CAST(X AS DOUBLE PRECISION)"".
To define a [REAL](https://h2database.com/html/datatypes.html#real_type) value, use ""CAST(X AS REAL)"".
There are some special REAL, DOUBLE PRECISION, and DECFLOAT values:
to represent positive infinity, use ""CAST('Infinity' AS dataType)"";
for negative infinity, use ""CAST('-Infinity' AS dataType)"";
for ""NaN"" (not a number), use ""CAST('NaN' AS dataType)"".
","
-1.4e-10
1.111_111E3
CAST(1e2 AS REAL)
CAST('NaN' AS DOUBLE PRECISION)
"

"Literals","Array","
ARRAY '[' [ expression [,...] ] ']'
","
An array of values.
","
ARRAY[1, 2]
ARRAY[1]
ARRAY[]
"

"Literals","Boolean","
TRUE | FALSE | UNKNOWN
","
A boolean value.
UNKNOWN is a NULL value with the boolean data type.
","
TRUE
"

"Literals","Bytes","
X'hex' [ 'hex' [...] ]
","
A binary string value. The hex value is not case sensitive and may contain space characters as separators.
If there are more than one group of quoted hex values, groups must be separated with whitespace.
","
X''
X'01FF'
X'01 bc 2a'
X'01' '02'
"

"Literals","Date","
DATE '[-]yyyy-MM-dd'
","
A date literal.
","
DATE '2004-12-31'
"

"Literals","Date and time","
date | time | timeWithTimeZone | timestamp | timestampWithTimeZone
","
A literal value of any date-time data type.
","
TIMESTAMP '1999-01-31 10:00:00'
"

"Literals","Dollar Quoted String","
@h2@ $$anythingExceptTwoDollarSigns$$
","
A string starts and ends with two dollar signs. Two dollar signs are not allowed
within the text. A whitespace is required before the first set of dollar signs.
No escaping is required within the text.
","
$$John's car$$
"

"Literals","Exact numeric","
[ + | - ] { { number [ . number ] } | { . number } }
","
An exact numeric value.
Exact numeric values with dot have [NUMERIC](https://h2database.com/html/datatypes.html#numeric_type) data type, values
without dot small enough to fit into [INTEGER](https://h2database.com/html/datatypes.html#integer_type) data type have
this type, larger values small enough to fit into [BIGINT](https://h2database.com/html/datatypes.html#bigint_type) data
type have this type, others also have NUMERIC data type.
","
-1600.05
134_518.235_114
"

"Literals","Hex Number","
[+|-] {0x|0X} { [_] { digit | a-f | A-F } [...] } [...]
","
A number written in hexadecimal notation.
","
0xff
0x_ABCD_1234
"

"Literals","Octal Number","
[+|-] {0o|0O} { [_] { 0-7 } [...] } [...]
","
A number written in octal notation.
","
0o664
0o_123_777
"

"Literals","Binary Number","
[+|-] {0b|0B} { [_] { 0-1 } [...] } [...]
","
A number written in binary notation.
","
0b101
0b_01010101_10101010
"

"Literals","Int","
[ + | - ] number
","
The maximum integer number is 2147483647, the minimum is -2147483648.
","
10
65_536
"

"Literals","GEOMETRY","
@h2@ GEOMETRY { bytes | string }
","
A binary string or character string with GEOMETRY object.

A binary string should contain Well-known Binary Representation (WKB) from OGC 06-103r4.
Dimension system marks may be specified either in both OGC WKB or in PostGIS EWKB formats.
Optional SRID from EWKB may be specified.
POINT EMPTY stored with NaN values as specified in OGC 12-128r15 is supported.

A character string should contain Well-known Text Representation (WKT) from OGC 06-103r4
with optional SRID from PostGIS EWKT extension.

","
GEOMETRY 'GEOMETRYCOLLECTION (POINT (1 2))'
GEOMETRY X'00000000013ff00000000000003ff0000000000000'
"

"Literals","JSON","
@h2@ JSON { bytes | string }
","
A binary or character string with a RFC 8259-compliant JSON text and data format.
JSON text is parsed into internal representation.
Order of object members is preserved as is.
Duplicate object member names are allowed.
","
JSON '{""id"":10,""name"":""What''s this?""}'
JSON '[1, ' '2]';
JSON X'7472' '7565'
"

"Literals","Long","
[ + | - ] number
","
Long numbers are between -9223372036854775808 and 9223372036854775807.
","
100000
1_000_000_000
"

"Literals","Null","
NULL
","
NULL is a value without data type and means 'unknown value'.
","
NULL
"

"Literals","Number","
digit [ [_] digit [...] ] [...]
","
The maximum length of the number depends on the data type used.
","
100
10_000
"

"Literals","Numeric","
exactNumeric | approximateNumeric | int | long | hexNumber | octalNumber | binaryNumber
","
The data type of a numeric literal is the one of numeric data types, such as NUMERIC, DECFLOAT, BIGINT, or INTEGER
depending on format and value.

An explicit CAST can be used to change the data type.
","
-1600.05
CAST(0 AS DOUBLE PRECISION)
-1.4e-10
999_999_999.999_999
"

"Literals","String","
[N]'anythingExceptSingleQuote' [...]
    | U&{'anythingExceptSingleQuote' [...]} [ UESCAPE 'singleCharacter' ]
","
A character string literal starts and ends with a single quote.
Two single quotes can be used to create a single quote inside a string.
Prefix ""N"" means a national character string literal;
H2 does not distinguish regular and national character string literals in any way, this prefix has no effect in H2.

String literals staring with ""U&"" are Unicode character string literals.
All character string literals in H2 may have Unicode characters,
but Unicode character string literals may contain Unicode escape sequences ""\0000"" or ""\+000000"",
where \ is an escape character, ""0000"" and ""000000"" are Unicode character codes in hexadecimal notation.
Optional ""UESCAPE"" clause may be used to specify another escape character,
with exception for single quote, double quote, plus sign, and hexadecimal digits (0-9, a-f, and A-F).
By default the backslash is used.
Two escape characters can be used to include a single character inside a string.
Two single quotes can be used to create a single quote inside a string.
","
'John''s car'
'A' 'B' 'C'
U&'W\00f6rter ' '\\ \+01f600 /'
U&'|00a1' UESCAPE '|'
"

"Literals","UUID","
@h2@ UUID '{ digit | a-f | A-F | - } [...]'
","
A UUID literal.
Must contain 32 hexadecimal digits. Digits may be separated with - signs.
","
UUID '12345678-1234-1234-1234-123456789ABC'
"

"Literals","Time","
TIME [ WITHOUT TIME ZONE ] 'hh:mm:ss[.nnnnnnnnn]'
","
A time literal. A value is between 0:00:00 and 23:59:59.999999999
and has nanosecond resolution.
","
TIME '23:59:59'
"

"Literals","Time with time zone","
TIME WITH TIME ZONE 'hh:mm:ss[.nnnnnnnnn]{ @h2@ { Z } | { - | + } timeZoneOffsetString}'
","
A time with time zone literal. A value is between 0:00:00 and 23:59:59.999999999
and has nanosecond resolution.
","
TIME WITH TIME ZONE '23:59:59+01'
TIME WITH TIME ZONE '10:15:30.334-03:30'
TIME WITH TIME ZONE '0:00:00Z'
"

"Literals","Timestamp","
TIMESTAMP [ WITHOUT TIME ZONE ] '[-]yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]'
","
A timestamp literal.
","
TIMESTAMP '2005-12-31 23:59:59'
"

"Literals","Timestamp with time zone","
TIMESTAMP WITH TIME ZONE '[-]yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]
[ @h2@ { Z } | { - | + } timeZoneOffsetString | @h2@ { timeZoneNameString } ]'
","
A timestamp with time zone literal.
If name of time zone is specified it will be converted to time zone offset.
","
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59Z'
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59-10:00'
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59.123+05'
TIMESTAMP WITH TIME ZONE '2005-12-31 23:59:59.123456789 Europe/London'
"

"Literals","Interval","
intervalYear | intervalMonth | intervalDay | intervalHour | intervalMinute
    | intervalSecond | intervalYearToMonth | intervalDayToHour
    | intervalDayToMinute | intervalDayToSecond | intervalHourToMinute
    | intervalHourToSecond | intervalMinuteToSecond
","
An interval literal.
","
INTERVAL '1-2' YEAR TO MONTH
"

"Literals","INTERVAL YEAR","
INTERVAL [-|+] '[-|+]yearInt' YEAR [ ( precisionInt ) ]
","
An INTERVAL YEAR literal.
If precision is specified it should be from 1 to 18.
","
INTERVAL '10' YEAR
"

"Literals","INTERVAL MONTH","
INTERVAL [-|+] '[-|+]monthInt' MONTH [ ( precisionInt ) ]
","
An INTERVAL MONTH literal.
If precision is specified it should be from 1 to 18.
","
INTERVAL '10' MONTH
"

"Literals","INTERVAL DAY","
INTERVAL [-|+] '[-|+]dayInt' DAY [ ( precisionInt ) ]
","
An INTERVAL DAY literal.
If precision is specified it should be from 1 to 18.
","
INTERVAL '10' DAY
"

"Literals","INTERVAL HOUR","
INTERVAL [-|+] '[-|+]hourInt' HOUR [ ( precisionInt ) ]
","
An INTERVAL HOUR literal.
If precision is specified it should be from 1 to 18.
","
INTERVAL '10' HOUR
"

"Literals","INTERVAL MINUTE","
INTERVAL [-|+] '[-|+]minuteInt' MINUTE [ ( precisionInt ) ]
","
An INTERVAL MINUTE literal.
If precision is specified it should be from 1 to 18.
","
INTERVAL '10' MINUTE
"

"Literals","INTERVAL SECOND","
INTERVAL [-|+] '[-|+]secondInt[.nnnnnnnnn]'
SECOND [ ( precisionInt [, fractionalPrecisionInt ] ) ]
","
An INTERVAL SECOND literal.
If precision is specified it should be from 1 to 18.
If fractional seconds precision is specified it should be from 0 to 9.
","
INTERVAL '10.123' SECOND
"

"Literals","INTERVAL YEAR TO MONTH","
INTERVAL [-|+] '[-|+]yearInt-monthInt' YEAR [ ( precisionInt ) ] TO MONTH
","
An INTERVAL YEAR TO MONTH literal.
If leading field precision is specified it should be from 1 to 18.
","
INTERVAL '1-6' YEAR TO MONTH
"

"Literals","INTERVAL DAY TO HOUR","
INTERVAL [-|+] '[-|+]dayInt hoursInt' DAY [ ( precisionInt ) ] TO HOUR
","
An INTERVAL DAY TO HOUR literal.
If leading field precision is specified it should be from 1 to 18.
","
INTERVAL '10 11' DAY TO HOUR
"

"Literals","INTERVAL DAY TO MINUTE","
INTERVAL [-|+] '[-|+]dayInt hh:mm' DAY [ ( precisionInt ) ] TO MINUTE
","
An INTERVAL DAY TO MINUTE literal.
If leading field precision is specified it should be from 1 to 18.
","
INTERVAL '10 11:12' DAY TO MINUTE
"

"Literals","INTERVAL DAY TO SECOND","
INTERVAL [-|+] '[-|+]dayInt hh:mm:ss[.nnnnnnnnn]' DAY [ ( precisionInt ) ]
TO SECOND [ ( fractionalPrecisionInt ) ]
","
An INTERVAL DAY TO SECOND literal.
If leading field precision is specified it should be from 1 to 18.
If fractional seconds precision is specified it should be from 0 to 9.
","
INTERVAL '10 11:12:13.123' DAY TO SECOND
"

"Literals","INTERVAL HOUR TO MINUTE","
INTERVAL [-|+] '[-|+]hh:mm' HOUR [ ( precisionInt ) ] TO MINUTE
","
An INTERVAL HOUR TO MINUTE literal.
If leading field precision is specified it should be from 1 to 18.
","
INTERVAL '10:11' HOUR TO MINUTE
"

"Literals","INTERVAL HOUR TO SECOND","
INTERVAL [-|+] '[-|+]hh:mm:ss[.nnnnnnnnn]' HOUR [ ( precisionInt ) ]
TO SECOND [ ( fractionalPrecisionInt ) ]
","
An INTERVAL HOUR TO SECOND literal.
If leading field precision is specified it should be from 1 to 18.
If fractional seconds precision is specified it should be from 0 to 9.
","
INTERVAL '10:11:12.123' HOUR TO SECOND
"

"Literals","INTERVAL MINUTE TO SECOND","
INTERVAL [-|+] '[-|+]mm:ss[.nnnnnnnnn]' MINUTE [ ( precisionInt ) ]
TO SECOND [ ( fractionalPrecisionInt ) ]
","
An INTERVAL MINUTE TO SECOND literal.
If leading field precision is specified it should be from 1 to 18.
If fractional seconds precision is specified it should be from 0 to 9.
","
INTERVAL '11:12.123' MINUTE TO SECOND
"

"Datetime fields","Datetime field","
yearField | monthField | dayOfMonthField
    | hourField | minuteField | secondField
    | timezoneHourField | timezoneMinuteField
    | @h2@ { timezoneSecondField
    | millenniumField | centuryField | decadeField
    | quarterField
    | millisecondField | microsecondField | nanosecondField
    | dayOfYearField
    | isoDayOfWeekField | isoWeekField | isoWeekYearField
    | dayOfWeekField | weekField | weekYearField
    | epochField }
","
Fields for EXTRACT, DATEADD, DATEDIFF, and DATE_TRUNC functions.
","
YEAR
"

"Datetime fields","Year field","
YEAR | @c@ { YYYY | YY | SQL_TSI_YEAR }
","
Year.
","
YEAR
"

"Datetime fields","Month field","
MONTH | @c@ { MM | M | SQL_TSI_MONTH }
","
Month (1-12).
","
MONTH
"

"Datetime fields","Day of month field","
DAY | @c@ { DD | D | SQL_TSI_DAY }
","
Day of month (1-31).
","
DAY
"

"Datetime fields","Hour field","
HOUR | @c@ { HH | SQL_TSI_HOUR }
","
Hour (0-23).
","
HOUR
"

"Datetime fields","Minute field","
MINUTE | @c@ { MI | N | SQL_TSI_MINUTE }
","
Minute (0-59).
","
MINUTE
"

"Datetime fields","Second field","
SECOND | @c@ { SS | S | SQL_TSI_SECOND }
","
Second (0-59).
","
SECOND
"

"Datetime fields","Timezone hour field","
TIMEZONE_HOUR
","
Timezone hour (from -18 to +18).
","
TIMEZONE_HOUR
"

"Datetime fields","Timezone minute field","
TIMEZONE_MINUTE
","
Timezone minute (from -59 to +59).
","
TIMEZONE_MINUTE
"

"Datetime fields","Timezone second field","
@h2@ TIMEZONE_SECOND
","
Timezone second (from -59 to +59).
Local mean time (LMT) used in the past may have offsets with seconds.
Standard time doesn't use such offsets.
","
TIMEZONE_SECOND
"

"Datetime fields","Millennium field","
@h2@ MILLENNIUM
","
Century, or one thousand years (2001-01-01 to 3000-12-31).
","
MILLENNIUM
"

"Datetime fields","Century field","
@h2@ CENTURY
","
Century, or one hundred years (2001-01-01 to 2100-12-31).
","
CENTURY
"

"Datetime fields","Decade field","
@h2@ DECADE
","
Decade, or ten years (2020-01-01 to 2029-12-31).
","
DECADE
"

"Datetime fields","Quarter field","
@h2@ QUARTER
","
Quarter (1-4).
","
QUARTER
"

"Datetime fields","Millisecond field","
@h2@ { MILLISECOND } | @c@ { MS }
","
Millisecond (0-999).
","
MILLISECOND
"

"Datetime fields","Microsecond field","
@h2@ { MICROSECOND } | @c@ { MCS }
","
Microsecond (0-999999).
","
MICROSECOND
"

"Datetime fields","Nanosecond field","
@h2@ { NANOSECOND } | @c@ { NS }
","
Nanosecond (0-999999999).
","
NANOSECOND
"

"Datetime fields","Day of year field","
@h2@ { DAYOFYEAR | DAY_OF_YEAR } | @c@ { DOY | DY }
","
Day of year (1-366).
","
DAYOFYEAR
"

"Datetime fields","ISO day of week field","
@h2@ { ISO_DAY_OF_WEEK } | @c@ { ISODOW }
","
ISO day of week (1-7). Monday is 1.
","
ISO_DAY_OF_WEEK
"

"Datetime fields","ISO week field","
@h2@ ISO_WEEK
","
ISO week of year (1-53).
ISO definition is used when first week of year should have at least four days
and week is started with Monday.
","
ISO_WEEK
"

"Datetime fields","ISO week year field","
@h2@ { ISO_WEEK_YEAR } | @c@ { ISO_YEAR | ISOYEAR }
","
Returns the ISO week-based year from a date/time value.
","
ISO_WEEK_YEAR
"

"Datetime fields","Day of week field","
@h2@ { DAY_OF_WEEK | DAYOFWEEK } | @c@ { DOW }
","
Day of week (1-7), locale-specific.
","
DAY_OF_WEEK
"

"Datetime fields","Week field","
@h2@ { WEEK } | @c@ { WW | W | SQL_TSI_WEEK }
","
Week of year (1-53) using local rules.
","
WEEK
"

"Datetime fields","Week year field","
@h2@ { WEEK_YEAR }
","
Returns the week-based year (locale-specific) from a date/time value.
","
WEEK_YEAR
"

"Datetime fields","Epoch field","
@h2@ EPOCH
","
For TIMESTAMP values number of seconds since 1970-01-01 00:00:00 in local time zone.
For TIMESTAMP WITH TIME ZONE values number of seconds since 1970-01-01 00:00:00 in UTC time zone.
For DATE values number of seconds since 1970-01-01.
For TIME values number of seconds since midnight.
","
EPOCH
"

"Other Grammar","Alias","
name
","
An alias is a name that is only valid in the context of the statement.
","
A
"

"Other Grammar","And Condition","
condition [ { AND condition } [...] ]
","
Value or condition.
","
ID=1 AND NAME='Hi'
"

"Other Grammar","Array element reference","
{ array | json } '[' indexInt ']'
","
Returns array element at specified 1-based index.
Returns NULL if array or json is null, index is null, or element with specified index isn't found in JSON.
","
A[2]
M[5][8]
"

"Other Grammar","Field reference","
(expression).fieldName
","
Returns field value from the row value or JSON value.
Returns NULL if value is null or field with specified name isn't found in JSON.
Expression on the left must be enclosed in parentheses if it is an identifier (column name),
in other cases they aren't required.
","
(R).FIELD1
(TABLE1.COLUMN2).FIELD.SUBFIELD
JSON '{""a"": 1, ""b"": 2}'.""b""
"

"Other Grammar","Array value constructor by query","
ARRAY (query)
","
Collects values from the subquery into array.

The subquery should have exactly one column.
Number of elements in the returned array is the number of rows in the subquery.
NULL values are included into array.
","
ARRAY(SELECT * FROM SYSTEM_RANGE(1, 10));
"

"Other Grammar","Case expression","
simpleCase | searchedCase
","
Performs conditional evaluation of expressions.
","
CASE A WHEN 'a' THEN 1 ELSE 2 END
CASE WHEN V > 10 THEN 1 WHEN V < 0 THEN 2 END
CASE WHEN A IS NULL THEN 'Null' ELSE 'Not null' END
"

"Other Grammar","Simple case","
CASE expression
{ WHEN { expression | conditionRightHandSide } [,...] THEN expression } [...]
[ ELSE expression ] END
","
Returns then expression from the first when clause where one of its operands was was evaluated to ""TRUE""
for the case expression.
If there are no such clauses, returns else expression or NULL if it is absent.

Plain expressions are tested for equality with the case expression, ""NULL"" is not equal to ""NULL"".
Right sides of conditions are evaluated with the case expression on the left side.
","
CASE CNT WHEN IS NULL THEN 'Null' WHEN 0 THEN 'No' WHEN 1 THEN 'One' WHEN 2, 3 THEN 'Few' ELSE 'Some' END
"

"Other Grammar","Searched case","
CASE { WHEN expression THEN expression } [...]
[ ELSE expression ] END
","
Returns the first expression where the condition is true. If no else part is
specified, return NULL.
","
CASE WHEN CNT<10 THEN 'Low' ELSE 'High' END
CASE WHEN A IS NULL THEN 'Null' ELSE 'Not null' END
"

"Other Grammar","Cast specification","
CAST(value AS dataTypeOrDomain [ FORMAT templateString ])
","
Converts a value to another data type. The following conversion rules are used:
When converting a number to a boolean, 0 is false and every other value is true.
When converting a boolean to a number, false is 0 and true is 1.
When converting a number to a number of another type, the value is checked for overflow.
When converting a string to binary, UTF-8 encoding is used.
Note that some data types may need explicitly specified precision to avoid overflow or rounding.

Template may only be specified for casts from datetime data types to character string data types
and for casts from character string data types to datetime data types.

'-', '.', '/', ',', '''', ';', ':' and ' ' (space) characters can be used as delimiters.

Y, YY, YYY, YYYY represent last 1, 2, 3, or 4 digits of year.
YYYY, if delimited, can also be used to parse any year, including negative years.
When a year is parsed with Y, YY, or YYY pattern missing leading digits are filled using digits from the current year.

RR and RRRR have the same meaning as YY and YYYY for formatting.
When a year is parsed with RR, the resulting year is within current year - 49 years and current year + 50 years in H2,
other database systems may use different range of years.

MM represent a month.

DD represent a day of month.

DDD represent a day of year, if this pattern in specified, MM and DD may not be specified.

HH24 represent an hour (from 0 to 23).

HH and HH12 represent an hour (from 1 to 12), this pattern may only be used together with A.M. or P.M. pattern.
These patterns may not be used together with HH24.

MI represent minutes.

SS represent seconds of minute.

SSSSS represent seconds of day, this pattern may not be used together with HH24, HH (HH12), A.M. (P.M.), MI or SS pattern.

FF1, FF2, ..., FF9 represent fractional seconds.

TZH, TZM and TZH represent hours, minutes and seconds of time zone offset.

Multiple patterns for the same datetime field may not be specified.

If year is not specified, current year is used. If month is not specified, current month is used. If day is not specified, 1 is used.

If some fields of time or time zone are not specified, 0 is used.

","
CAST(NAME AS INT);
CAST(TIMESTAMP '2010-01-01 10:40:00.123456' AS TIME(6));
CAST('12:00:00 P.M.' AS TIME FORMAT 'HH:MI:SS A.M.');
"

"Other Grammar","Cipher","
@h2@ AES
","
Only the algorithm AES (""AES-128"") is supported currently.
","
AES
"

"Other Grammar","Column Definition","
dataTypeOrDomain @h2@ [ VISIBLE | INVISIBLE ]
[ { DEFAULT expression
    | GENERATED ALWAYS AS (generatedColumnExpression)
    | GENERATED {ALWAYS | BY DEFAULT} AS IDENTITY [(sequenceOption [...])]} ]
@h2@ [ ON UPDATE expression ]
@h2@ [ DEFAULT ON NULL ]
@h2@ [ SELECTIVITY selectivityInt ] @h2@ [ COMMENT expression ]
[ columnConstraintDefinition ] [...]
","
The default expression is used if no explicit value was used when adding a row
and when DEFAULT value was specified in an update command.

A column is either a generated column or a base column.
The generated column has a generated column expression.
The generated column expression is evaluated and assigned whenever the row changes.
This expression may reference base columns of the table, but may not reference other data.
The value of the generated column cannot be set explicitly.
Generated columns may not have DEFAULT or ON UPDATE expressions.

On update column expression is used if row is updated,
at least one column has a new value that is different from its previous value
and value for this column is not set explicitly in update statement.

Identity column is a column generated with a sequence.
The column declared as the identity column with IDENTITY data type or with IDENTITY () clause
is implicitly the primary key column of this table.
GENERATED ALWAYS AS IDENTITY, GENERATED BY DEFAULT AS IDENTITY, and AUTO_INCREMENT clauses
do not create the primary key constraint automatically.
GENERATED ALWAYS AS IDENTITY clause indicates that column can only be generated by the sequence,
its value cannot be set explicitly.
Identity column has implicit NOT NULL constraint.
Identity column may not have DEFAULT or ON UPDATE expressions.

DEFAULT ON NULL makes NULL value work as DEFAULT value is assignments to this column.

The invisible column will not be displayed as a result of SELECT * query.
Otherwise, it works as normal column.

Column constraint definitions are not supported for ALTER statements.
","
CREATE TABLE TEST(ID INT PRIMARY KEY,
    NAME VARCHAR(255) DEFAULT '' NOT NULL);
CREATE TABLE TEST(ID BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    QUANTITY INT, PRICE NUMERIC(10, 2),
    AMOUNT NUMERIC(20, 2) GENERATED ALWAYS AS (QUANTITY * PRICE));
"

"Other Grammar","Column Constraint Definition","
[ constraintNameDefinition ]
NOT NULL | PRIMARY KEY | UNIQUE [ nullsDistinct ] | referencesSpecification | CHECK (condition)
","
NOT NULL disallows NULL value for a column.

PRIMARY KEY and UNIQUE require unique values.
PRIMARY KEY also disallows NULL values and marks the column as a primary key.
UNIQUE constraint allows NULL values, if nulls distinct clause is not specified, the default is NULLS DISTINCT,
excluding some compatibility modes.

Referential constraint requires values that exist in other column (usually in another table).

Check constraint require a specified condition to return TRUE or UNKNOWN (NULL).
It can reference columns of the table, and can reference objects that exist while the statement is executed.
Conditions are only checked when a row is added or modified in the table where the constraint exists.
","
NOT NULL
PRIMARY KEY
UNIQUE
REFERENCES T2(ID)
CHECK (VALUE > 0)
"

"Other Grammar","Comment","
bracketedComment | -- anythingUntilEndOfLine | @c@ // anythingUntilEndOfLine
","
Comments can be used anywhere in a command and are ignored by the database.
Line comments ""--"" and ""//"" end with a newline.
","
-- comment
/* comment */
"

"Other Grammar","Bracketed comment","
/* [ [ bracketedComment ] [ anythingUntilCommentStartOrEnd ] [...] ] */
","
Comments can be used anywhere in a command and are ignored by the database.
Bracketed comments ""/* */"" can be nested and can be multiple lines long.
","
/* comment */
/* comment /* nested comment */ comment */
"

"Other Grammar","Compare","
<> | <= | >= | = | < | > | @c@ { != } | @h2@ &&
","
Comparison operator. The operator != is the same as <>.
The operator ""&&"" means overlapping; it can only be used with geometry types.
","
<>
"

"Other Grammar","Condition","
operand [ conditionRightHandSide ]
    | NOT condition
    | EXISTS ( query )
    | UNIQUE [ nullsDistinct ] ( query )
    | @h2@ INTERSECTS (operand, operand)
","
Boolean value or condition.

""NOT"" condition negates the result of subcondition and returns ""TRUE"", ""FALSE"", or ""UNKNOWN"" (""NULL"").

""EXISTS"" predicate tests whether the result of the specified subquery is not empty and returns ""TRUE"" or ""FALSE"".

""UNIQUE"" predicate tests absence of duplicate rows in the specified subquery and returns ""TRUE"" or ""FALSE"".
If nulls distinct clause is not specified, NULLS DISTINCT is implicit.

""INTERSECTS"" checks whether 2D bounding boxes of specified geometries intersect with each other
and returns ""TRUE"" or ""FALSE"".
","
ID <> 2
NOT(A OR B)
EXISTS (SELECT NULL FROM TEST T WHERE T.GROUP_ID = P.ID)
UNIQUE (SELECT A, B FROM TEST T WHERE T.CATEGORY = CAT)
INTERSECTS(GEOM1, GEOM2)
"

"Other Grammar","Condition Right Hand Side","
comparisonRightHandSide
    | quantifiedComparisonRightHandSide
    | nullPredicateRightHandSide
    | distinctPredicateRightHandSide
    | quantifiedDistinctPredicateRightHandSide
    | booleanTestRightHandSide
    | typePredicateRightHandSide
    | jsonPredicateRightHandSide
    | betweenPredicateRightHandSide
    | inPredicateRightHandSide
    | likePredicateRightHandSide
    | regexpPredicateRightHandSide
","
The right hand side of a condition.
","
> 10
IS NULL
IS NOT NULL
IS NOT DISTINCT FROM B
IS OF (DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE)
IS JSON OBJECT WITH UNIQUE KEYS
LIKE 'Jo%'
"

"Other Grammar","Comparison Right Hand Side","
compare operand
","
Right side of comparison predicates.
","
> 10
"

"Other Grammar","Quantified Comparison Right Hand Side","
compare { ALL | ANY | SOME } ( { query | @h2@ { array } } )
","
Right side of quantified comparison predicates.

Quantified comparison predicate ALL returns TRUE if specified comparison operation between
left size of condition and each row from a subquery or each element of array returns TRUE,
including case when there are no rows (elements).
ALL predicate returns FALSE if at least one such comparison returns FALSE.
Otherwise it returns UNKNOWN.

Quantified comparison predicates ANY and SOME return TRUE if specified comparison operation between
left size of condition and at least one row from a subquery or at least one element of array returns TRUE.
ANY and SOME predicates return FALSE if all such comparisons return FALSE.
Otherwise they return UNKNOWN.

Note that these predicates have priority over ANY and SOME aggregate functions with subquery on the right side.
Use parentheses around aggregate function.

If version with array is required and this array is returned from a subquery, wrap this subquery with a cast
to distinguish this operation from standard quantified comparison predicate with a query.
","
< ALL(SELECT V FROM TEST)
= ANY(ARRAY_COLUMN)
= ANY(CAST((SELECT ARRAY_COLUMN FROM OTHER_TABLE WHERE ID = 5) AS INTEGER ARRAY)
"

"Other Grammar","Null Predicate Right Hand Side","
IS [ NOT ] NULL
","
Right side of null predicate.

Check whether the specified value(s) are NULL values.
To test multiple values a row value must be specified.
""IS NULL"" returns ""TRUE"" if and only if all values are ""NULL"" values; otherwise it returns ""FALSE"".
""IS NOT NULL"" returns ""TRUE"" if and only if all values are not ""NULL"" values; otherwise it returns ""FALSE"".
","
IS NULL
"

"Other Grammar","Distinct Predicate Right Hand Side","
IS [ NOT ] [ DISTINCT FROM ] operand
","
Right side of distinct predicate.

Distinct predicate is null-safe, meaning NULL is considered the same as NULL,
and the condition never evaluates to UNKNOWN.
","
IS NOT DISTINCT FROM OTHER
"

"Other Grammar","Quantified Distinct Predicate Right Hand Side","
@h2@ IS [ NOT ] [ DISTINCT FROM ] { ALL | ANY | SOME } ( { query | array } )
","
Right side of quantified distinct predicate.

Quantified distinct predicate is null-safe, meaning NULL is considered the same as NULL,
and the condition never evaluates to UNKNOWN.

Quantified distinct predicate ALL returns TRUE if specified distinct predicate between
left size of condition and each row from a subquery or each element of array returns TRUE,
including case when there are no rows.
Otherwise it returns FALSE.

Quantified distinct predicates ANY and SOME return TRUE if specified distinct predicate between
left size of condition and at least one row from a subquery or at least one element of array returns TRUE.
Otherwise they return FALSE.

Note that these predicates have priority over ANY and SOME aggregate functions with subquery on the right side.
Use parentheses around aggregate function.

If version with array is required and this array is returned from a subquery, wrap this subquery with a cast
to distinguish this operation from quantified comparison predicate with a query.
","
IS DISTINCT FROM ALL(SELECT V FROM TEST)
IS NOT DISTINCT FROM ANY(ARRAY_COLUMN)
IS NOT DISTINCT FROM ANY(CAST((SELECT ARRAY_COLUMN FROM OTHER_TABLE WHERE ID = 5) AS INTEGER ARRAY)
"

"Other Grammar","Boolean Test Right Hand Side","
IS [ NOT ] { TRUE | FALSE | UNKNOWN }
","
Right side of boolean test.

Checks whether the specified value is (not) ""TRUE"", ""FALSE"", or ""UNKNOWN"" (""NULL"")
and return ""TRUE"" or ""FALSE"".
This test is null-safe.
","
IS TRUE
"

"Other Grammar","Type Predicate Right Hand Side","
IS [ NOT ] OF (dataType [,...])
","
Right side of type predicate.

Checks whether the data type of the specified operand is one of the specified data types.
Some data types have multiple names, these names are considered as equal here.
Domains and their base data types are currently not distinguished from each other.
Precision and scale are also ignored.
If operand is NULL, the result is UNKNOWN.
","
IS OF (INTEGER, BIGINT)
"

"Other Grammar","JSON Predicate Right Hand Side","
IS [ NOT ] JSON [ VALUE | ARRAY | OBJECT | SCALAR ]
        [ [ WITH | WITHOUT ] UNIQUE [ KEYS ] ]
","
Right side of JSON predicate.

Checks whether value of the specified string, binary data, or a JSON is a valid JSON.
If ""ARRAY"", ""OBJECT"", or ""SCALAR"" is specified, only JSON items of the specified type are considered as valid.
If ""WITH UNIQUE [ KEYS ]"" is specified only JSON with unique keys is considered as valid.
This predicate isn't null-safe, it returns UNKNOWN if operand is NULL.
","
IS JSON OBJECT WITH UNIQUE KEYS
"

"Other Grammar","Between Predicate Right Hand Side","
[ NOT ] BETWEEN [ ASYMMETRIC | SYMMETRIC ] operand AND operand
","
Right side of between predicate.

Checks whether the value is within the range inclusive.
""V BETWEEN [ ASYMMETRIC ] A AND B"" is equivalent to ""A <= V AND V <= B"".
""V BETWEEN SYMMETRIC A AND B"" is equivalent to ""A <= V AND V <= B OR A >= V AND V >= B"".
","
BETWEEN LOW AND HIGH
"

"Other Grammar","In Predicate Right Hand Side","
[ NOT ] IN ( { query | expression [,...] } )
","
Right side of in predicate.

Checks presence of value in the specified list of values or in result of the specified query.

Returns ""TRUE"" if row value on the left side is equal to one of values on the right side,
""FALSE"" if all comparison operations were evaluated to ""FALSE"" or right side has no values,
and ""UNKNOWN"" otherwise.

This operation is logically equivalent to ""OR"" between comparison operations
comparing left side and each value from the right side.
","
IN (A, B, C)
IN (SELECT V FROM TEST)
"

"Other Grammar","Like Predicate Right Hand Side","
[ NOT ] { LIKE | @h2@ { ILIKE } } operand [ ESCAPE string ]
","
Right side of like predicate.

The wildcards characters are ""_"" (any one character) and ""%"" (any characters).
The database uses an index when comparing with LIKE except if the operand starts with a wildcard.
To search for the characters ""%"" and ""_"", the characters need to be escaped.
The default escape character is "" \ "" (backslash).
To select no escape character, use ""ESCAPE ''"" (empty string).
At most one escape character is allowed.
Each character that follows the escape character in the pattern needs to match exactly.
Patterns that end with an escape character are invalid and the expression returns NULL.

ILIKE does a case-insensitive compare.
","
LIKE 'a%'
"

"Other Grammar","Regexp Predicate Right Hand Side","
@h2@ { [ NOT ] REGEXP operand }
","
Right side of Regexp predicate.

Regular expression matching is used.
See Java ""Matcher.find"" for details.
","
REGEXP '[a-z]'
"

"Other Grammar","Nulls Distinct","
NULLS { DISTINCT | NOT DISTINCT | @h2@ { ALL DISTINCT } }
","
Are nulls distinct for unique constraint, index, or predicate.

If NULLS DISTINCT is specified, rows with null value in any column are distinct.
If NULLS ALL DISTINCT is specified, rows with null value in all columns are distinct.
If NULLS NOT DISTINCT is specified, null values are identical.

Treatment of null values inside composite data types is not affected.
","
NULLS DISTINCT
NULLS NOT DISTINCT
"

"Other Grammar","Table Constraint Definition","
[ constraintNameDefinition ]
{ PRIMARY KEY @h2@ [ HASH ] ( columnName [,...] ) }
    | UNIQUE [ nullsDistinct ] ( { columnName [,...] | VALUE } )
    | referentialConstraint
    | CHECK (condition)
","
Defines a constraint.

PRIMARY KEY and UNIQUE require unique values.
PRIMARY KEY also disallows NULL values and marks the column as a primary key, a table can have only one primary key.
UNIQUE constraint supports NULL values and rows with NULL value in any column are considered as unique.
UNIQUE constraint allows NULL values, if nulls distinct clause is not specified, the default is NULLS DISTINCT,
excluding some compatibility modes.
UNIQUE (VALUE) creates a unique constraint on entire row, excluding invisible columns;
but if new columns will be added to the table, they will not be included into this constraint.

Referential constraint requires values that exist in other column(s) (usually in another table).

Check constraint requires a specified condition to return TRUE or UNKNOWN (NULL).
It can reference columns of the table, and can reference objects that exist while the statement is executed.
Conditions are only checked when a row is added or modified in the table where the constraint exists.
","
PRIMARY KEY(ID, NAME)
"

"Other Grammar","Constraint Name Definition","
CONSTRAINT @h2@ [ IF NOT EXISTS ] newConstraintName
","
Defines a constraint name.
","
CONSTRAINT CONST_ID
"

"Other Grammar","Csv Options","
@h2@ charsetString [, fieldSepString [, fieldDelimString [, escString [, nullString]]]]
    | optionString
","
Optional parameters for CSVREAD and CSVWRITE.
Instead of setting the options one by one, all options can be
combined into a space separated key-value pairs, as follows:
""STRINGDECODE('charset=UTF-8 escape=\"" fieldDelimiter=\"" fieldSeparator=, ' ||""
""'lineComment=# lineSeparator=\n null= rowSeparator=')"".
The following options are supported:

""caseSensitiveColumnNames"" (true or false; disabled by default),

""charset"" (for example 'UTF-8'),

""escape"" (the character that escapes the field delimiter),

""fieldDelimiter"" (a double quote by default),

""fieldSeparator"" (a comma by default),

""lineComment"" (disabled by default),

""lineSeparator"" (the line separator used for writing; ignored for reading),

""null"" Support reading existing CSV files that contain explicit ""null"" delimiters.
Note that an empty, unquoted values are also treated as null.

""quotedNulls"" (quotes the nullString. true of false; disabled by default),

""preserveWhitespace"" (true or false; disabled by default),

""writeColumnHeader"" (true or false; enabled by default).

For a newline or other special character, use STRINGDECODE as in the example above.
A space needs to be escaped with a backslash (""'\ '""), and
a backslash needs to be escaped with another backslash (""'\\'"").
All other characters are not to be escaped, that means
newline and tab characters are written as such.
","
CALL CSVWRITE('test2.csv', 'SELECT * FROM TEST', 'charset=UTF-8 fieldSeparator=|');
"

"Other Grammar","Data Change Delta Table","
{ OLD | NEW | FINAL } TABLE
( { insert | update | delete | @h2@ { mergeInto } | mergeUsing } )
","
Executes the inner data change command and returns old, new, or final rows.

""OLD"" is not allowed for ""INSERT"" command. It returns old rows.

""NEW"" and ""FINAL"" are not allowed for ""DELETE"" command.

""NEW"" returns new rows after evaluation of default expressions, but before execution of triggers.

""FINAL"" returns new rows after execution of triggers.
","
SELECT ID FROM FINAL TABLE (INSERT INTO TEST (A, B) VALUES (1, 2))
"

"Other Grammar","Data Type or Domain","
dataType | [schemaName.]domainName
","
A data type or domain name.
","
INTEGER
MY_DOMAIN
"

"Other Grammar","Data Type","
predefinedType | arrayType | rowType
","
A data type.
","
INTEGER
"

"Other Grammar","Predefined Type","
characterType | characterVaryingType | characterLargeObjectType
    | binaryType | binaryVaryingType | binaryLargeObjectType
    | booleanType
    | smallintType | integerType | bigintType
    | numericType | realType | doublePrecisionType | decfloatType
    | dateType | timeType | timeWithTimeZoneType
    | timestampType | timestampWithTimeZoneType
    | intervalType
    | @h2@ { tinyintType | javaObjectType | enumType
    | geometryType | jsonType | uuidType }
","
A predefined data type.
","
INTEGER
"

"Other Grammar","Digit","
0-9
","
A digit.
","
0
"

"Other Grammar","Expression","
andCondition [ { OR andCondition } [...] ]
","
Value or condition.
","
ID=1 OR NAME='Hi'
"

"Other Grammar","Factor","
term [ { { * | / | @c@ { % } } term } [...] ]
","
A value or a numeric factor.
","
ID * 10
"

"Other Grammar","Grouping element","
expression | (expression [, ...]) | ()
","
A grouping element of GROUP BY clause.
","
A
(B, C)
()
"

"Other Grammar","Hex","
[' ' [...]] { { digit | a-f | A-F } [' ' [...]] { digit | a-f | A-F } [' ' [...]] } [...]
","
The hexadecimal representation of a number or of bytes with optional space characters.
Two hexadecimal digit characters are one byte.
","
cafe
11 22 33
a b  c d
"

"Other Grammar","Index Column","
columnName [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
","
Indexes this column in ascending or descending order. Usually it is not required
to specify the order; however doing so will speed up large queries that order
the column in the same way.
","
NAME
"

"Other Grammar","Insert values","
VALUES { DEFAULT|expression | [ROW] ({DEFAULT|expression} [,...]) }, [,...]
","
Values for INSERT statement.
","
VALUES (1, 'Test')
"

"Other Grammar","Interval qualifier","
YEAR [(precisionInt)] [ TO MONTH ]
    | MONTH [(precisionInt)]
    | DAY [(precisionInt)] [ TO { HOUR | MINUTE | SECOND [(scaleInt)] } ]
    | HOUR [(precisionInt)] [ TO { MINUTE | SECOND [(scaleInt)] } ]
    | MINUTE [(precisionInt)] [ TO SECOND [(scaleInt)] ]
    | SECOND [(precisionInt [, scaleInt])]
","
An interval qualifier.
","
DAY TO SECOND
"

"Other Grammar","Join specification","
ON expression | USING (columnName [,...])
","
Specifies a join condition or column names.
","
ON B.ID = A.PARENT_ID
USING (ID)
"

"Other Grammar","Merge when clause","
mergeWhenMatchedClause|mergeWhenNotMatchedClause
","
WHEN MATCHED or WHEN NOT MATCHED clause for MERGE USING command.
","
WHEN MATCHED THEN DELETE
"

"Other Grammar","Merge when matched clause","
WHEN MATCHED [ AND expression ] THEN
UPDATE SET setClauseList | DELETE
","
WHEN MATCHED clause for MERGE USING command.
","
WHEN MATCHED THEN UPDATE SET NAME = S.NAME
WHEN MATCHED THEN DELETE
"

"Other Grammar","Merge when not matched clause","
WHEN NOT MATCHED [ AND expression ] THEN INSERT
[ ( columnName [,...] ) ]
[ overrideClause ]
VALUES ({DEFAULT|expression} [,...])
","
WHEN NOT MATCHED clause for MERGE USING command.
","
WHEN NOT MATCHED THEN INSERT (ID, NAME) VALUES (S.ID, S.NAME)
"

"Other Grammar","Name","
{ { A-Z|_ } [ { A-Z|_|0-9 } [...] ] } | quotedName
","
With default settings unquoted names are converted to upper case.
The maximum name length is 256 characters.

Identifiers in H2 are case sensitive by default.
Because unquoted names are converted to upper case, they can be written in any case anyway.
When both quoted and unquoted names are used for the same identifier the quoted names must be written in upper case.
Identifiers with lowercase characters can be written only as a quoted name, they aren't accessible with unquoted names.

If DATABASE_TO_UPPER setting is set to FALSE the unquoted names aren't converted to upper case.

If DATABASE_TO_LOWER setting is set to TRUE the unquoted names are converted to lower case instead.

If CASE_INSENSITIVE_IDENTIFIERS setting is set to TRUE all identifiers are case insensitive.
","
TEST
"

"Other Grammar","Operand","
summand [ { || summand } [...] ]
","
Performs the concatenation of character string, binary string, or array values.
In the default mode, the result is NULL if either parameter is NULL.
In compatibility modes result of string concatenation with NULL parameter can be different.
","
'Hi' || ' Eva'
X'AB' || X'CD'
ARRAY[1, 2] || 3
1 || ARRAY[2, 3]
ARRAY[1, 2] || ARRAY[3, 4]
"

"Other Grammar","Override clause","
OVERRIDING { USER | SYSTEM } VALUE
","
If OVERRIDING USER VALUE is specified, INSERT statement ignores the provided value for identity column
and generates a new one instead.

If OVERRIDING SYSTEM VALUE is specified, INSERT statement assigns the provided value to identity column.

If neither clauses are specified, INSERT statement assigns the provided value to
GENERATED BY DEFAULT AS IDENTITY column,
but throws an exception if value is specified for GENERATED ALWAYS AS IDENTITY column.
","
OVERRIDING SYSTEM VALUE
OVERRIDING USER VALUE
"

"Other Grammar","Query","
select | explicitTable | tableValue
","
A query, such as SELECT, explicit table, or table value.
","
SELECT ID FROM TEST;
TABLE TEST;
VALUES (1, 2), (3, 4);
"

"Other Grammar","Quoted Name","
""anythingExceptDoubleQuote""
    | U&""anythingExceptDoubleQuote"" [ UESCAPE 'singleCharacter' ]
","
Case of characters in quoted names is preserved as is. Such names can contain spaces.
The maximum name length is 256 characters.
Two double quotes can be used to create a single double quote inside an identifier.
With default settings identifiers in H2 are case sensitive.

Identifiers staring with ""U&"" are Unicode identifiers.
All identifiers in H2 may have Unicode characters,
but Unicode identifiers may contain Unicode escape sequences ""\0000"" or ""\+000000"",
where \ is an escape character, ""0000"" and ""000000"" are Unicode character codes in hexadecimal notation.
Optional ""UESCAPE"" clause may be used to specify another escape character,
with exception for single quote, double quote, plus sign, and hexadecimal digits (0-9, a-f, and A-F).
By default the backslash is used.
Two escape characters can be used to include a single character inside an Unicode identifier.
Two double quotes can be used to create a single double quote inside an Unicode identifier.
","
""FirstName""
U&""\00d6ffnungszeit""
U&""/00d6ffnungszeit"" UESCAPE '/'
"

"Other Grammar","Referential Constraint","
FOREIGN KEY ( columnName [,...] ) referencesSpecification
","
Defines a referential constraint.
","
FOREIGN KEY(ID) REFERENCES TEST(ID)
"

"Other Grammar","References Specification","
REFERENCES [ refTableName ] [ ( refColumnName [,...] ) ]
[ ON DELETE referentialAction ] [ ON UPDATE referentialAction ]
","
Defines a referential specification of a referential constraint.
If the table name is not specified, then the same table is referenced.
RESTRICT is the default action.
If the referenced columns are not specified, then the primary key columns are used.
Referential constraint requires an existing unique or primary key constraint on referenced columns,
this constraint must include all referenced columns in any order and must not include any other columns.
Some tables may not be referenced, such as metadata tables.
","
REFERENCES TEST(ID)
"

"Other Grammar","Referential Action","
CASCADE | RESTRICT | NO ACTION | SET { DEFAULT | NULL }
","
The action CASCADE will cause conflicting rows in the referencing (child) table to be deleted or updated.
RESTRICT is the default action.
As this database does not support deferred checking, RESTRICT and NO ACTION will both throw an exception if the constraint is violated.
The action SET DEFAULT will set the column in the referencing (child) table to the default value, while SET NULL will set it to NULL.
","
CASCADE
SET NULL
"

"Other Grammar","Script Compression Encryption","
@h2@ [ COMPRESSION { DEFLATE | LZF | ZIP | GZIP } ]
@h2@ [ CIPHER cipher PASSWORD string ]
","
The compression and encryption algorithm to use for script files.
When using encryption, only DEFLATE and LZF are supported.
LZF is faster but uses more space.
","
COMPRESSION LZF
"

"Other Grammar","Select order","
{ expression | @c@ { int } } [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
","
Sorts the result by the given column number, or by an expression. If the
expression is a single parameter, then the value is interpreted as a column
number. Negative column numbers reverse the sort order.
","
NAME DESC NULLS LAST
"

"Other Grammar","Row value expression","
ROW (expression, [,...])
    | ( [ expression, expression [,...] ] )
    | expression
","
A row value expression.
","
ROW (1)
(1, 2)
1
"

"Other Grammar","Select Expression","
wildcardExpression | expression [ [ AS ] columnAlias ]
","
An expression in a SELECT statement.
","
ID AS DOCUMENT_ID
"

"Other Grammar","Sequence value expression","
{ NEXT | @h2@ { CURRENT } } VALUE FOR [schemaName.]sequenceName
","
The next or current value of a sequence.

When the next value is requested the sequence is incremented and the current value of the sequence
and the last identity in the current session are updated with the generated value.
The next value of the sequence is generated only once for each processed row.
If this expression is used multiple times with the same sequence it returns the same value within a processed row.
Used values are never re-used, even when the transaction is rolled back.

Current value may only be requested after generation of the sequence value in the current session.
It returns the latest generated value for the current session.

If a single command contains next and current value expressions for the same sequence there is no guarantee that
the next value expression will be evaluated before the evaluation of current value expression.
","
NEXT VALUE FOR SEQ1
CURRENT VALUE FOR SCHEMA2.SEQ2
"

"Other Grammar","Sequence option","
START WITH long
    | @h2@ { RESTART WITH long }
    | basicSequenceOption
","
Option of a sequence.

START WITH is used to set the initial value of the sequence.
If initial value is not defined, MINVALUE for incrementing sequences and MAXVALUE for decrementing sequences is used.

RESTART is used to immediately restart the sequence with the specified value.
","
START WITH 10000
NO CACHE
"

"Other Grammar","Alter sequence option","
@h2@ { START WITH long }
    | RESTART [ WITH long ]
    | basicSequenceOption
","
Option of a sequence.

START WITH is used to change the initial value of the sequence.
It does not affect the current value of the sequence,
it only changes the preserved initial value that is used for simple RESTART without a value.

RESTART is used to restart the sequence from its initial value or with the specified value.
","
START WITH 10000
NO CACHE
"

"Other Grammar","Alter identity column option","
@h2@ { START WITH long }
    | RESTART [ WITH long ]
    | SET basicSequenceOption
","
Option of an identity column.

START WITH is used to set or change the initial value of the sequence.
START WITH does not affect the current value of the sequence,
it only changes the preserved initial value that is used for simple RESTART without a value.

RESTART is used to restart the sequence from its initial value or with the specified value.
","
START WITH 10000
SET NO CACHE
"

"Other Grammar","Basic sequence option","
INCREMENT BY long
    | MINVALUE long | NO MINVALUE | @c@ { NOMINVALUE }
    | MAXVALUE long | NO MAXVALUE | @c@ { NOMAXVALUE }
    | CYCLE | NO CYCLE | @h2@ { EXHAUSTED } | @c@ { NOCYCLE }
    | @h2@ { CACHE long } | @h2@ { NO CACHE } | @c@ { NOCACHE }
","
Basic option of a sequence.

INCREMENT BY specifies the step of the sequence, may be positive or negative, but may not be zero.
The default is 1.

MINVALUE and MAXVALUE specify the bounds of the sequence.

Sequences with CYCLE option start the generation again from
MINVALUE (incrementing sequences) or MAXVALUE (decrementing sequences) instead of exhausting with an error.
Sequences with EXHAUSTED option can't return values until they will be restarted.

The CACHE option sets the number of pre-allocated numbers.
If the system crashes without closing the database, at most this many numbers are lost.
The default cache size is 32 if sequence has enough range of values.
NO CACHE option or the cache size 1 or lower disable the cache.
If CACHE option is specified, it cannot be larger than the total number of values
that sequence can produce within a cycle.
","
MAXVALUE 100000
CYCLE
NO CACHE
"

"Other Grammar","Set clause list","
{ { updateTarget = { DEFAULT | expression } }
    | { ( updateTarget [,...] ) = { rowValueExpression | (query) } } } [,...]
","
List of SET clauses.

Each column may be specified only once in update targets.
","
NAME = 'Test', PRICE = 2
(A, B) = (1, 2)
(A, B) = (1, 2), C = 3
(A, B) = (SELECT X, Y FROM OTHER T2 WHERE T1.ID = T2.ID)
"

"Other Grammar","Sort specification","
expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
","
Sorts the result by an expression.
","
X ASC NULLS FIRST
"

"Other Grammar","Sort specification list","
sortSpecification [,...]
","
Sorts the result by expressions.
","
V
A, B DESC NULLS FIRST
"

"Other Grammar","Summand","
factor [ { { + | - } factor } [...] ]
","
A value or a numeric sum.

Please note the text concatenation operator is ""||"".
","
ID + 20
"

"Other Grammar","Table Expression","
{ [ schemaName. ] tableName
    | ( query )
    | unnest
    | table
    | dataChangeDeltaTable }
[ [ AS ] newTableAlias [ ( columnName [,...] ) ] ]
@h2@ [ USE INDEX ([ indexName [,...] ]) ]
[ { { LEFT | RIGHT } [ OUTER ] | [ INNER ] | CROSS | NATURAL }
    JOIN tableExpression [ joinSpecification ] ]
","
Joins a table. The join specification is not supported for cross and natural joins.
A natural join is an inner join, where the condition is automatically on the
columns with the same name.
","
TEST1 AS T1 LEFT JOIN TEST2 AS T2 ON T1.ID = T2.PARENT_ID
"

"Other Grammar","Update target","
columnName [ '[' int ']' [...] ]
","
Column or element of a column of ARRAY data type.

If array indexes are specified,
column must have a compatible ARRAY data type and updated rows may not have NULL values in this column.
It means for C[2][3] both C and C[2] may not be NULL.
Too short arrays are expanded, missing elements are set to NULL.
","
A
B[1]
C[2][3]
"

"Other Grammar","Within group specification","
WITHIN GROUP (ORDER BY sortSpecificationList)
","
Group specification for ordered set functions.
","
WITHIN GROUP (ORDER BY ID DESC)
"

"Other Grammar","Wildcard expression","
[[schemaName.]tableAlias.]*
@h2@ [EXCEPT ([[schemaName.]tableAlias.]columnName, [,...])]
","
A wildcard expression in a SELECT statement.
A wildcard expression represents all visible columns. Some columns can be excluded with optional EXCEPT clause.
","
*
* EXCEPT (DATA)
"

"Other Grammar","Window name or specification","
windowName | windowSpecification
","
A window name or inline specification for a window function or aggregate.

Window functions in H2 may require a lot of memory for large queries.
","
W1
(ORDER BY ID)
"

"Other Grammar","Window specification","
([existingWindowName]
[PARTITION BY expression [,...]] [ORDER BY sortSpecificationList]
[windowFrame])
","
A window specification for a window, window function or aggregate.

If name of an existing window is specified its clauses are used by default.

Optional window partition clause separates rows into independent partitions.
Each partition is processed separately.
If this clause is not present there is one implicit partition with all rows.

Optional window order clause specifies order of rows in the partition.
If some rows have the same order position they are considered as a group of rows in optional window frame clause.

Optional window frame clause specifies which rows are processed by a window function,
see its documentation for a more details.
","
()
(W1 ORDER BY ID)
(PARTITION BY CATEGORY)
(PARTITION BY CATEGORY ORDER BY NAME, ID)
(ORDER BY Y RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES)
"

"Other Grammar","Window frame","
ROWS|RANGE|GROUP
{windowFramePreceding|BETWEEN windowFrameBound AND windowFrameBound}
[EXCLUDE {CURRENT ROW|GROUP|TIES|NO OTHERS}]
","
A window frame clause.
May be specified only for aggregates and FIRST_VALUE(), LAST_VALUE(), and NTH_VALUE() window functions.

If this clause is not specified for an aggregate or window function that supports this clause
the default window frame depends on window order clause.
If window order clause is also not specified
the default window frame contains all the rows in the partition.
If window order clause is specified
the default window frame contains all preceding rows and all rows from the current group.

Window frame unit determines how rows or groups of rows are selected and counted.
If ROWS is specified rows are not grouped in any way and relative numbers of rows are used in bounds.
If RANGE is specified rows are grouped according window order clause,
preceding and following values mean the difference between value in the current row and in the target rows,
and CURRENT ROW in bound specification means current group of rows.
If GROUPS is specified rows are grouped according window order clause,
preceding and following values means relative number of groups of rows,
and CURRENT ROW in bound specification means current group of rows.

If only window frame preceding clause is specified it is treated as
BETWEEN windowFramePreceding AND CURRENT ROW.

Optional window frame exclusion clause specifies rows that should be excluded from the frame.
EXCLUDE CURRENT ROW excludes only the current row regardless the window frame unit.
EXCLUDE GROUP excludes the whole current group of rows, including the current row.
EXCLUDE TIES excludes the current group of rows, but not the current row.
EXCLUDE NO OTHERS is default and it does not exclude anything.
","
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE TIES
"

"Other Grammar","Window frame preceding","
UNBOUNDED PRECEDING|value PRECEDING|CURRENT ROW
","
A window frame preceding clause.
If value is specified it should not be negative.
","
UNBOUNDED PRECEDING
1 PRECEDING
CURRENT ROW
"

"Other Grammar","Window frame bound","
UNBOUNDED PRECEDING|value PRECEDING|CURRENT ROW
    |value FOLLOWING|UNBOUNDED FOLLOWING
","
A window frame bound clause.
If value is specified it should not be negative.
","
UNBOUNDED PRECEDING
UNBOUNDED FOLLOWING
1 FOLLOWING
CURRENT ROW
"

"Other Grammar","Term","
{ value
    | column
    | ?[ int ]
    | sequenceValueExpression
    | function
    | { - | + } term
    | ( expression )
    | arrayElementReference
    | fieldReference
    | ( query )
    | caseExpression
    | castSpecification
    | userDefinedFunctionName }
[ timeZone | intervalQualifier ]
","
A value. Parameters can be indexed, for example ""?1"" meaning the first parameter.

Interval qualifier may only be specified for a compatible value
or for a subtraction operation between two datetime values.
The subtraction operation ignores the leading field precision of the qualifier.
","
'Hello'

"

"Other Grammar","Time zone","
AT { TIME ZONE { intervalHourToMinute | intervalHourToSecond | @h2@ { string } } | LOCAL }
","
A time zone. Converts the timestamp with or without time zone into timestamp with time zone at specified time zone.
If a day-time interval is specified as a time zone,
it may not have fractional seconds and must be between -18 to 18 hours inclusive.
","
AT LOCAL
AT TIME ZONE '2'
AT TIME ZONE '-6:00'
AT TIME ZONE INTERVAL '10:00' HOUR TO MINUTE
AT TIME ZONE INTERVAL '10:00:00' HOUR TO SECOND
AT TIME ZONE 'UTC'
AT TIME ZONE 'Europe/London'
"

"Other Grammar","Column","
[[schemaName.]tableAlias.] { columnName | @h2@ { _ROWID_ } }
","
A column name with optional table alias and schema.
_ROWID_ can be used to access unique row identifier.
","
ID
"

"Data Types","CHARACTER Type","
{ CHARACTER | CHAR | NATIONAL { CHARACTER | CHAR } | NCHAR }
[ ( lengthInt [CHARACTERS|OCTETS] ) ]
","
A Unicode String of fixed length.

Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2.
The allowed length is from 1 to 1,000,000,000 characters.
If length is not specified, 1 character is used by default.

The whole text is kept in memory when using this data type.
For variable-length strings use [CHARACTER VARYING](https://h2database.com/html/datatypes.html#character_varying_type)
data type instead.
For large text data [CHARACTER LARGE OBJECT](https://h2database.com/html/datatypes.html#character_large_object_type)
should be used; see there for details.

Too short strings are right-padded with space characters.
Too long strings are truncated by CAST specification and rejected by column assignment.

Two CHARACTER strings of different length are considered as equal if all additional characters in the longer string
are space characters.

See also [string](https://h2database.com/html/grammar.html#string) literal grammar.
Mapped to ""java.lang.String"".
","
CHARACTER
CHAR(10)
"

"Data Types","CHARACTER VARYING Type","
{ { CHARACTER | CHAR } VARYING
    | VARCHAR
    | { NATIONAL { CHARACTER | CHAR } | NCHAR } VARYING
    | @h2@ { VARCHAR_CASESENSITIVE } }
[ ( lengthInt [CHARACTERS|OCTETS] ) ]
","
A Unicode String.
Use two single quotes ('') to create a quote.

The allowed length is from 1 to 1,000,000,000 characters.
The length is a size constraint; only the actual data is persisted.
Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2.

The whole text is loaded into memory when using this data type.
For large text data [CHARACTER LARGE OBJECT](https://h2database.com/html/datatypes.html#character_large_object_type)
should be used; see there for details.

See also [string](https://h2database.com/html/grammar.html#string) literal grammar.
Mapped to ""java.lang.String"".
","
CHARACTER VARYING(100)
VARCHAR(255)
"

"Data Types","CHARACTER LARGE OBJECT Type","
{ { CHARACTER | CHAR } LARGE OBJECT | CLOB
    | { NATIONAL CHARACTER | NCHAR } LARGE OBJECT | NCLOB }
[ ( lengthLong [K|M|G|T|P] [CHARACTERS|OCTETS]) ]
","
CHARACTER LARGE OBJECT is intended for very large Unicode character string values.
Unlike when using [CHARACTER VARYING](https://h2database.com/html/datatypes.html#character_varying_type),
large CHARACTER LARGE OBJECT values are not kept fully in-memory; instead, they are streamed.
CHARACTER LARGE OBJECT should be used for documents and texts with arbitrary size such as XML or
HTML documents, text files, or memo fields of unlimited size.
Use ""PreparedStatement.setCharacterStream"" to store values.
See also [Large Objects](https://h2database.com/html/advanced.html#large_objects) section.

CHARACTER VARYING should be used for text with relatively short average size (for example
shorter than 200 characters). Short CHARACTER LARGE OBJECT values are stored inline, but there is
an overhead compared to CHARACTER VARYING.

Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2.

Mapped to ""java.sql.Clob"" (""java.io.Reader"" is also supported).
","
CHARACTER LARGE OBJECT
CLOB(10K)
"

"Data Types","VARCHAR_IGNORECASE Type","
@h2@ VARCHAR_IGNORECASE
[ ( lengthInt [CHARACTERS|OCTETS] ) ]
","
Same as VARCHAR, but not case sensitive when comparing.
Stored in mixed case.

The allowed length is from 1 to 1,000,000,000 characters.
The length is a size constraint; only the actual data is persisted.
Length, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2.

The whole text is loaded into memory when using this data type.
For large text data CLOB should be used; see there for details.

See also [string](https://h2database.com/html/grammar.html#string) literal grammar.
Mapped to ""java.lang.String"".
","
VARCHAR_IGNORECASE
"

"Data Types","BINARY Type","
BINARY [ ( lengthInt ) ]
","
Represents a binary string (byte array) of fixed predefined length.

The allowed length is from 1 to 1,000,000,000 bytes.
If length is not specified, 1 byte is used by default.

The whole binary string is kept in memory when using this data type.
For variable-length binary strings use [BINARY VARYING](https://h2database.com/html/datatypes.html#binary_varying_type)
data type instead.
For large binary data [BINARY LARGE OBJECT](https://h2database.com/html/datatypes.html#binary_large_object_type)
should be used; see there for details.

Too short binary string are right-padded with zero bytes.
Too long binary strings are truncated by CAST specification and rejected by column assignment.

Binary strings of different length are considered as not equal to each other.

See also [bytes](https://h2database.com/html/grammar.html#bytes) literal grammar.
Mapped to byte[].
","
BINARY
BINARY(1000)
"

"Data Types","BINARY VARYING Type","
{ BINARY VARYING | VARBINARY }
[ ( lengthInt ) ]
","
Represents a byte array.

The allowed length is from 1 to 1,000,000,000 bytes.
The length is a size constraint; only the actual data is persisted.

The whole binary string is kept in memory when using this data type.
For large binary data [BINARY LARGE OBJECT](https://h2database.com/html/datatypes.html#binary_large_object_type)
should be used; see there for details.

See also [bytes](https://h2database.com/html/grammar.html#bytes) literal grammar.
Mapped to byte[].
","
BINARY VARYING(100)
VARBINARY(1000)
"

"Data Types","BINARY LARGE OBJECT Type","
{ BINARY LARGE OBJECT | BLOB }
[ ( lengthLong [K|M|G|T|P]) ]
","
BINARY LARGE OBJECT is intended for very large binary values such as files or images.
Unlike when using [BINARY VARYING](https://h2database.com/html/datatypes.html#binary_varying_type),
large objects are not kept fully in-memory; instead, they are streamed.
Use ""PreparedStatement.setBinaryStream"" to store values.
See also [CHARACTER LARGE OBJECT](https://h2database.com/html/datatypes.html#character_large_object_type)
and [Large Objects](https://h2database.com/html/advanced.html#large_objects) section.

Mapped to ""java.sql.Blob"" (""java.io.InputStream"" is also supported).
","
BINARY LARGE OBJECT
BLOB(10K)
"

"Data Types","BOOLEAN Type","
BOOLEAN
","
Possible values: TRUE, FALSE, and UNKNOWN (NULL).

See also [boolean](https://h2database.com/html/grammar.html#boolean) literal grammar.
Mapped to ""java.lang.Boolean"".
","
BOOLEAN
"

"Data Types","TINYINT Type","
@h2@ TINYINT
","
Possible values are: -128 to 127.

See also [integer](https://h2database.com/html/grammar.html#int) literal grammar.

In JDBC this data type is mapped to ""java.lang.Integer"".
""java.lang.Byte"" is also supported.

In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger""
this data type is mapped to ""java.lang.Byte"".

","
TINYINT
"

"Data Types","SMALLINT Type","
SMALLINT
","
Possible values: -32768 to 32767.

See also [integer](https://h2database.com/html/grammar.html#int) literal grammar.

In JDBC this data type is mapped to ""java.lang.Integer"".
""java.lang.Short"" is also supported.

In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger""
this data type is mapped to ""java.lang.Short"".
","
SMALLINT
"

"Data Types","INTEGER Type","
INTEGER | INT
","
Possible values: -2147483648 to 2147483647.

See also [integer](https://h2database.com/html/grammar.html#int) literal grammar.
Mapped to ""java.lang.Integer"".
","
INTEGER
INT
"

"Data Types","BIGINT Type","
BIGINT
","
Possible values: -9223372036854775808 to 9223372036854775807.

See also [long](https://h2database.com/html/grammar.html#long) literal grammar.
Mapped to ""java.lang.Long"".
","
BIGINT
"

"Data Types","NUMERIC Type","
{ NUMERIC | DECIMAL | DEC } [ ( precisionInt [ , scaleInt ] ) ]
","
Data type with fixed decimal precision and scale.
This data type is recommended for storing currency values.

If precision is specified, it must be from 1 to 100000.
If scale is specified, it must be from 0 to 100000, 0 is default.

See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar.
Mapped to ""java.math.BigDecimal"".
","
NUMERIC(20, 2)
"

"Data Types","REAL Type","
REAL | FLOAT ( precisionInt )
","
A single precision floating point number.
Should not be used to represent currency values, because of rounding problems.
Precision value for FLOAT type name should be from 1 to 24.

See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar.
Mapped to ""java.lang.Float"".
","
REAL
"

"Data Types","DOUBLE PRECISION Type","
DOUBLE PRECISION | FLOAT [ ( precisionInt ) ]
","
A double precision floating point number.
Should not be used to represent currency values, because of rounding problems.
If precision value is specified for FLOAT type name, it should be from 25 to 53.

See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar.
Mapped to ""java.lang.Double"".
","
DOUBLE PRECISION
"

"Data Types","DECFLOAT Type","
DECFLOAT [ ( precisionInt ) ]
","
Decimal floating point number.
This data type is not recommended to represent currency values, because of variable scale.

If precision is specified, it must be from 1 to 100000.

See also [numeric](https://h2database.com/html/grammar.html#numeric) literal grammar.
Mapped to ""java.math.BigDecimal"".
There are three special values: 'Infinity', '-Infinity', and 'NaN'.
These special values can't be read or set as ""BigDecimal"" values,
but they can be read or set using ""java.lang.String"", float, or double.
","
DECFLOAT
DECFLOAT(20)
"

"Data Types","DATE Type","
DATE
","
The date data type. The proleptic Gregorian calendar is used.

See also [date](https://h2database.com/html/grammar.html#date) literal grammar.

In JDBC this data type is mapped to ""java.sql.Date"", with the time set to ""00:00:00""
(or to the next possible time if midnight doesn't exist for the given date and time zone due to a daylight saving change).
""java.time.LocalDate"" is also supported and recommended.

In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger""
this data type is mapped to ""java.time.LocalDate"".

If your time zone had LMT (local mean time) in the past and you use such old dates
(depends on the time zone, usually 100 or more years ago),
don't use ""java.sql.Date"" to read and write them.

If you deal with very old dates (before 1582-10-15) note that ""java.sql.Date"" uses a mixed Julian/Gregorian calendar,
""java.util.GregorianCalendar"" can be configured to proleptic Gregorian with
""setGregorianChange(new java.util.Date(Long.MIN_VALUE))"" and used to read or write fields of dates.
","
DATE
"

"Data Types","TIME Type","
TIME [ ( precisionInt ) ] [ WITHOUT TIME ZONE ]
","
The time data type. The format is hh:mm:ss[.nnnnnnnnn].
If fractional seconds precision is specified it should be from 0 to 9, 0 is default.

See also [time](https://h2database.com/html/grammar.html#time) literal grammar.

In JDBC this data type is mapped to ""java.sql.Time"".
""java.time.LocalTime"" is also supported and recommended.

In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger""
this data type is mapped to ""java.time.LocalTime"".

Use ""java.time.LocalTime"" or ""String"" instead of ""java.sql.Time"" when non-zero precision is needed.
Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up;
if result of rounding is higher than maximum supported value 23:59:59.999999999 the value is rounded down instead.
The CAST operation to TIMESTAMP and TIMESTAMP WITH TIME ZONE data types uses the
[CURRENT_DATE](https://h2database.com/html/functions.html#current_date) for date fields.
","
TIME
TIME(9)
"

"Data Types","TIME WITH TIME ZONE Type","
TIME [ ( precisionInt ) ] WITH TIME ZONE
","
The time with time zone data type.
If fractional seconds precision is specified it should be from 0 to 9, 0 is default.

See also [time with time zone](https://h2database.com/html/grammar.html#time_with_time_zone) literal grammar.
Mapped to ""java.time.OffsetTime"".
Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up;
if result of rounding is higher than maximum supported value 23:59:59.999999999 the value is rounded down instead.
The CAST operation to TIMESTAMP and TIMESTAMP WITH TIME ZONE data types uses the
[CURRENT_DATE](https://h2database.com/html/functions.html#current_date) for date fields.
","
TIME WITH TIME ZONE
TIME(9) WITH TIME ZONE
"

"Data Types","TIMESTAMP Type","
TIMESTAMP [ ( precisionInt ) ] [ WITHOUT TIME ZONE ]
","
The timestamp data type. The proleptic Gregorian calendar is used.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.

This data type holds the local date and time without time zone information.
It cannot distinguish timestamps near transitions from DST to normal time.
For absolute timestamps use the [TIMESTAMP WITH TIME ZONE](https://h2database.com/html/datatypes.html#timestamp_with_time_zone_type) data type instead.

See also [timestamp](https://h2database.com/html/grammar.html#timestamp) literal grammar.

In JDBC this data type is mapped to ""java.sql.Timestamp"" (""java.util.Date"" may be used too).
""java.time.LocalDateTime"" is also supported and recommended.

In ""org.h2.api.Aggregate"", ""org.h2.api.AggregateFunction"", and ""org.h2.api.Trigger""
this data type is mapped to ""java.time.LocalDateTime"".

If your time zone had LMT (local mean time) in the past and you use such old dates
(depends on the time zone, usually 100 or more years ago),
don't use ""java.sql.Timestamp"" and ""java.util.Date"" to read and write them.

If you deal with very old dates (before 1582-10-15) note that ""java.sql.Timestamp"" and ""java.util.Date""
use a mixed Julian/Gregorian calendar, ""java.util.GregorianCalendar"" can be configured to proleptic Gregorian with
""setGregorianChange(new java.util.Date(Long.MIN_VALUE))"" and used to read or write fields of timestamps.

Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up.
","
TIMESTAMP
TIMESTAMP(9)
"

"Data Types","TIMESTAMP WITH TIME ZONE Type","
TIMESTAMP [ ( precisionInt ) ] WITH TIME ZONE
","
The timestamp with time zone data type. The proleptic Gregorian calendar is used.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.

See also [timestamp with time zone](https://h2database.com/html/grammar.html#timestamp_with_time_zone) literal grammar.
Mapped to ""java.time.OffsetDateTime"".
""java.time.ZonedDateTime"" and ""java.time.Instant"" are also supported.

Values of this data type are compared by UTC values. It means that ""2010-01-01 10:00:00+01"" is greater than ""2010-01-01 11:00:00+03"".

Conversion to ""TIMESTAMP"" uses time zone offset to get UTC time and converts it to local time using the system time zone.
Conversion from ""TIMESTAMP"" does the same operations in reverse and sets time zone offset to offset of the system time zone.
Cast from higher fractional seconds precision to lower fractional seconds precision performs round half up.
","
TIMESTAMP WITH TIME ZONE
TIMESTAMP(9) WITH TIME ZONE
"

"Data Types","INTERVAL Type","
intervalYearType | intervalMonthType | intervalDayType
    | intervalHourType| intervalMinuteType | intervalSecondType
    | intervalYearToMonthType | intervalDayToHourType
    | intervalDayToMinuteType | intervalDayToSecondType
    | intervalHourToMinuteType | intervalHourToSecondType
    | intervalMinuteToSecondType
","
Interval data type.
There are two classes of intervals. Year-month intervals can store years and months.
Day-time intervals can store days, hours, minutes, and seconds.
Year-month intervals are comparable only with another year-month intervals.
Day-time intervals are comparable only with another day-time intervals.

Mapped to ""org.h2.api.Interval"".
","
INTERVAL DAY TO SECOND
"

"Data Types","JAVA_OBJECT Type","
@h2@ { JAVA_OBJECT | OBJECT | OTHER } [ ( lengthInt ) ]
","
This type allows storing serialized Java objects. Internally, a byte array with serialized form is used.
The allowed length is from 1 (useful only with custom serializer) to 1,000,000,000 bytes.
The length is a size constraint; only the actual data is persisted.

Serialization and deserialization is done on the client side only with two exclusions described below.
Deserialization is only done when ""getObject"" is called.
Java operations cannot be executed inside the database engine for security reasons.
Use ""PreparedStatement.setObject"" with ""Types.JAVA_OBJECT"" or ""H2Type.JAVA_OBJECT""
as a third argument to store values.

If Java method alias has ""Object"" parameter(s), values are deserialized during invocation of this method
on the server side.

If a [linked table](https://h2database.com/html/advanced.html#linked_tables) has a column with ""Types.JAVA_OBJECT""
JDBC data type and its database is not an another H2, Java objects need to be serialized and deserialized during
interaction between H2 and database that owns the table on the server side of H2.

This data type needs special attention in secure environments.

Mapped to ""java.lang.Object"" (or any subclass).
","
JAVA_OBJECT
JAVA_OBJECT(10000)
"

"Data Types","ENUM Type","
@h2@ ENUM (string [, ... ])
","
A type with enumerated values.
Mapped to ""java.lang.String"".

Duplicate and empty values are not permitted.
The maximum number of values is 65536.
The maximum allowed length of complete data type definition with all values is 1,000,000,000 characters.
","
ENUM('clubs', 'diamonds', 'hearts', 'spades')
"

"Data Types","GEOMETRY Type","
@h2@ GEOMETRY
    [({ GEOMETRY |
    { POINT
    | LINESTRING
    | POLYGON
    | MULTIPOINT
    | MULTILINESTRING
    | MULTIPOLYGON
    | GEOMETRYCOLLECTION } [Z|M|ZM]}
    [, sridInt] )]
","
A spatial geometry type.
If additional constraints are not specified this type accepts all supported types of geometries.
A constraint with required geometry type and dimension system can be set by specifying name of the type and
dimension system. A whitespace between them is optional.
2D dimension system does not have a name and assumed if only a geometry type name is specified.
POINT means 2D point, POINT Z or POINTZ means 3D point.
GEOMETRY constraint means no restrictions on type or dimension system of geometry.
A constraint with required spatial reference system identifier (SRID) can be set by specifying this identifier.

Mapped to ""org.locationtech.jts.geom.Geometry"" if JTS library is in classpath and to ""java.lang.String"" otherwise.
May be represented in textual format using the WKT (well-known text) or EWKT (extended well-known text) format.
Values are stored internally in EWKB (extended well-known binary) format,
the maximum allowed length is 1,000,000,000 bytes.
Only a subset of EWKB and EWKT features is supported.
Supported objects are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION.
Supported dimension systems are 2D (XY), Z (XYZ), M (XYM), and ZM (XYZM).
SRID (spatial reference system identifier) is supported.

Use a quoted string containing a WKT/EWKT formatted string or ""PreparedStatement.setObject()"" to store values,
and ""ResultSet.getObject(..)"" or ""ResultSet.getString(..)"" to retrieve the values.
","
GEOMETRY
GEOMETRY(POINT)
GEOMETRY(POINT Z)
GEOMETRY(POINT Z, 4326)
GEOMETRY(GEOMETRY, 4326)
"

"Data Types","JSON Type","
@h2@ JSON [(lengthInt)]
","
A RFC 8259-compliant JSON text.

See also [json](https://h2database.com/html/grammar.html#json) literal grammar.
Mapped to ""byte[]"".
The allowed length is from 1 to 1,000,000,000 bytes.
The length is a size constraint; only the actual data is persisted.

To set a JSON value with ""java.lang.String"" in a PreparedStatement use a ""FORMAT JSON"" data format
(""INSERT INTO TEST(ID, DATA) VALUES (?, ? FORMAT JSON)"").
Without the data format VARCHAR values are converted to a JSON string values.

Order of object members is preserved as is.
Duplicate object member names are allowed.
","
JSON
"

"Data Types","UUID Type","
@h2@ UUID
","
Universally unique identifier. This is a 128 bit value.
To store values, use ""PreparedStatement.setBytes"",
""setString"", or ""setObject(uuid)"" (where ""uuid"" is a ""java.util.UUID"").
""ResultSet.getObject"" will return a ""java.util.UUID"".

Please note that using an index on randomly generated data will
result on poor performance once there are millions of rows in a table.
The reason is that the cache behavior is very bad with randomly distributed data.
This is a problem for any database system.

For details, see the documentation of ""java.util.UUID"".
","
UUID
"

"Data Types","ARRAY Type","
baseDataType ARRAY [ '[' maximumCardinalityInt ']' ]
","
A data type for array of values.
Base data type specifies the data type of elements.
Array may have NULL elements.
Maximum cardinality, if any, specifies maximum allowed number of elements in the array.
The allowed cardinality is from 0 to 65536 elements.

See also [array](https://h2database.com/html/grammar.html#array) literal grammar.
Mapped to ""java.lang.Object[]"" (arrays of any non-primitive type are also supported).

Use ""PreparedStatement.setArray(..)"" or ""PreparedStatement.setObject(.., new Object[] {..})"" to store values,
and ""ResultSet.getObject(..)"" or ""ResultSet.getArray(..)"" to retrieve the values.
","
BOOLEAN ARRAY
VARCHAR(100) ARRAY
INTEGER ARRAY[10]
"

"Data Types","ROW Type","
ROW (fieldName dataType [,...])
","
A row value data type. This data type should not be normally used as data type of a column.

See also [row value expression](https://h2database.com/html/grammar.html#row_value_expression) grammar.
Mapped to ""java.sql.ResultSet"".
","
ROW(A INT, B VARCHAR(10))
"

"Interval Data Types","INTERVAL YEAR Type","
INTERVAL YEAR [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.

See also [year interval](https://h2database.com/html/grammar.html#interval_year) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Period"" is also supported.
","
INTERVAL YEAR
"

"Interval Data Types","INTERVAL MONTH Type","
INTERVAL MONTH [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.

See also [month interval](https://h2database.com/html/grammar.html#interval_month) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Period"" is also supported.
","
INTERVAL MONTH
"

"Interval Data Types","INTERVAL DAY Type","
INTERVAL DAY [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.

See also [day interval](https://h2database.com/html/grammar.html#interval_day) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL DAY
"

"Interval Data Types","INTERVAL HOUR Type","
INTERVAL HOUR [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.

See also [hour interval](https://h2database.com/html/grammar.html#interval_hour) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL HOUR
"

"Interval Data Types","INTERVAL MINUTE Type","
INTERVAL MINUTE [ ( precisionInt ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.

See also [minute interval](https://h2database.com/html/grammar.html#interval_minute) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL MINUTE
"

"Interval Data Types","INTERVAL SECOND Type","
INTERVAL SECOND [ ( precisionInt [, fractionalPrecisionInt ] ) ]
","
Interval data type.
If precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.

See also [second interval](https://h2database.com/html/grammar.html#interval_second) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL SECOND
"

"Interval Data Types","INTERVAL YEAR TO MONTH Type","
INTERVAL YEAR [ ( precisionInt ) ] TO MONTH
","
Interval data type.
If leading field precision is specified it should be from 1 to 18, 2 is default.

See also [year to month interval](https://h2database.com/html/grammar.html#interval_year_to_month) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Period"" is also supported.
","
INTERVAL YEAR TO MONTH
"

"Interval Data Types","INTERVAL DAY TO HOUR Type","
INTERVAL DAY [ ( precisionInt ) ] TO HOUR
","
Interval data type.
If leading field precision is specified it should be from 1 to 18, 2 is default.

See also [day to hour interval](https://h2database.com/html/grammar.html#interval_day_to_hour) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL DAY TO HOUR
"

"Interval Data Types","INTERVAL DAY TO MINUTE Type","
INTERVAL DAY [ ( precisionInt ) ] TO MINUTE
","
Interval data type.
If leading field precision is specified it should be from 1 to 18, 2 is default.

See also [day to minute interval](https://h2database.com/html/grammar.html#interval_day_to_minute) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL DAY TO MINUTE
"

"Interval Data Types","INTERVAL DAY TO SECOND Type","
INTERVAL DAY [ ( precisionInt ) ] TO SECOND [ ( fractionalPrecisionInt ) ]
","
Interval data type.
If leading field precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.

See also [day to second interval](https://h2database.com/html/grammar.html#interval_day_to_second) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL DAY TO SECOND
"

"Interval Data Types","INTERVAL HOUR TO MINUTE Type","
INTERVAL HOUR [ ( precisionInt ) ] TO MINUTE
","
Interval data type.
If leading field precision is specified it should be from 1 to 18, 2 is default.

See also [hour to minute interval](https://h2database.com/html/grammar.html#interval_hour_to_minute) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL HOUR TO MINUTE
"

"Interval Data Types","INTERVAL HOUR TO SECOND Type","
INTERVAL HOUR [ ( precisionInt ) ] TO SECOND [ ( fractionalPrecisionInt ) ]
","
Interval data type.
If leading field precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.

See also [hour to second interval](https://h2database.com/html/grammar.html#interval_hour_to_second) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL HOUR TO SECOND
"

"Interval Data Types","INTERVAL MINUTE TO SECOND Type","
INTERVAL MINUTE [ ( precisionInt ) ] TO SECOND [ ( fractionalPrecisionInt ) ]
","
Interval data type.
If leading field precision is specified it should be from 1 to 18, 2 is default.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.

See also [minute to second interval](https://h2database.com/html/grammar.html#interval_minute_to_second) literal grammar.
Mapped to ""org.h2.api.Interval"".
""java.time.Duration"" is also supported.
","
INTERVAL MINUTE TO SECOND
"

"Functions (Numeric)","ABS","
ABS( { numeric | interval } )
","
Returns the absolute value of a specified value.
The returned value is of the same data type as the parameter.

Note that TINYINT, SMALLINT, INT, and BIGINT data types cannot represent absolute values
of their minimum negative values, because they have more negative values than positive.
For example, for INT data type allowed values are from -2147483648 to 2147483647.
ABS(-2147483648) should be 2147483648, but this value is not allowed for this data type.
It leads to an exception.
To avoid it cast argument of this function to a higher data type.
","
ABS(I)
ABS(CAST(I AS BIGINT))
"

"Functions (Numeric)","ACOS","
ACOS(numeric)
","
Calculate the arc cosine.
See also Java ""Math.acos"".
This method returns a double.
","
ACOS(D)
"

"Functions (Numeric)","ASIN","
ASIN(numeric)
","
Calculate the arc sine.
See also Java ""Math.asin"".
This method returns a double.
","
ASIN(D)
"

"Functions (Numeric)","ATAN","
ATAN(numeric)
","
Calculate the arc tangent.
See also Java ""Math.atan"".
This method returns a double.
","
ATAN(D)
"

"Functions (Numeric)","COS","
COS(numeric)
","
Calculate the trigonometric cosine.
See also Java ""Math.cos"".
This method returns a double.
","
COS(ANGLE)
"

"Functions (Numeric)","COSH","
COSH(numeric)
","
Calculate the hyperbolic cosine.
See also Java ""Math.cosh"".
This method returns a double.
","
COSH(X)
"

"Functions (Numeric)","COT","
@h2@ COT(numeric)
","
Calculate the trigonometric cotangent (""1/TAN(ANGLE)"").
See also Java ""Math.*"" functions.
This method returns a double.
","
COT(ANGLE)
"

"Functions (Numeric)","SIN","
SIN(numeric)
","
Calculate the trigonometric sine.
See also Java ""Math.sin"".
This method returns a double.
","
SIN(ANGLE)
"

"Functions (Numeric)","SINH","
SINH(numeric)
","
Calculate the hyperbolic sine.
See also Java ""Math.sinh"".
This method returns a double.
","
SINH(ANGLE)
"

"Functions (Numeric)","TAN","
TAN(numeric)
","
Calculate the trigonometric tangent.
See also Java ""Math.tan"".
This method returns a double.
","
TAN(ANGLE)
"

"Functions (Numeric)","TANH","
TANH(numeric)
","
Calculate the hyperbolic tangent.
See also Java ""Math.tanh"".
This method returns a double.
","
TANH(X)
"

"Functions (Numeric)","ATAN2","
@h2@ ATAN2(numeric, numeric)
","
Calculate the angle when converting the rectangular coordinates to polar coordinates.
See also Java ""Math.atan2"".
This method returns a double.
","
ATAN2(X, Y)
"

"Functions (Numeric)","BITAND","
@h2@ BITAND(expression, expression)
","
The bitwise AND operation.
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

For aggregate function see [BIT_AND_AGG](https://h2database.com/html/functions-aggregate.html#bit_and_agg).
","
BITAND(A, B)
"

"Functions (Numeric)","BITOR","
@h2@ BITOR(expression, expression)
","
The bitwise OR operation.
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

For aggregate function see [BIT_OR_AGG](https://h2database.com/html/functions-aggregate.html#bit_or_agg).
","
BITOR(A, B)
"

"Functions (Numeric)","BITXOR","
@h2@ BITXOR(expression, expression)
","
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

For aggregate function see [BIT_XOR_AGG](https://h2database.com/html/functions-aggregate.html#bit_xor_agg).
","
The bitwise XOR operation.
","
BITXOR(A, B)
"

"Functions (Numeric)","BITNOT","
@h2@ BITNOT(expression)
","
The bitwise NOT operation.
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.
","
BITNOT(A)
"

"Functions (Numeric)","BITNAND","
@h2@ BITNAND(expression, expression)
","
The bitwise NAND operation equivalent to ""BITNOT(BITAND(expression, expression))"".
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

For aggregate function see [BIT_NAND_AGG](https://h2database.com/html/functions-aggregate.html#bit_nand_agg).
","
BITNAND(A, B)
"

"Functions (Numeric)","BITNOR","
@h2@ BITNOR(expression, expression)
","
The bitwise NOR operation equivalent to ""BITNOT(BITOR(expression, expression))"".
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

For aggregate function see [BIT_NOR_AGG](https://h2database.com/html/functions-aggregate.html#bit_nor_agg).
","
BITNOR(A, B)
"

"Functions (Numeric)","BITXNOR","
@h2@ BITXNOR(expression, expression)
","
The bitwise XNOR operation equivalent to ""BITNOT(BITXOR(expression, expression))"".
Arguments should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

For aggregate function see [BIT_XNOR_AGG](https://h2database.com/html/functions-aggregate.html#bit_xnor_agg).
","
BITXNOR(A, B)
"

"Functions (Numeric)","BITGET","
@h2@ BITGET(expression, long)
","
Returns true if and only if the first argument has a bit set in the
position specified by the second parameter.
The first argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This method returns a boolean.
The second argument is zero-indexed; the least significant bit has position 0.
","
BITGET(A, 1)
"

"Functions (Numeric)","BITCOUNT","
@h2@ BITCOUNT(expression)
","
Returns count of set bits in the specified value.
Value should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This method returns a long.
","
BITCOUNT(A)
"

"Functions (Numeric)","LSHIFT","
@h2@ LSHIFT(expression, long)
","
The bitwise signed left shift operation.
Shifts the first argument by the number of bits given by the second argument.
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

If number of bits is negative, a signed right shift is performed instead.
For numeric values a sign bit is used for left-padding (with negative offset).
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value.
For binary string arguments signed and unsigned shifts return the same results.
","
LSHIFT(A, B)
"

"Functions (Numeric)","RSHIFT","
@h2@ RSHIFT(expression, long)
","
The bitwise signed right shift operation.
Shifts the first argument by the number of bits given by the second argument.
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

If number of bits is negative, a signed left shift is performed instead.
For numeric values a sign bit is used for left-padding (with positive offset).
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value.
For binary string arguments signed and unsigned shifts return the same results.
","
RSHIFT(A, B)
"

"Functions (Numeric)","ULSHIFT","
@h2@ ULSHIFT(expression, long)
","
The bitwise unsigned left shift operation.
Shifts the first argument by the number of bits given by the second argument.
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

If number of bits is negative, an unsigned right shift is performed instead.
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value.
For binary string arguments signed and unsigned shifts return the same results.
","
ULSHIFT(A, B)
"

"Functions (Numeric)","URSHIFT","
@h2@ URSHIFT(expression, long)
","
The bitwise unsigned right shift operation.
Shifts the first argument by the number of bits given by the second argument.
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.

If number of bits is negative, an unsigned left shift is performed instead.
If number of bits is equal to or larger than number of bits in value all bits are pushed out from the value.
For binary string arguments signed and unsigned shifts return the same results.
","
URSHIFT(A, B)
"

"Functions (Numeric)","ROTATELEFT","
@h2@ ROTATELEFT(expression, long)
","
The bitwise left rotation operation.
Rotates the first argument by the number of bits given by the second argument.
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.
","
ROTATELEFT(A, B)
"

"Functions (Numeric)","ROTATERIGHT","
@h2@ ROTATERIGHT(expression, long)
","
The bitwise right rotation operation.
Rotates the first argument by the number of bits given by the second argument.
Argument should have TINYINT, SMALLINT, INTEGER, BIGINT, BINARY, or BINARY VARYING data type.
This function returns result of the same data type.
","
ROTATERIGHT(A, B)
"

"Functions (Numeric)","MOD","
MOD(dividendNumeric, divisorNumeric)
","
The modulus expression.

Result has the same type as divisor.
Result is NULL if either of arguments is NULL.
If divisor is 0, an exception is raised.
Result has the same sign as dividend or is equal to 0.

Usually arguments should have scale 0, but it isn't required by H2.
","
MOD(A, B)
"

"Functions (Numeric)","CEIL","
{ CEIL | CEILING } (numeric)
","
Returns the smallest integer value that is greater than or equal to the argument.
This method returns value of the same type as argument, but with scale set to 0 and adjusted precision, if applicable.
","
CEIL(A)
"

"Functions (Numeric)","DEGREES","
@h2@ DEGREES(numeric)
","
See also Java ""Math.toDegrees"".
This method returns a double.
","
DEGREES(A)
"

"Functions (Numeric)","EXP","
EXP(numeric)
","
See also Java ""Math.exp"".
This method returns a double.
","
EXP(A)
"

"Functions (Numeric)","FLOOR","
FLOOR(numeric)
","
Returns the largest integer value that is less than or equal to the argument.
This method returns value of the same type as argument, but with scale set to 0 and adjusted precision, if applicable.
","
FLOOR(A)
"

"Functions (Numeric)","LN","
LN(numeric)
","
Calculates the natural (base e) logarithm as a double value.
Argument must be a positive numeric value.
","
LN(A)
"

"Functions (Numeric)","LOG","
LOG({baseNumeric, numeric | @c@{numeric}})
","
Calculates the logarithm with specified base as a double value.
Argument and base must be positive numeric values.
Base cannot be equal to 1.

The default base is e (natural logarithm), in the PostgreSQL mode the default base is base 10.
In MSSQLServer mode the optional base is specified after the argument.

Single-argument variant of LOG function is deprecated, use [LN](https://h2database.com/html/functions.html#ln)
or [LOG10](https://h2database.com/html/functions.html#log10) instead.
","
LOG(2, A)
"

"Functions (Numeric)","LOG10","
LOG10(numeric)
","
Calculates the base 10 logarithm as a double value.
Argument must be a positive numeric value.
","
LOG10(A)
"

"Functions (Numeric)","ORA_HASH","
@c@ ORA_HASH(expression [, bucketLong [, seedLong]])
","
Computes a hash value.
Optional bucket argument determines the maximum returned value.
This argument should be between 0 and 4294967295, default is 4294967295.
Optional seed argument is combined with the given expression to return the different values for the same expression.
This argument should be between 0 and 4294967295, default is 0.
This method returns a long value between 0 and the specified or default bucket value inclusive.
","
ORA_HASH(A)
"

"Functions (Numeric)","RADIANS","
@h2@ RADIANS(numeric)
","
See also Java ""Math.toRadians"".
This method returns a double.
","
RADIANS(A)
"

"Functions (Numeric)","SQRT","
SQRT(numeric)
","
See also Java ""Math.sqrt"".
This method returns a double.
","
SQRT(A)
"

"Functions (Numeric)","PI","
@h2@ PI()
","
See also Java ""Math.PI"".
This method returns a double.
","
PI()
"

"Functions (Numeric)","POWER","
POWER(numeric, numeric)
","
See also Java ""Math.pow"".
This method returns a double.
","
POWER(A, B)
"

"Functions (Numeric)","RAND","
@h2@ { RAND | RANDOM } ( [ int ] )
","
Calling the function without parameter returns the next a pseudo random number.
Calling it with an parameter seeds the session's random number generator.
This method returns a double between 0 (including) and 1 (excluding).
","
RAND()
"

"Functions (Numeric)","RANDOM_UUID","
@h2@ { RANDOM_UUID | UUID } ()
","
Returns a new UUID with 122 pseudo random bits.

Please note that using an index on randomly generated data will
result on poor performance once there are millions of rows in a table.
The reason is that the cache behavior is very bad with randomly distributed data.
This is a problem for any database system.
","
RANDOM_UUID()
"

"Functions (Numeric)","ROUND","
@h2@ ROUND(numeric [, digitsInt])
","
Rounds to a number of fractional digits.
This method returns value of the same type as argument, but with adjusted precision and scale, if applicable.
","
ROUND(N, 2)
"

"Functions (Numeric)","SECURE_RAND","
@h2@ SECURE_RAND(int)
","
Generates a number of cryptographically secure random numbers.
This method returns bytes.
","
CALL SECURE_RAND(16)
"

"Functions (Numeric)","SIGN","
@h2@ SIGN( { numeric | interval } )
","
Returns -1 if the value is smaller than 0, 0 if zero or NaN, and otherwise 1.
","
SIGN(N)
"

"Functions (Numeric)","ENCRYPT","
@h2@ ENCRYPT(algorithmString, keyBytes, dataBytes)
","
Encrypts data using a key.
The supported algorithm is AES.
The block size is 16 bytes.
This method returns bytes.
","
CALL ENCRYPT('AES', '00', STRINGTOUTF8('Test'))
"

"Functions (Numeric)","DECRYPT","
@h2@ DECRYPT(algorithmString, keyBytes, dataBytes)
","
Decrypts data using a key.
The supported algorithm is AES.
The block size is 16 bytes.
This method returns bytes.
","
CALL TRIM(CHAR(0) FROM UTF8TOSTRING(
    DECRYPT('AES', '00', '3fabb4de8f1ee2e97d7793bab2db1116')))
"

"Functions (Numeric)","HASH","
@h2@ HASH(algorithmString, expression [, iterationInt])
","
Calculate the hash value using an algorithm, and repeat this process for a number of iterations.

This function supports MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, SHA3-256, SHA3-384, and SHA3-512
algorithms.
SHA-224, SHA-384, and SHA-512 may be unavailable in some JREs.

MD5 and SHA-1 algorithms should not be considered as secure.

If this function is used to encrypt a password, a random salt should be concatenated with a password and this salt and
result of the function should be stored to prevent a rainbow table attack and number of iterations should be large
enough to slow down a dictionary or a brute force attack.

This method returns bytes.
","
CALL HASH('SHA-256', 'Text', 1000)
CALL HASH('SHA3-256', X'0102')
"

"Functions (Numeric)","TRUNC","
@h2@ { TRUNC | TRUNCATE } ( { {numeric [, digitsInt] }
    | @c@ { timestamp | timestampWithTimeZone | date | timestampString } } )
","
When a numeric argument is specified, truncates it to a number of digits (to the next value closer to 0)
and returns value of the same type as argument, but with adjusted precision and scale, if applicable.

This function with datetime or string argument is deprecated, use
[DATE_TRUNC](https://h2database.com/html/functions.html#date_trunc) instead.
When used with a timestamp, truncates the timestamp to a date (day) value
and returns a timestamp with or without time zone depending on type of the argument.
When used with a date, returns a timestamp at start of this date.
When used with a timestamp as string, truncates the timestamp to a date (day) value
and returns a timestamp without time zone.
","
TRUNCATE(N, 2)
"

"Functions (Numeric)","COMPRESS","
@h2@ COMPRESS(dataBytes [, algorithmString])
","
Compresses the data using the specified compression algorithm.
Supported algorithms are: LZF (faster but lower compression; default), and DEFLATE (higher compression).
Compression does not always reduce size. Very small objects and objects with little redundancy may get larger.
This method returns bytes.
","
COMPRESS(STRINGTOUTF8('Test'))
"

"Functions (Numeric)","EXPAND","
@h2@ EXPAND(bytes)
","
Expands data that was compressed using the COMPRESS function.
This method returns bytes.
","
UTF8TOSTRING(EXPAND(COMPRESS(STRINGTOUTF8('Test'))))
"

"Functions (Numeric)","ZERO","
@h2@ ZERO()
","
Returns the value 0. This function can be used even if numeric literals are disabled.
","
ZERO()
"

"Functions (String)","ASCII","
@h2@ ASCII(string)
","
Returns the ASCII value of the first character in the string.
This method returns an int.
","
ASCII('Hi')
"
"Functions (String)","BIT_LENGTH","
@h2@ BIT_LENGTH(bytes)
","
Returns the number of bits in a binary string.
This method returns a long.
","
BIT_LENGTH(NAME)
"

"Functions (String)","CHAR_LENGTH","
{ CHAR_LENGTH | CHARACTER_LENGTH | @c@ { LENGTH } } ( string )
","
Returns the number of characters in a character string.
This method returns a long.
","
CHAR_LENGTH(NAME)
"

"Functions (String)","OCTET_LENGTH","
OCTET_LENGTH(bytes)
","
Returns the number of bytes in a binary string.
This method returns a long.
","
OCTET_LENGTH(NAME)
"

"Functions (String)","CHAR","
@h2@ { CHAR | CHR } ( int )
","
Returns the character that represents the ASCII value.
This method returns a string.
","
CHAR(65)
"

"Functions (String)","CONCAT","
@h2@ CONCAT(string, string [,...])
","
Combines strings.
Unlike with the operator ""||"", NULL parameters are ignored,
and do not cause the result to become NULL.
If all parameters are NULL the result is an empty string.
This method returns a string.
","
CONCAT(NAME, '!')
"

"Functions (String)","CONCAT_WS","
@h2@ CONCAT_WS(separatorString, string, string [,...])
","
Combines strings with separator.
If separator is NULL it is treated like an empty string.
Other NULL parameters are ignored.
Remaining non-NULL parameters, if any, are concatenated with the specified separator.
If there are no remaining parameters the result is an empty string.
This method returns a string.
","
CONCAT_WS(',', NAME, '!')
"

"Functions (String)","DIFFERENCE","
@h2@ DIFFERENCE(string, string)
","
Returns the difference between the sounds of two strings.
The difference is calculated as a number of matched characters
in the same positions in SOUNDEX representations of arguments.
This method returns an int between 0 and 4 inclusive, or null if any of its parameters is null.
Note that value of 0 means that strings are not similar to each other.
Value of 4 means that strings are fully similar to each other (have the same SOUNDEX representation).
","
DIFFERENCE(T1.NAME, T2.NAME)
"

"Functions (String)","HEXTORAW","
@h2@ HEXTORAW(string)
","
Converts a hex representation of a string to a string.
4 hex characters per string character are used.
","
HEXTORAW(DATA)
"

"Functions (String)","RAWTOHEX","
@h2@ RAWTOHEX({string|bytes})
","
Converts a string or bytes to the hex representation.
4 hex characters per string character are used.
This method returns a string.
","
RAWTOHEX(DATA)
"

"Functions (String)","INSERT Function","
@h2@ INSERT(originalString, startInt, lengthInt, addString)
","
Inserts a additional string into the original string at a specified start position.
The length specifies the number of characters that are removed at the start position in the original string.
This method returns a string.
","
INSERT(NAME, 1, 1, ' ')
"

"Functions (String)","LOWER","
{ LOWER | @c@ { LCASE } } ( string )
","
Converts a string to lowercase.
","
LOWER(NAME)
"

"Functions (String)","UPPER","
{ UPPER | @c@ { UCASE } } ( string )
","
Converts a string to uppercase.
","
UPPER(NAME)
"

"Functions (String)","LEFT","
@h2@ LEFT(string, int)
","
Returns the leftmost number of characters.
","
LEFT(NAME, 3)
"

"Functions (String)","RIGHT","
@h2@ RIGHT(string, int)
","
Returns the rightmost number of characters.
","
RIGHT(NAME, 3)
"

"Functions (String)","LOCATE","
@h2@ { LOCATE(searchString, string [, startInt]) }
    | @c@ { INSTR(string, searchString, [, startInt]) }
    | @c@ { POSITION(searchString, string) }
","
Returns the location of a search string in a string.
If a start position is used, the characters before it are ignored.
If position is negative, the rightmost location is returned.
0 is returned if the search string is not found.
Please note this function is case sensitive, even if the parameters are not.
","
LOCATE('.', NAME)
"

"Functions (String)","LPAD","
LPAD(string, int[, paddingString])
","
Left pad the string to the specified length.
If the length is shorter than the string, it will be truncated at the end.
If the padding string is not set, spaces will be used.
","
LPAD(AMOUNT, 10, '*')
"

"Functions (String)","RPAD","
RPAD(string, int[, paddingString])
","
Right pad the string to the specified length.
If the length is shorter than the string, it will be truncated.
If the padding string is not set, spaces will be used.
","
RPAD(TEXT, 10, '-')
"

"Functions (String)","LTRIM","
LTRIM(string [, charactersToTrimString])
","
Removes all leading spaces or other specified characters from a string, multiple characters can be specified.
","
LTRIM(NAME)
LTRIM(NAME, ' _~');
"

"Functions (String)","RTRIM","
RTRIM(string [, charactersToTrimString])
","
Removes all trailing spaces or other specified characters from a string, multiple characters can be specified.
","
RTRIM(NAME)
RTRIM(NAME, ' _~');
"

"Functions (String)","BTRIM","
BTRIM(string [, charactersToTrimString])
","
Removes all leading and trailing spaces or other specified characters from a string,
multiple characters can be specified.
","
BTRIM(NAME)
BTRIM(NAME, ' _~');
"

"Functions (String)","TRIM","
TRIM ( [ [ LEADING | TRAILING | BOTH ] [ characterToTrimString ] FROM ] string )
","
Removes all leading spaces, trailing spaces, or spaces at both ends from a string.
If character to trim is specified, these characters are removed instead of spaces, only one character can be specified.
To trim multiple different characters use [LTRIM](https://h2database.com/html/functions.html#ltrim),
[RTRIM](https://h2database.com/html/functions.html#rtrim),
or [BTRIM](https://h2database.com/html/functions.html#btrim).

If neither LEADING, TRAILING, nor BOTH are specified, BOTH is implicit.
","
TRIM(NAME)
TRIM(LEADING FROM NAME)
TRIM(BOTH '_' FROM NAME)
"

"Functions (String)","REGEXP_REPLACE","
@h2@ REGEXP_REPLACE(inputString, regexString, replacementString [, flagsString])
","
Replaces each substring that matches a regular expression.
For details, see the Java ""String.replaceAll()"" method.
If any parameter is null (except optional flagsString parameter), the result is null.

Flags values are limited to 'i', 'c', 'n', 'm'. Other symbols cause exception.
Multiple symbols could be used in one flagsString parameter (like 'im').
Later flags override first ones, for example 'ic' is equivalent to case sensitive matching 'c'.

'i' enables case insensitive matching (Pattern.CASE_INSENSITIVE)

'c' disables case insensitive matching (Pattern.CASE_INSENSITIVE)

'n' allows the period to match the newline character (Pattern.DOTALL)

'm' enables multiline mode (Pattern.MULTILINE)

","
REGEXP_REPLACE('Hello    World', ' +', ' ')
REGEXP_REPLACE('Hello WWWWorld', 'w+', 'W', 'i')
"

"Functions (String)","REGEXP_LIKE","
@h2@ REGEXP_LIKE(inputString, regexString [, flagsString])
","
Matches string to a regular expression.
For details, see the Java ""Matcher.find()"" method.
If any parameter is null (except optional flagsString parameter), the result is null.

Flags values are limited to 'i', 'c', 'n', 'm'. Other symbols cause exception.
Multiple symbols could be used in one flagsString parameter (like 'im').
Later flags override first ones, for example 'ic' is equivalent to case sensitive matching 'c'.

'i' enables case insensitive matching (Pattern.CASE_INSENSITIVE)

'c' disables case insensitive matching (Pattern.CASE_INSENSITIVE)

'n' allows the period to match the newline character (Pattern.DOTALL)

'm' enables multiline mode (Pattern.MULTILINE)

","
REGEXP_LIKE('Hello    World', '[A-Z ]*', 'i')
"

"Functions (String)","REGEXP_SUBSTR","
@h2@ REGEXP_SUBSTR(inputString, regexString [, positionInt, occurrenceInt, flagsString, groupInt])
","
Matches string to a regular expression and returns the matched substring.
For details, see the java.util.regex.Pattern and related functionality.

The parameter position specifies where in inputString the match should start. Occurrence indicates
which occurrence of pattern in inputString to search for.

Flags values are limited to 'i', 'c', 'n', 'm'. Other symbols cause exception.
Multiple symbols could be used in one flagsString parameter (like 'im').
Later flags override first ones, for example 'ic' is equivalent to case sensitive matching 'c'.

'i' enables case insensitive matching (Pattern.CASE_INSENSITIVE)

'c' disables case insensitive matching (Pattern.CASE_INSENSITIVE)

'n' allows the period to match the newline character (Pattern.DOTALL)

'm' enables multiline mode (Pattern.MULTILINE)

If the pattern has groups, the group parameter can be used to specify which group to return.

","
REGEXP_SUBSTR('2020-10-01', '\d{4}')
REGEXP_SUBSTR('2020-10-01', '(\d{4})-(\d{2})-(\d{2})', 1, 1, NULL, 2)
"

"Functions (String)","REPEAT","
@h2@ REPEAT(string, int)
","
Returns a string repeated some number of times.
","
REPEAT(NAME || ' ', 10)
"

"Functions (String)","REPLACE","
@h2@ REPLACE(string, searchString [, replacementString])
","
Replaces all occurrences of a search string in a text with another string.
If no replacement is specified, the search string is removed from the original string.
If any parameter is null, the result is null.
","
REPLACE(NAME, ' ')
"

"Functions (String)","SOUNDEX","
@h2@ SOUNDEX(string)
","
Returns a four character upper-case code representing the sound of a string as pronounced in English.
This method returns a string, or null if parameter is null.
See https://en.wikipedia.org/wiki/Soundex for more information.
","
SOUNDEX(NAME)
"

"Functions (String)","SPACE","
@h2@ SPACE(int)
","
Returns a string consisting of a number of spaces.
","
SPACE(80)
"

"Functions (String)","STRINGDECODE","
@h2@ STRINGDECODE(string)
","
Converts a encoded string using the Java string literal encoding format.
Special characters are \b, \t, \n, \f, \r, \"", \\, \, \u.
This method returns a string.
","
CALL STRINGENCODE(STRINGDECODE('Lines 1\nLine 2'))
"

"Functions (String)","STRINGENCODE","
@h2@ STRINGENCODE(string)
","
Encodes special characters in a string using the Java string literal encoding format.
Special characters are \b, \t, \n, \f, \r, \"", \\, \, \u.
This method returns a string.
","
CALL STRINGENCODE(STRINGDECODE('Lines 1\nLine 2'))
"

"Functions (String)","STRINGTOUTF8","
@h2@ STRINGTOUTF8(string)
","
Encodes a string to a byte array using the UTF8 encoding format.
This method returns bytes.
","
CALL UTF8TOSTRING(STRINGTOUTF8('This is a test'))
"

"Functions (String)","SUBSTRING","
SUBSTRING ( {string|bytes} FROM startInt [ FOR lengthInt ] )
    | @c@ { { SUBSTRING | SUBSTR } ( {string|bytes}, startInt [, lengthInt ] ) }
","
Returns a substring of a string starting at a position.
If the start index is negative, then the start index is relative to the end of the string.
The length is optional.
","
CALL SUBSTRING('[Hello]' FROM 2 FOR 5);
CALL SUBSTRING('hour' FROM 2);
"

"Functions (String)","UTF8TOSTRING","
@h2@ UTF8TOSTRING(bytes)
","
Decodes a byte array in the UTF8 format to a string.
","
CALL UTF8TOSTRING(STRINGTOUTF8('This is a test'))
"

"Functions (String)","QUOTE_IDENT","
@h2@ QUOTE_IDENT(string)
","
Quotes the specified identifier.
Identifier is surrounded by double quotes.
If identifier contains double quotes they are repeated twice.
","
QUOTE_IDENT('Column 1')
"

"Functions (String)","XMLATTR","
@h2@ XMLATTR(nameString, valueString)
","
Creates an XML attribute element of the form ""name=value"".
The value is encoded as XML text.
This method returns a string.
","
CALL XMLNODE('a', XMLATTR('href', 'https://h2database.com'))
"

"Functions (String)","XMLNODE","
@h2@ XMLNODE(elementString [, attributesString [, contentString [, indentBoolean]]])
","
Create an XML node element.
An empty or null attribute string means no attributes are set.
An empty or null content string means the node is empty.
The content is indented by default if it contains a newline.
This method returns a string.
","
CALL XMLNODE('a', XMLATTR('href', 'https://h2database.com'), 'H2')
"

"Functions (String)","XMLCOMMENT","
@h2@ XMLCOMMENT(commentString)
","
Creates an XML comment.
Two dashes (""--"") are converted to ""- -"".
This method returns a string.
","
CALL XMLCOMMENT('Test')
"

"Functions (String)","XMLCDATA","
@h2@ XMLCDATA(valueString)
","
Creates an XML CDATA element.
If the value contains ""]]>"", an XML text element is created instead.
This method returns a string.
","
CALL XMLCDATA('data')
"

"Functions (String)","XMLSTARTDOC","
@h2@ XMLSTARTDOC()
","
Returns the XML declaration.
The result is always """".
","
CALL XMLSTARTDOC()
"

"Functions (String)","XMLTEXT","
@h2@ XMLTEXT(valueString [, escapeNewlineBoolean])
","
Creates an XML text element.
If enabled, newline and linefeed is converted to an XML entity (&#).
This method returns a string.
","
CALL XMLTEXT('test')
"

"Functions (String)","TO_CHAR","
@c@ TO_CHAR(value [, formatString[, nlsParamString]])
","
Oracle-compatible TO_CHAR function that can format a timestamp, a number, or text.
","
CALL TO_CHAR(TIMESTAMP '2010-01-01 00:00:00', 'DD MON, YYYY')
"

"Functions (String)","TRANSLATE","
@c@ TRANSLATE(value, searchString, replacementString)
","
Oracle-compatible TRANSLATE function that replaces a sequence of characters in a string with another set of characters.
","
CALL TRANSLATE('Hello world', 'eo', 'EO')
"

"Functions (Time and Date)","CURRENT_DATE","
CURRENT_DATE
","
Returns the current date.

These functions return the same value within a transaction (default)
or within a command depending on database mode.

[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value
for these functions using the same original UTC timestamp of transaction.
","
CURRENT_DATE
"

"Functions (Time and Date)","CURRENT_TIME","
CURRENT_TIME [ (int) ]
","
Returns the current time with time zone.
If fractional seconds precision is specified it should be from 0 to 9, 0 is default.
The specified value can be used only to limit precision of a result.
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher.
Higher precision is not available before Java 9.

This function returns the same value within a transaction (default)
or within a command depending on database mode.

[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value
for this function using the same original UTC timestamp of transaction.
","
CURRENT_TIME
CURRENT_TIME(9)
"

"Functions (Time and Date)","CURRENT_TIMESTAMP","
CURRENT_TIMESTAMP [ (int) ]
","
Returns the current timestamp with time zone.
Time zone offset is set to a current time zone offset.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.
The specified value can be used only to limit precision of a result.
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher.
Higher precision is not available before Java 9.

This function returns the same value within a transaction (default)
or within a command depending on database mode.

[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value
for this function using the same original UTC timestamp of transaction.
","
CURRENT_TIMESTAMP
CURRENT_TIMESTAMP(9)
"

"Functions (Time and Date)","LOCALTIME","
LOCALTIME [ (int) ]
","
Returns the current time without time zone.
If fractional seconds precision is specified it should be from 0 to 9, 0 is default.
The specified value can be used only to limit precision of a result.
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher.
Higher precision is not available before Java 9.

These functions return the same value within a transaction (default)
or within a command depending on database mode.

[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) command reevaluates the value
for these functions using the same original UTC timestamp of transaction.
","
LOCALTIME
LOCALTIME(9)
"

"Functions (Time and Date)","LOCALTIMESTAMP","
LOCALTIMESTAMP [ (int) ]
","
Returns the current timestamp without time zone.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.
The specified value can be used only to limit precision of a result.
The actual maximum available precision depends on operating system and JVM and can be 3 (milliseconds) or higher.
Higher precision is not available before Java 9.

The returned value has date and time without time zone information.
If time zone has DST transitions the returned values are ambiguous during transition from DST to normal time.
For absolute timestamps use the [CURRENT_TIMESTAMP](https://h2database.com/html/functions.html#current_timestamp)
function and [TIMESTAMP WITH TIME ZONE](https://h2database.com/html/datatypes.html#timestamp_with_time_zone_type)
data type.

These functions return the same value within a transaction (default)
or within a command depending on database mode.

[SET TIME ZONE](https://h2database.com/html/commands.html#set_time_zone) reevaluates the value
for these functions using the same original UTC timestamp of transaction.
","
LOCALTIMESTAMP
LOCALTIMESTAMP(9)
"

"Functions (Time and Date)","DATEADD","
@h2@ { DATEADD| TIMESTAMPADD } @h2@ (datetimeField, addIntLong, dateAndTime)
","
Adds units to a date-time value. The datetimeField indicates the unit.
Use negative values to subtract units.
addIntLong may be a long value when manipulating milliseconds,
microseconds, or nanoseconds otherwise its range is restricted to int.
This method returns a value with the same type as specified value if unit is compatible with this value.
If specified field is a HOUR, MINUTE, SECOND, MILLISECOND, etc and value is a DATE value DATEADD returns combined TIMESTAMP.
Fields DAY, MONTH, YEAR, WEEK, etc are not allowed for TIME values.
Fields TIMEZONE_HOUR, TIMEZONE_MINUTE, and TIMEZONE_SECOND are only allowed for TIMESTAMP WITH TIME ZONE values.
","
DATEADD(MONTH, 1, DATE '2001-01-31')
"

"Functions (Time and Date)","DATEDIFF","
@h2@ { DATEDIFF | TIMESTAMPDIFF } @h2@ (datetimeField, aDateAndTime, bDateAndTime)
","
Returns the number of crossed unit boundaries between two date/time values.
This method returns a long.
The datetimeField indicates the unit.
Only TIMEZONE_HOUR, TIMEZONE_MINUTE, and TIMEZONE_SECOND fields use the time zone offset component.
With all other fields if date/time values have time zone offset component it is ignored.
","
DATEDIFF(YEAR, T1.CREATED, T2.CREATED)
"

"Functions (Time and Date)","DATE_TRUNC","
@h2@ DATE_TRUNC(datetimeField, dateAndTime)
","
Truncates the specified date-time value to the specified field.
","
DATE_TRUNC(DAY, TIMESTAMP '2010-01-03 10:40:00');
"

"Functions (Time and Date)","LAST_DAY","
@h2@ LAST_DAY(date | timestamp | timestampWithTimeZone | string)
","
Returns the last day of the month that contains the specified date-time value.
This function returns a date.
","
LAST_DAY(DAY, DATE '2020-02-05');
"

"Functions (Time and Date)","DAYNAME","
@h2@ DAYNAME(dateAndTime)
","
Returns the name of the day (in English).
","
DAYNAME(CREATED)
"

"Functions (Time and Date)","DAY_OF_MONTH","
@c@ DAY_OF_MONTH({dateAndTime|interval})
","
Returns the day of the month (1-31).

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
DAY_OF_MONTH(CREATED)
"

"Functions (Time and Date)","DAY_OF_WEEK","
@c@ DAY_OF_WEEK(dateAndTime)
","
Returns the day of the week (1-7), locale-specific.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
DAY_OF_WEEK(CREATED)
"

"Functions (Time and Date)","ISO_DAY_OF_WEEK","
@c@ ISO_DAY_OF_WEEK(dateAndTime)
","
Returns the ISO day of the week (1 means Monday).

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
ISO_DAY_OF_WEEK(CREATED)
"

"Functions (Time and Date)","DAY_OF_YEAR","
@c@ DAY_OF_YEAR({dateAndTime|interval})
","
Returns the day of the year (1-366).

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
DAY_OF_YEAR(CREATED)
"

"Functions (Time and Date)","EXTRACT","
EXTRACT ( datetimeField FROM { dateAndTime | interval })
","
Returns a value of the specific time unit from a date/time value.
This method returns a numeric value with EPOCH field and
an int for all other fields.
","
EXTRACT(SECOND FROM CURRENT_TIMESTAMP)
"

"Functions (Time and Date)","FORMATDATETIME","
@h2@ FORMATDATETIME ( dateAndTime, formatString
[ , localeString [ , timeZoneString ] ] )
","
Formats a date, time or timestamp as a string.
The most important format characters are:
y year, M month, d day, H hour, m minute, s second.
For details of the format, see ""java.time.format.DateTimeFormatter"".
Allowed format characters depend on data type of passed date/time value.

If timeZoneString is specified, it is used in formatted string if formatString has time zone.
For TIME and TIME WITH TIME ZONE values the specified time zone must have a fixed offset.

If TIME WITH TIME ZONE is passed and timeZoneString is specified,
the time is converted to the specified time zone offset and its UTC value is preserved.
If TIMESTAMP WITH TIME ZONE is passed and timeZoneString is specified,
the timestamp is converted to the specified time zone and its UTC value is preserved.

This method returns a string.

See also [cast specification](https://h2database.com/html/grammar.html#cast_specification).
","
CALL FORMATDATETIME(TIMESTAMP '2001-02-03 04:05:06',
    'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT')
"

"Functions (Time and Date)","HOUR","
@c@ HOUR({dateAndTime|interval})
","
Returns the hour (0-23) from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
HOUR(CREATED)
"

"Functions (Time and Date)","MINUTE","
@c@ MINUTE({dateAndTime|interval})
","
Returns the minute (0-59) from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
MINUTE(CREATED)
"

"Functions (Time and Date)","MONTH","
@c@ MONTH({dateAndTime|interval})
","
Returns the month (1-12) from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
MONTH(CREATED)
"

"Functions (Time and Date)","MONTHNAME","
@h2@ MONTHNAME(dateAndTime)
","
Returns the name of the month (in English).
","
MONTHNAME(CREATED)
"

"Functions (Time and Date)","PARSEDATETIME","
@h2@ PARSEDATETIME(string, formatString
[, localeString [, timeZoneString]])
","
Parses a string and returns a TIMESTAMP WITH TIME ZONE value.
The most important format characters are:
y year, M month, d day, H hour, m minute, s second.
For details of the format, see ""java.time.format.DateTimeFormatter"".

If timeZoneString is specified, it is used as default.

See also [cast specification](https://h2database.com/html/grammar.html#cast_specification).
","
CALL PARSEDATETIME('Sat, 3 Feb 2001 03:05:06 GMT',
    'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT')
"

"Functions (Time and Date)","QUARTER","
@c@ QUARTER(dateAndTime)
","
Returns the quarter (1-4) from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
QUARTER(CREATED)
"

"Functions (Time and Date)","SECOND","
@c@ SECOND(dateAndTime)
","
Returns the second (0-59) from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
SECOND(CREATED|interval)
"

"Functions (Time and Date)","WEEK","
@c@ WEEK(dateAndTime)
","
Returns the week (1-53) from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.

This function uses the current system locale.
","
WEEK(CREATED)
"

"Functions (Time and Date)","ISO_WEEK","
@c@ ISO_WEEK(dateAndTime)
","
Returns the ISO week (1-53) from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.

This function uses the ISO definition when
first week of year should have at least four days
and week is started with Monday.
","
ISO_WEEK(CREATED)
"

"Functions (Time and Date)","YEAR","
@c@ YEAR({dateAndTime|interval})
","
Returns the year from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
YEAR(CREATED)
"

"Functions (Time and Date)","ISO_YEAR","
@c@ ISO_YEAR(dateAndTime)
","
Returns the ISO week year from a date/time value.

This function is deprecated, use [EXTRACT](https://h2database.com/html/functions.html#extract) instead of it.
","
ISO_YEAR(CREATED)
"

"Functions (System)","ABORT_SESSION","
@h2@ ABORT_SESSION(sessionInt)
","
Cancels the currently executing statement of another session. Closes the session and releases the allocated resources.
Returns true if the session was closed, false if no session with the given id was found.

If a client was connected while its session was aborted it will see an error.

Admin rights are required to execute this command.
","
CALL ABORT_SESSION(3)
"

"Functions (System)","ARRAY_GET","
@c@ ARRAY_GET(arrayExpression, indexExpression)
","
Returns element at the specified 1-based index from an array.

This function is deprecated, use
[array element reference](https://www.h2database.com/html/grammar.html#array_element_reference) instead of it.

Returns NULL if array or index is NULL.
","
CALL ARRAY_GET(ARRAY['Hello', 'World'], 2)
"

"Functions (System)","CARDINALITY","
{ CARDINALITY | @c@ { ARRAY_LENGTH } } (arrayExpression)
","
Returns the length of an array or JSON array.
Returns NULL if the specified array is NULL.
","
CALL CARDINALITY(ARRAY['Hello', 'World'])
CALL CARDINALITY(JSON '[1, 2, 3]')
"

"Functions (System)","ARRAY_CONTAINS","
@h2@ ARRAY_CONTAINS(arrayExpression, value)
","
Returns a boolean TRUE if the array contains the value or FALSE if it does not contain it.
Returns NULL if the specified array is NULL.
","
CALL ARRAY_CONTAINS(ARRAY['Hello', 'World'], 'Hello')
"

"Functions (System)","ARRAY_CAT","
@c@ ARRAY_CAT(arrayExpression, arrayExpression)
","
Returns the concatenation of two arrays.

This function is deprecated, use ""||"" instead of it.

Returns NULL if any parameter is NULL.
","
CALL ARRAY_CAT(ARRAY[1, 2], ARRAY[3, 4])
"

"Functions (System)","ARRAY_APPEND","
@c@ ARRAY_APPEND(arrayExpression, value)
","
Append an element to the end of an array.

This function is deprecated, use ""||"" instead of it.

Returns NULL if any parameter is NULL.
","
CALL ARRAY_APPEND(ARRAY[1, 2], 3)
"

"Functions (System)","ARRAY_MAX_CARDINALITY","
ARRAY_MAX_CARDINALITY(arrayExpression)
","
Returns the maximum allowed array cardinality (length) of the declared data type of argument.
","
SELECT ARRAY_MAX_CARDINALITY(COL1) FROM TEST FETCH FIRST ROW ONLY;
"

"Functions (System)","TRIM_ARRAY","
TRIM_ARRAY(arrayExpression, int)
","
Removes the specified number of elements from the end of the array.

Returns NULL if second parameter is NULL or if first parameter is NULL and second parameter is not negative.
Throws exception if second parameter is negative or larger than number of elements in array.
Otherwise returns the truncated array.
","
CALL TRIM_ARRAY(ARRAY[1, 2, 3, 4], 1)
"

"Functions (System)","ARRAY_SLICE","
@h2@ ARRAY_SLICE(arrayExpression, lowerBoundInt, upperBoundInt)
","
Returns elements from the array as specified by the lower and upper bound parameters.
Both parameters are inclusive and the first element has index 1, i.e. ARRAY_SLICE(a, 2, 2) has only the second element.
Returns NULL if any parameter is NULL or if an index is out of bounds.
","
CALL ARRAY_SLICE(ARRAY[1, 2, 3, 4], 1, 3)
"

"Functions (System)","AUTOCOMMIT","
@h2@ AUTOCOMMIT()
","
Returns true if auto commit is switched on for this session.
","
AUTOCOMMIT()
"

"Functions (System)","CANCEL_SESSION","
@h2@ CANCEL_SESSION(sessionInt)
","
Cancels the currently executing statement of another session.
Returns true if the statement was canceled, false if the session is closed or no statement is currently executing.

Admin rights are required to execute this command.
","
CANCEL_SESSION(3)
"

"Functions (System)","CASEWHEN Function","
@c@ CASEWHEN(boolean, aValue, bValue)
","
Returns 'aValue' if the boolean expression is true, otherwise 'bValue'.

This function is deprecated, use [CASE](https://h2database.com/html/grammar.html#searched_case) instead of it.
","
CASEWHEN(ID=1, 'A', 'B')
"

"Functions (System)","COALESCE","
{ COALESCE | @c@ { NVL } } (aValue, bValue [,...])
    | @c@ IFNULL(aValue, bValue)
","
Returns the first value that is not null.
","
COALESCE(A, B, C)
"

"Functions (System)","CONVERT","
@c@ CONVERT(value, dataTypeOrDomain)
","
Converts a value to another data type.

This function is deprecated, use [CAST](https://h2database.com/html/grammar.html#cast_specification) instead of it.
","
CONVERT(NAME, INT)
"

"Functions (System)","CURRVAL","
@c@ CURRVAL( [ schemaNameString, ] sequenceString )
","
Returns the latest generated value of the sequence for the current session.
Current value may only be requested after generation of the sequence value in the current session.
This method exists only for compatibility, when it isn't required use
[CURRENT VALUE FOR sequenceName](https://h2database.com/html/grammar.html#sequence_value_expression)
instead.
If the schema name is not set, the current schema is used.
When sequence is not found, the uppercase name is also checked.
This method returns a long.
","
CURRVAL('TEST_SEQ')
"

"Functions (System)","CSVWRITE","
@h2@ CSVWRITE ( fileNameString, queryString [, csvOptions [, lineSepString] ] )
","
Writes a CSV (comma separated values). The file is overwritten if it exists.
If only a file name is specified, it will be written to the current working directory.
For each parameter, NULL means the default value should be used.
The default charset is the default value for this system, and the default field separator is a comma.

The values are converted to text using the default string representation;
if another conversion is required you need to change the select statement accordingly.
The parameter nullString is used when writing NULL (by default nothing is written
when NULL appears). The default line separator is the default value for this
system (system property ""line.separator"").

The returned value is the number or rows written.
Admin rights are required to execute this command.
","
CALL CSVWRITE('data/test.csv', 'SELECT * FROM TEST');
CALL CSVWRITE('data/test2.csv', 'SELECT * FROM TEST', 'charset=UTF-8 fieldSeparator=|');
-- Write a tab-separated file
CALL CSVWRITE('data/test.tsv', 'SELECT * FROM TEST', 'charset=UTF-8 fieldSeparator=' || CHAR(9));
"

"Functions (System)","CURRENT_SCHEMA","
CURRENT_SCHEMA | @c@ SCHEMA()
","
Returns the name of the default schema for this session.
","
CALL CURRENT_SCHEMA
"

"Functions (System)","CURRENT_CATALOG","
CURRENT_CATALOG | @c@ DATABASE()
","
Returns the name of the database.
","
CALL CURRENT_CATALOG
"

"Functions (System)","DATABASE_PATH","
@h2@ DATABASE_PATH()
","
Returns the directory of the database files and the database name, if it is file based.
Returns NULL otherwise.
","
CALL DATABASE_PATH();
"

"Functions (System)","DATA_TYPE_SQL","
@h2@ DATA_TYPE_SQL
@h2@ (objectSchemaString, objectNameString, objectTypeString, typeIdentifierString)
","
Returns SQL representation of data type of the specified
constant, domain, table column, routine result or argument.

For constants object type is 'CONSTANT' and type identifier is the value of
""INFORMATION_SCHEMA.CONSTANTS.DTD_IDENTIFIER"".

For domains object type is 'DOMAIN' and type identifier is the value of
""INFORMATION_SCHEMA.DOMAINS.DTD_IDENTIFIER"".

For columns object type is 'TABLE' and type identifier is the value of
""INFORMATION_SCHEMA.COLUMNS.DTD_IDENTIFIER"".

For routines object name is the value of ""INFORMATION_SCHEMA.ROUTINES.SPECIFIC_NAME"",
object type is 'ROUTINE', and type identifier is the value of
""INFORMATION_SCHEMA.ROUTINES.DTD_IDENTIFIER"" for data type of the result and the value of
""INFORMATION_SCHEMA.PARAMETERS.DTD_IDENTIFIER"" for data types of arguments.
Aggregate functions aren't supported by this function, because their data type isn't statically known.

This function returns NULL if any argument is NULL, object type is not valid, or object isn't found.
","
DATA_TYPE_SQL('PUBLIC', 'C', 'CONSTANT', 'TYPE')
DATA_TYPE_SQL('PUBLIC', 'D', 'DOMAIN', 'TYPE')
DATA_TYPE_SQL('PUBLIC', 'T', 'TABLE', '1')
DATA_TYPE_SQL('PUBLIC', 'R_1', 'ROUTINE', 'RESULT')
DATA_TYPE_SQL('PUBLIC', 'R_1', 'ROUTINE', '1')
COALESCE(
    QUOTE_IDENT(DOMAIN_SCHEMA) || '.' || QUOTE_IDENT(DOMAIN_NAME),
    DATA_TYPE_SQL(TABLE_SCHEMA, TABLE_NAME, 'TABLE', DTD_IDENTIFIER))
"

"Functions (System)","DB_OBJECT_ID","
@h2@ DB_OBJECT_ID({{'ROLE'|'SETTING'|'SCHEMA'|'USER'}, objectNameString
    | {'CONSTANT'|'CONSTRAINT'|'DOMAIN'|'INDEX'|'ROUTINE'|'SEQUENCE'
        |'SYNONYM'|'TABLE'|'TRIGGER'}, schemaNameString, objectNameString })
","
Returns internal identifier of the specified database object as integer value or NULL if object doesn't exist.

Admin rights are required to execute this function.
","
CALL DB_OBJECT_ID('ROLE', 'MANAGER');
CALL DB_OBJECT_ID('TABLE', 'PUBLIC', 'MY_TABLE');
"

"Functions (System)","DB_OBJECT_SQL","
@h2@ DB_OBJECT_SQL({{'ROLE'|'SETTING'|'SCHEMA'|'USER'}, objectNameString
    | {'CONSTANT'|'CONSTRAINT'|'DOMAIN'|'INDEX'|'ROUTINE'|'SEQUENCE'
        |'SYNONYM'|'TABLE'|'TRIGGER'}, schemaNameString, objectNameString })
","
Returns internal SQL definition of the specified database object or NULL if object doesn't exist
or it is a system object without SQL definition.

This function should not be used to analyze structure of the object by machine code.
Internal SQL representation may contain undocumented non-standard clauses
and may be different in different versions of H2.
Objects are described in the ""INFORMATION_SCHEMA"" in machine-readable way.

Admin rights are required to execute this function.
","
CALL DB_OBJECT_SQL('ROLE', 'MANAGER');
CALL DB_OBJECT_SQL('TABLE', 'PUBLIC', 'MY_TABLE');
"

"Functions (System)","DECODE","
@c@ DECODE(value, whenValue, thenValue [,...])
","
Returns the first matching value. NULL is considered to match NULL.
If no match was found, then NULL or the last parameter (if the parameter count is even) is returned.
This function is provided for Oracle compatibility,
use [CASE](https://h2database.com/html/grammar.html#case_expression) instead of it.
","
CALL DECODE(RAND()>0.5, 0, 'Red', 1, 'Black');
"

"Functions (System)","DISK_SPACE_USED","
@h2@ DISK_SPACE_USED(tableNameString)
","
Returns the approximate amount of space used by the table specified.
Does not currently take into account indexes or LOB's.
This function may be expensive since it has to load every page in the table.
","
CALL DISK_SPACE_USED('my_table');
"

"Functions (System)","SIGNAL","
@h2@ SIGNAL(sqlStateString, messageString)
","
Throw an SQLException with the passed SQLState and reason.
","
CALL SIGNAL('23505', 'Duplicate user ID: ' || user_id);
"

"Functions (System)","ESTIMATED_ENVELOPE","
@h2@ ESTIMATED_ENVELOPE(tableNameString, columnNameString)
","
Returns the estimated minimum bounding box that encloses all specified GEOMETRY values.
Only 2D coordinate plane is supported.
NULL values are ignored.
Column must have a spatial index.
This function is fast, but estimation may include uncommitted data (including data from other transactions),
may return approximate bounds, or be different with actual value due to other reasons.
Use with caution.
If estimation is not available this function returns NULL.
For accurate and reliable result use ESTIMATE aggregate function instead.
","
CALL ESTIMATED_ENVELOPE('MY_TABLE', 'GEOMETRY_COLUMN');
"

"Functions (System)","FILE_READ","
@h2@ FILE_READ(fileNameString [,encodingString])
","
Returns the contents of a file. If only one parameter is supplied, the data are
returned as a BLOB. If two parameters are used, the data is returned as a CLOB
(text). The second parameter is the character set to use, NULL meaning the
default character set for this system.

File names and URLs are supported.
To read a stream from the classpath, use the prefix ""classpath:"".

Admin rights are required to execute this command.
","
SELECT LENGTH(FILE_READ('~/.h2.server.properties')) LEN;
SELECT FILE_READ('http://localhost:8182/stylesheet.css', NULL) CSS;
"

"Functions (System)","FILE_WRITE","
@h2@ FILE_WRITE(blobValue, fileNameString)
","
Write the supplied parameter into a file. Return the number of bytes written.

Write access to folder, and admin rights are required to execute this command.
","
SELECT FILE_WRITE('Hello world', '/tmp/hello.txt')) LEN;
"

"Functions (System)","GREATEST","
GREATEST(aValue, bValue [,...]) @h2@ [{RESPECT|IGNORE} NULLS]
","
Returns the largest value or NULL if any value is NULL or the largest value cannot be determined.
For example, ROW (NULL, 1) is neither equal to nor smaller than nor larger than ROW (1, 1).
If IGNORE NULLS is specified, NULL values are ignored.
","
CALL GREATEST(1, 2, 3);
"

"Functions (System)","LEAST","
LEAST(aValue, bValue [,...]) @h2@ [{RESPECT|IGNORE} NULLS]
","
Returns the smallest value or NULL if any value is NULL or the smallest value cannot be determined.
For example, ROW (NULL, 1) is neither equal to nor smaller than nor larger than ROW (1, 1).
If IGNORE NULLS is specified, NULL values are ignored.
","
CALL LEAST(1, 2, 3);
"

"Functions (System)","LOCK_MODE","
@h2@ LOCK_MODE()
","
Returns the current lock mode. See SET LOCK_MODE.
This method returns an int.
","
CALL LOCK_MODE();
"

"Functions (System)","LOCK_TIMEOUT","
@h2@ LOCK_TIMEOUT()
","
Returns the lock timeout of the current session (in milliseconds).
","
LOCK_TIMEOUT()
"

"Functions (System)","MEMORY_FREE","
@h2@ MEMORY_FREE()
","
Returns the free memory in KB (where 1024 bytes is a KB).
This method returns a long.
The garbage is run before returning the value.
Admin rights are required to execute this command.
","
MEMORY_FREE()
"

"Functions (System)","MEMORY_USED","
@h2@ MEMORY_USED()
","
Returns the used memory in KB (where 1024 bytes is a KB).
This method returns a long.
The garbage is run before returning the value.
Admin rights are required to execute this command.
","
MEMORY_USED()
"

"Functions (System)","NEXTVAL","
@c@ NEXTVAL ( [ schemaNameString, ] sequenceString )
","
Increments the sequence and returns its value.
The current value of the sequence and the last identity in the current session are updated with the generated value.
Used values are never re-used, even when the transaction is rolled back.
This method exists only for compatibility, it's recommended to use the standard
[NEXT VALUE FOR sequenceName](https://h2database.com/html/grammar.html#sequence_value_expression)
instead.
If the schema name is not set, the current schema is used.
When sequence is not found, the uppercase name is also checked.
This method returns a long.
","
NEXTVAL('TEST_SEQ')
"

"Functions (System)","NULLIF","
NULLIF(aValue, bValue)
","
Returns NULL if 'a' is equal to 'b', otherwise 'a'.
","
NULLIF(A, B)
A / NULLIF(B, 0)
"

"Functions (System)","NVL2","
@c@ NVL2(testValue, aValue, bValue)
","
If the test value is null, then 'b' is returned. Otherwise, 'a' is returned.
The data type of the returned value is the data type of 'a' if this is a text type.

This function is provided for Oracle compatibility,
use [CASE](https://h2database.com/html/grammar.html#case_expression)
or [COALESCE](https://h2database.com/html/functions.html#coalesce) instead of it.
","
NVL2(X, 'not null', 'null')
"

"Functions (System)","READONLY","
@h2@ READONLY()
","
Returns true if the database is read-only.
","
READONLY()
"

"Functions (System)","ROWNUM","
@h2@ ROWNUM()
","
Returns the number of the current row.
This method returns a long value.
It is supported for SELECT statements, as well as for DELETE and UPDATE.
The first row has the row number 1, and is calculated before ordering and grouping the result set,
but after evaluating index conditions (even when the index conditions are specified in an outer query).
Use the [ROW_NUMBER() OVER ()](https://h2database.com/html/functions-window.html#row_number)
function to get row numbers after grouping or in specified order.
","
SELECT ROWNUM(), * FROM TEST;
SELECT ROWNUM(), * FROM (SELECT * FROM TEST ORDER BY NAME);
SELECT ID FROM (SELECT T.*, ROWNUM AS R FROM TEST T) WHERE R BETWEEN 2 AND 3;
"

"Functions (System)","SESSION_ID","
@h2@ SESSION_ID()
","
Returns the unique session id number for the current database connection.
This id stays the same while the connection is open.
This method returns an int.
The database engine may re-use a session id after the connection is closed.
","
CALL SESSION_ID()
"

"Functions (System)","SET","
@h2@ SET(@variableName, value)
","
Updates a variable with the given value.
The new value is returned.
When used in a query, the value is updated in the order the rows are read.
When used in a subquery, not all rows might be read depending on the query plan.
This can be used to implement running totals / cumulative sums.
","
SELECT X, SET(@I, COALESCE(@I, 0)+X) RUNNING_TOTAL FROM SYSTEM_RANGE(1, 10)
"

"Functions (System)","TRANSACTION_ID","
@h2@ TRANSACTION_ID()
","
Returns the current transaction id for this session.
This method returns NULL if there is no uncommitted change, or if the database is not persisted.
Otherwise a value of the following form is returned:
""logFileId-position-sessionId"".
This method returns a string.
The value is unique across database restarts (values are not re-used).
","
CALL TRANSACTION_ID()
"

"Functions (System)","TRUNCATE_VALUE","
@h2@ TRUNCATE_VALUE(value, precisionInt, forceBoolean)
","
Truncate a value to the required precision.
If force flag is set to ""FALSE"" fixed precision values are not truncated.
The method returns a value with the same data type as the first parameter.
","
CALL TRUNCATE_VALUE(X, 10, TRUE);
"

"Functions (System)","CURRENT_PATH","
CURRENT_PATH
","
Returns the comma-separated list of quoted schema names where user-defined functions are searched
when they are referenced without the schema name.
","
CURRENT_PATH
"

"Functions (System)","CURRENT_ROLE","
CURRENT_ROLE
","
Returns the name of the PUBLIC role.
","
CURRENT_ROLE
"

"Functions (System)","CURRENT_USER","
CURRENT_USER | SESSION_USER | SYSTEM_USER | USER
","
Returns the name of the current user of this session.
","
CURRENT_USER
"

"Functions (System)","H2VERSION","
@h2@ H2VERSION()
","
Returns the H2 version as a String.
","
H2VERSION()
"

"Functions (JSON)","JSON_OBJECT","
JSON_OBJECT(
[{{[KEY] string VALUE expression} | {string : expression}} [,...] ]
[ { NULL | ABSENT } ON NULL ]
[ { WITH | WITHOUT } UNIQUE KEYS ]
)
","
Returns a JSON object constructed from the specified properties.
If ABSENT ON NULL is specified properties with NULL value are not included in the object.
If WITH UNIQUE KEYS is specified the constructed object is checked for uniqueness of keys,
nested objects, if any, are checked too.
","
JSON_OBJECT('id': 100, 'name': 'Joe', 'groups': '[2,5]' FORMAT JSON);
"

"Functions (JSON)","JSON_ARRAY","
JSON_ARRAY(
[expression [,...]]|{(query) [FORMAT JSON]}
[ { NULL | ABSENT } ON NULL ]
)
","
Returns a JSON array constructed from the specified values or from the specified single-column subquery.
If NULL ON NULL is specified NULL values are included in the array.
","
JSON_ARRAY(10, 15, 20);
JSON_ARRAY(JSON_DATA_A FORMAT JSON, JSON_DATA_B FORMAT JSON);
JSON_ARRAY((SELECT J FROM PROPS) FORMAT JSON);
"

"Functions (Table)","CSVREAD","
@h2@ CSVREAD(fileNameString [, columnsString [, csvOptions ] ] )
","
Returns the result set of reading the CSV (comma separated values) file.
For each parameter, NULL means the default value should be used.

If the column names are specified (a list of column names separated with the
fieldSeparator), those are used, otherwise (or if they are set to NULL) the first line of
the file is interpreted as the column names.
In that case, column names that contain no special characters (only letters, '_',
and digits; similar to the rule for Java identifiers) are processed is the same way as unquoted identifiers
and therefore case of characters may be changed.
Other column names are processed as quoted identifiers and case of characters is preserved.
To preserve the case of column names unconditionally use
[caseSensitiveColumnNames](https://h2database.com/html/grammar.html#csv_options) option.

The default charset is the default value for this system, and the default field separator
is a comma. Missing unquoted values as well as data that matches nullString is
parsed as NULL. All columns are of type VARCHAR.

The BOM (the byte-order-mark) character 0xfeff at the beginning of the file is ignored.

This function can be used like a table: ""SELECT * FROM CSVREAD(...)"".

Instead of a file, a URL may be used, for example
""jar:file:///c:/temp/example.zip!/org/example/nested.csv"".
To read a stream from the classpath, use the prefix ""classpath:"".
To read from HTTP, use the prefix ""http:"" (as in a browser).

For performance reason, CSVREAD should not be used inside a join.
Instead, import the data first (possibly into a temporary table) and then use the table.

Admin rights are required to execute this command.
","
SELECT * FROM CSVREAD('test.csv');
-- Read a file containing the columns ID, NAME with
SELECT * FROM CSVREAD('test2.csv', 'ID|NAME', 'charset=UTF-8 fieldSeparator=|');
SELECT * FROM CSVREAD('data/test.csv', null, 'rowSeparator=;');
-- Read a tab-separated file
SELECT * FROM CSVREAD('data/test.tsv', null, 'rowSeparator=' || CHAR(9));
SELECT ""Last Name"" FROM CSVREAD('address.csv');
SELECT ""Last Name"" FROM CSVREAD('classpath:/org/acme/data/address.csv');
"

"Functions (Table)","LINK_SCHEMA","
@h2@ LINK_SCHEMA (targetSchemaString, driverString, urlString,
@h2@ userString, passwordString, sourceSchemaString)
","
Creates table links for all tables in a schema.
If tables with the same name already exist, they are dropped first.
The target schema is created automatically if it does not yet exist.
The driver name may be empty if the driver is already loaded.
The list of tables linked is returned in the form of a result set.
Admin rights are required to execute this command.
","
SELECT * FROM LINK_SCHEMA('TEST2', '', 'jdbc:h2:./test2', 'sa', 'sa', 'PUBLIC');
"

"Functions (Table)","TABLE","
@h2@ { TABLE | TABLE_DISTINCT }
@h2@ ( { name dataTypeOrDomain = {array|rowValueExpression} } [,...] )
","
Returns the result set. TABLE_DISTINCT removes duplicate rows.
","
SELECT * FROM TABLE(V INT = ARRAY[1, 2]);
SELECT * FROM TABLE(ID INT=(1, 2), NAME VARCHAR=('Hello', 'World'));
"

"Functions (Table)","UNNEST","
UNNEST(arrayExpression, [,...]) [WITH ORDINALITY]
","
Returns the result set.
Number of columns is equal to number of arguments,
plus one additional column with row number if WITH ORDINALITY is specified.
Number of rows is equal to length of longest specified array.
If multiple arguments are specified and they have different length, cells with missing values will contain null values.
","
SELECT * FROM UNNEST(ARRAY['a', 'b', 'c']);
SELECT * FROM UNNEST(JSON '[""a"", ""b"", ""c""]');
"

"Aggregate Functions (General)","AVG","
AVG ( [ DISTINCT|ALL ] { numeric | interval } )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The average (mean) value.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

The data type of result is DOUBLE PRECISION for TINYINT, SMALLINT, INTEGER, and REAL arguments,
NUMERIC with additional 10 decimal digits of precision and scale for BIGINT and NUMERIC arguments;
DECFLOAT with additional 10 decimal digits of precision for DOUBLE PRECISION and DECFLOAT arguments;
INTERVAL with the same leading field precision, all additional smaller datetime units in interval qualifier,
and the maximum scale for INTERVAL arguments.
","
AVG(X)
"

"Aggregate Functions (General)","MAX","
MAX(value)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The highest value.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
The returned value is of the same data type as the parameter.
","
MAX(NAME)
"

"Aggregate Functions (General)","MIN","
MIN(value)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The lowest value.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
The returned value is of the same data type as the parameter.
","
MIN(NAME)
"

"Aggregate Functions (General)","SUM","
SUM( [ DISTINCT|ALL ] { numeric | interval | @h2@ { boolean } } )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The sum of all values.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

The data type of result is BIGINT for BOOLEAN, TINYINT, SMALLINT, and INTEGER arguments;
NUMERIC with additional 10 decimal digits of precision for BIGINT and NUMERIC arguments;
DOUBLE PRECISION for REAL arguments,
DECFLOAT with additional 10 decimal digits of precision for DOUBLE PRECISION and DECFLOAT arguments;
INTERVAL with maximum precision and the same interval qualifier and scale for INTERVAL arguments.
","
SUM(X)
"

"Aggregate Functions (General)","EVERY","
{EVERY| @c@ {BOOL_AND}}(boolean)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Returns true if all expressions are true.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
EVERY(ID>10)
"

"Aggregate Functions (General)","ANY","
{ANY|SOME| @c@ {BOOL_OR}}(boolean)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Returns true if any expression is true.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

Note that if ANY or SOME aggregate function is placed on the right side of comparison operation or distinct predicate
and argument of this function is a subquery additional parentheses around aggregate function are required,
otherwise it will be parsed as quantified predicate.
","
ANY(NAME LIKE 'W%')
A = (ANY((SELECT B FROM T)))
"

"Aggregate Functions (General)","COUNT","
COUNT( { * | { [ DISTINCT|ALL ] expression } } )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The count of all row, or of the non-null values.
This method returns a long.
If no rows are selected, the result is 0.
Aggregates are only allowed in select statements.
","
COUNT(*)
"

"Aggregate Functions (General)","STDDEV_POP","
STDDEV_POP( [ DISTINCT|ALL ] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The population standard deviation.
This method returns a double.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
STDDEV_POP(X)
"

"Aggregate Functions (General)","STDDEV_SAMP","
STDDEV_SAMP( [ DISTINCT|ALL ] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The sample standard deviation.
This method returns a double.
If less than two rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
STDDEV(X)
"

"Aggregate Functions (General)","VAR_POP","
VAR_POP( [ DISTINCT|ALL ] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The population variance (square of the population standard deviation).
This method returns a double.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
VAR_POP(X)
"

"Aggregate Functions (General)","VAR_SAMP","
VAR_SAMP( [ DISTINCT|ALL ] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The sample variance (square of the sample standard deviation).
This method returns a double.
If less than two rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
VAR_SAMP(X)
"

"Aggregate Functions (General)","ANY_VALUE","
ANY_VALUE( @h2@ [ DISTINCT|ALL ] value )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Returns any non-NULL value from aggregated values.
If no rows are selected, the result is NULL.
This function uses the same pseudo random generator as [RAND()](https://h2database.com/html/functions.html#rand)
function.

If DISTINCT is specified, each distinct value will be returned with approximately the same probability
as other distinct values. If it isn't specified, more frequent values will be returned with higher probability
than less frequent.

Aggregates are only allowed in select statements.
","
ANY_VALUE(X)
"

"Aggregate Functions (General)","BIT_AND_AGG","
{@h2@{BIT_AND_AGG}|@c@{BIT_AND}}@h2@(expression)
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
The bitwise AND of all non-null values.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

For non-aggregate function see [BITAND](https://h2database.com/html/functions.html#bitand).
","
BIT_AND_AGG(X)
"

"Aggregate Functions (General)","BIT_OR_AGG","
{@h2@{BIT_OR_AGG}|@c@{BIT_OR}}@h2@(expression)
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
The bitwise OR of all non-null values.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

For non-aggregate function see [BITOR](https://h2database.com/html/functions.html#bitor).
","
BIT_OR_AGG(X)
"

"Aggregate Functions (General)","BIT_XOR_AGG","
@h2@ BIT_XOR_AGG( [ DISTINCT|ALL ] expression)
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
The bitwise XOR of all non-null values.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

For non-aggregate function see [BITXOR](https://h2database.com/html/functions.html#bitxor).
","
BIT_XOR_AGG(X)
"

"Aggregate Functions (General)","BIT_NAND_AGG","
@h2@ BIT_NAND_AGG(expression)
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
The bitwise NAND of all non-null values.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

For non-aggregate function see [BITNAND](https://h2database.com/html/functions.html#bitnand).
","
BIT_NAND_AGG(X)
"

"Aggregate Functions (General)","BIT_NOR_AGG","
@h2@ BIT_NOR_AGG(expression)
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
The bitwise NOR of all non-null values.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

For non-aggregate function see [BITNOR](https://h2database.com/html/functions.html#bitnor).
","
BIT_NOR_AGG(X)
"

"Aggregate Functions (General)","BIT_XNOR_AGG","
@h2@ BIT_XNOR_AGG( [ DISTINCT|ALL ] expression)
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
The bitwise XNOR of all non-null values.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.

For non-aggregate function see [BITXNOR](https://h2database.com/html/functions.html#bitxnor).
","
BIT_XNOR_AGG(X)
"

"Aggregate Functions (General)","ENVELOPE","
@h2@ ENVELOPE( value )
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
Returns the minimum bounding box that encloses all specified GEOMETRY values.
Only 2D coordinate plane is supported.
NULL values are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
ENVELOPE(X)
"

"Aggregate Functions (Binary Set)","COVAR_POP","
COVAR_POP(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The population covariance.
This method returns a double.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
COVAR_POP(Y, X)
"

"Aggregate Functions (Binary Set)","COVAR_SAMP","
COVAR_SAMP(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The sample covariance.
This method returns a double.
Rows in which either argument is NULL are ignored in the calculation.
If less than two rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
COVAR_SAMP(Y, X)
"

"Aggregate Functions (Binary Set)","CORR","
CORR(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Pearson's correlation coefficient.
This method returns a double.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
CORR(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_SLOPE","
REGR_SLOPE(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The slope of the line.
This method returns a double.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
REGR_SLOPE(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_INTERCEPT","
REGR_INTERCEPT(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The y-intercept of the regression line.
This method returns a double.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
REGR_INTERCEPT(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_COUNT","
REGR_COUNT(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Returns the number of rows in the group.
This method returns a long.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is 0.
Aggregates are only allowed in select statements.
","
REGR_COUNT(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_R2","
REGR_R2(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The coefficient of determination.
This method returns a double.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
REGR_R2(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_AVGX","
REGR_AVGX(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The average (mean) value of dependent expression.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
For details about the data type see [AVG](https://h2database.com/html/functions-aggregate.html#avg).
Aggregates are only allowed in select statements.
","
REGR_AVGX(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_AVGY","
REGR_AVGY(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The average (mean) value of independent expression.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
For details about the data type see [AVG](https://h2database.com/html/functions-aggregate.html#avg).
Aggregates are only allowed in select statements.
","
REGR_AVGY(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_SXX","
REGR_SXX(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The the sum of squares of independent expression.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
REGR_SXX(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_SYY","
REGR_SYY(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The the sum of squares of dependent expression.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
REGR_SYY(Y, X)
"

"Aggregate Functions (Binary Set)","REGR_SXY","
REGR_SXY(dependentExpression, independentExpression)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The the sum of products independent expression times dependent expression.
Rows in which either argument is NULL are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
REGR_SXY(Y, X)
"

"Aggregate Functions (Ordered)","LISTAGG","
LISTAGG ( [ DISTINCT|ALL ] string [, separatorString]
[ ON OVERFLOW { ERROR
    | TRUNCATE [ filterString ] { WITH | WITHOUT } COUNT } ] )
withinGroupSpecification
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Concatenates strings with a separator.
The default separator is a ',' (without space).
This method returns a string.
NULL values are ignored in the calculation, COALESCE can be used to replace them.
If no rows are selected, the result is NULL.

If ""ON OVERFLOW TRUNCATE"" is specified, values that don't fit into returned string are truncated
and replaced with filter string placeholder ('...' by default) and count of truncated elements in parentheses.
If ""WITHOUT COUNT"" is specified, count of truncated elements is not appended.

Aggregates are only allowed in select statements.
","
LISTAGG(NAME, ', ') WITHIN GROUP (ORDER BY ID)
LISTAGG(COALESCE(NAME, 'null'), ', ') WITHIN GROUP (ORDER BY ID)
LISTAGG(ID, ', ') WITHIN GROUP (ORDER BY ID) OVER (ORDER BY ID)
LISTAGG(ID, ';' ON OVERFLOW TRUNCATE 'etc' WITHOUT COUNT) WITHIN GROUP (ORDER BY ID)
"

"Aggregate Functions (Ordered)","ARRAY_AGG","
ARRAY_AGG ( @h2@ [ DISTINCT|ALL ] value
[ ORDER BY sortSpecificationList ] )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Aggregate the value into an array.
This method returns an array.
NULL values are included in the array, FILTER clause can be used to exclude them.
If no rows are selected, the result is NULL.
If ORDER BY is not specified order of values is not determined.
When this aggregate is used with OVER clause that contains ORDER BY subclause
it does not enforce exact order of values.
This aggregate needs additional own ORDER BY clause to make it deterministic.
Aggregates are only allowed in select statements.
","
ARRAY_AGG(NAME ORDER BY ID)
ARRAY_AGG(NAME ORDER BY ID) FILTER (WHERE NAME IS NOT NULL)
ARRAY_AGG(ID ORDER BY ID) OVER (ORDER BY ID)
"

"Aggregate Functions (Hypothetical Set)","RANK aggregate","
RANK(value [,...])
withinGroupSpecification
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
Returns the rank of the hypothetical row in specified collection of rows.
The rank of a row is the number of rows that precede this row plus 1.
If two or more rows have the same values in ORDER BY columns, these rows get the same rank from the first row with the same values.
It means that gaps in ranks are possible.

See [RANK](https://h2database.com/html/functions-window.html#rank) for a window function with the same name.
","
SELECT RANK(5) WITHIN GROUP (ORDER BY V) FROM TEST;
"

"Aggregate Functions (Hypothetical Set)","DENSE_RANK aggregate","
DENSE_RANK(value [,...])
withinGroupSpecification
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
Returns the dense rank of the hypothetical row in specified collection of rows.
The rank of a row is the number of groups of rows with the same values in ORDER BY columns that precede group with this row plus 1.
If two or more rows have the same values in ORDER BY columns, these rows get the same rank.
Gaps in ranks are not possible.

See [DENSE_RANK](https://h2database.com/html/functions-window.html#dense_rank) for a window function with the same name.
","
SELECT DENSE_RANK(5) WITHIN GROUP (ORDER BY V) FROM TEST;
"

"Aggregate Functions (Hypothetical Set)","PERCENT_RANK aggregate","
PERCENT_RANK(value [,...])
withinGroupSpecification
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
Returns the relative rank of the hypothetical row in specified collection of rows.
The relative rank is calculated as (RANK - 1) / (NR - 1),
where RANK is a rank of the row and NR is a total number of rows in the collection including hypothetical row.

See [PERCENT_RANK](https://h2database.com/html/functions-window.html#percent_rank) for a window function with the same name.
","
SELECT PERCENT_RANK(5) WITHIN GROUP (ORDER BY V) FROM TEST;
"

"Aggregate Functions (Hypothetical Set)","CUME_DIST aggregate","
CUME_DIST(value [,...])
withinGroupSpecification
[FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
Returns the relative rank of the hypothetical row in specified collection of rows.
The relative rank is calculated as NP / NR
where NP is a number of rows that precede the current row or have the same values in ORDER BY columns
and NR is a total number of rows in the collection including hypothetical row.

See [CUME_DIST](https://h2database.com/html/functions-window.html#cume_dist) for a window function with the same name.
","
SELECT CUME_DIST(5) WITHIN GROUP (ORDER BY V) FROM TEST;
"

"Aggregate Functions (Inverse Distribution)","PERCENTILE_CONT","
PERCENTILE_CONT(numeric) WITHIN GROUP (ORDER BY sortSpecification)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Return percentile of values from the group with interpolation.
Interpolation is only supported for numeric, date-time, and interval data types.
Argument must be between 0 and 1 inclusive.
Argument must be the same for all rows in the same group.
If argument is NULL, the result is NULL.
NULL values are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY V)
"

"Aggregate Functions (Inverse Distribution)","PERCENTILE_DISC","
PERCENTILE_DISC(numeric) WITHIN GROUP (ORDER BY sortSpecification)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Return percentile of values from the group.
Interpolation is not performed.
Argument must be between 0 and 1 inclusive.
Argument must be the same for all rows in the same group.
If argument is NULL, the result is NULL.
NULL values are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY V)
"

"Aggregate Functions (Inverse Distribution)","MEDIAN","
@h2@ MEDIAN( [ DISTINCT|ALL ] value )
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
The value separating the higher half of a values from the lower half.
Returns the middle value or an interpolated value between two middle values if number of values is even.
Interpolation is only supported for numeric, date-time, and interval data types.
NULL values are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
MEDIAN(X)
"

"Aggregate Functions (Inverse Distribution)","MODE","
@h2@ { MODE() WITHIN GROUP (ORDER BY sortSpecification) }
    | @c@ { MODE( value [ ORDER BY sortSpecification ] ) }
@h2@ [FILTER (WHERE expression)] @h2@ [OVER windowNameOrSpecification]
","
Returns the value that occurs with the greatest frequency.
If there are multiple values with the same frequency only one value will be returned.
In this situation value will be chosen based on optional ORDER BY clause
that should specify exactly the same expression as argument of this function.
Use ascending order to get smallest value or descending order to get largest value
from multiple values with the same frequency.
If this clause is not specified the exact chosen value is not determined in this situation.
NULL values are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
MODE() WITHIN GROUP (ORDER BY X)
"

"Aggregate Functions (JSON)","JSON_OBJECTAGG","
JSON_OBJECTAGG(
{[KEY] string VALUE value} | {string : value}
[ { NULL | ABSENT } ON NULL ]
[ { WITH | WITHOUT } UNIQUE KEYS ]
)
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Aggregates the keys with values into a JSON object.
If ABSENT ON NULL is specified properties with NULL value are not included in the object.
If WITH UNIQUE KEYS is specified the constructed object is checked for uniqueness of keys,
nested objects, if any, are checked too.
If no values are selected, the result is SQL NULL value.
","
JSON_OBJECTAGG(NAME: VAL);
JSON_OBJECTAGG(KEY NAME VALUE VAL);
"

"Aggregate Functions (JSON)","JSON_ARRAYAGG","
JSON_ARRAYAGG( @h2@ [ DISTINCT|ALL ] expression
[ ORDER BY sortSpecificationList ]
[ { NULL | ABSENT } ON NULL ] )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
Aggregates the values into a JSON array.
If NULL ON NULL is specified NULL values are included in the array.
If no values are selected, the result is SQL NULL value.
","
JSON_ARRAYAGG(NUMBER)
"

"Window Functions (Row Number)","ROW_NUMBER","
ROW_NUMBER() OVER windowNameOrSpecification
","
Returns the number of the current row starting with 1.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT ROW_NUMBER() OVER (), * FROM TEST;
SELECT ROW_NUMBER() OVER (ORDER BY ID), * FROM TEST;
SELECT ROW_NUMBER() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST;
"

"Window Functions (Rank)","RANK","
RANK() OVER windowNameOrSpecification
","
Returns the rank of the current row.
The rank of a row is the number of rows that precede this row plus 1.
If two or more rows have the same values in ORDER BY columns, these rows get the same rank from the first row with the same values.
It means that gaps in ranks are possible.
This function requires window order clause.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.

See [RANK aggregate](https://h2database.com/html/functions-aggregate.html#rank_aggregate) for a hypothetical set function with the same name.
","
SELECT RANK() OVER (ORDER BY ID), * FROM TEST;
SELECT RANK() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST;
"

"Window Functions (Rank)","DENSE_RANK","
DENSE_RANK() OVER windowNameOrSpecification
","
Returns the dense rank of the current row.
The rank of a row is the number of groups of rows with the same values in ORDER BY columns that precede group with this row plus 1.
If two or more rows have the same values in ORDER BY columns, these rows get the same rank.
Gaps in ranks are not possible.
This function requires window order clause.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.

See [DENSE_RANK aggregate](https://h2database.com/html/functions-aggregate.html#dense_rank_aggregate) for a hypothetical set function with the same name.
","
SELECT DENSE_RANK() OVER (ORDER BY ID), * FROM TEST;
SELECT DENSE_RANK() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST;
"

"Window Functions (Rank)","PERCENT_RANK","
PERCENT_RANK() OVER windowNameOrSpecification
","
Returns the relative rank of the current row.
The relative rank is calculated as (RANK - 1) / (NR - 1),
where RANK is a rank of the row and NR is a number of rows in window partition with this row.
Note that result is always 0 if window order clause is not specified.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.

See [PERCENT_RANK aggregate](https://h2database.com/html/functions-aggregate.html#percent_rank_aggregate) for a hypothetical set function with the same name.
","
SELECT PERCENT_RANK() OVER (ORDER BY ID), * FROM TEST;
SELECT PERCENT_RANK() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST;
"

"Window Functions (Rank)","CUME_DIST","
CUME_DIST() OVER windowNameOrSpecification
","
Returns the relative rank of the current row.
The relative rank is calculated as NP / NR
where NP is a number of rows that precede the current row or have the same values in ORDER BY columns
and NR is a number of rows in window partition with this row.
Note that result is always 1 if window order clause is not specified.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.

See [CUME_DIST aggregate](https://h2database.com/html/functions-aggregate.html#cume_dist_aggregate) for a hypothetical set function with the same name.
","
SELECT CUME_DIST() OVER (ORDER BY ID), * FROM TEST;
SELECT CUME_DIST() OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST;
"

"Window Functions (Lead or Lag)","LEAD","
LEAD(value [, offsetInt [, defaultValue]]) [{RESPECT|IGNORE} NULLS]
OVER windowNameOrSpecification
","
Returns the value in a next row with specified offset relative to the current row.
Offset must be non-negative.
If IGNORE NULLS is specified rows with null values in selected expression are skipped.
If number of considered rows is less than specified relative number this function returns NULL
or the specified default value, if any.
If offset is 0 the value from the current row is returned unconditionally.
This function requires window order clause.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT LEAD(X) OVER (ORDER BY ID), * FROM TEST;
SELECT LEAD(X, 2, 0) IGNORE NULLS OVER (
    PARTITION BY CATEGORY ORDER BY ID
), * FROM TEST;
"

"Window Functions (Lead or Lag)","LAG","
LAG(value [, offsetInt [, defaultValue]]) [{RESPECT|IGNORE} NULLS]
OVER windowNameOrSpecification
","
Returns the value in a previous row with specified offset relative to the current row.
Offset must be non-negative.
If IGNORE NULLS is specified rows with null values in selected expression are skipped.
If number of considered rows is less than specified relative number this function returns NULL
or the specified default value, if any.
If offset is 0 the value from the current row is returned unconditionally.
This function requires window order clause.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT LAG(X) OVER (ORDER BY ID), * FROM TEST;
SELECT LAG(X, 2, 0) IGNORE NULLS OVER (
    PARTITION BY CATEGORY ORDER BY ID
), * FROM TEST;
"

"Window Functions (Nth Value)","FIRST_VALUE","
FIRST_VALUE(value) [{RESPECT|IGNORE} NULLS]
OVER windowNameOrSpecification
","
Returns the first value in a window.
If IGNORE NULLS is specified null values are skipped and the function returns first non-null value, if any.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT FIRST_VALUE(X) OVER (ORDER BY ID), * FROM TEST;
SELECT FIRST_VALUE(X) IGNORE NULLS OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST;
"

"Window Functions (Nth Value)","LAST_VALUE","
LAST_VALUE(value) [{RESPECT|IGNORE} NULLS]
OVER windowNameOrSpecification
","
Returns the last value in a window.
If IGNORE NULLS is specified null values are skipped and the function returns last non-null value before them, if any;
if there is no non-null value it returns NULL.
Note that the last value is actually a value in the current group of rows
if window order clause is specified and window frame clause is not specified.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT LAST_VALUE(X) OVER (ORDER BY ID), * FROM TEST;
SELECT LAST_VALUE(X) IGNORE NULLS OVER (
    PARTITION BY CATEGORY ORDER BY ID
    RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
), * FROM TEST;
"

"Window Functions (Nth Value)","NTH_VALUE","
NTH_VALUE(value, nInt) [FROM {FIRST|LAST}] [{RESPECT|IGNORE} NULLS]
OVER windowNameOrSpecification
","
Returns the value in a row with a specified relative number in a window.
Relative row number must be positive.
If FROM LAST is specified rows a counted backwards from the last row.
If IGNORE NULLS is specified rows with null values in selected expression are skipped.
If number of considered rows is less than specified relative number this function returns NULL.
Note that the last row is actually a last row in the current group of rows
if window order clause is specified and window frame clause is not specified.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT NTH_VALUE(X) OVER (ORDER BY ID), * FROM TEST;
SELECT NTH_VALUE(X) IGNORE NULLS OVER (
    PARTITION BY CATEGORY ORDER BY ID
    RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
), * FROM TEST;
"

"Window Functions (Other)","NTILE","
NTILE(long) OVER windowNameOrSpecification
","
Distributes the rows into a specified number of groups.
Number of groups should be a positive long value.
NTILE returns the 1-based number of the group to which the current row belongs.
First groups will have more rows if number of rows is not divisible by number of groups.
For example, if 5 rows are distributed into 2 groups this function returns 1 for the first 3 row and 2 for the last 2 rows.
This function requires window order clause.
Window frame clause is not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT NTILE(10) OVER (ORDER BY ID), * FROM TEST;
SELECT NTILE(5) OVER (PARTITION BY CATEGORY ORDER BY ID), * FROM TEST;
"

"Window Functions (Other)","RATIO_TO_REPORT","
@h2@ RATIO_TO_REPORT(value)
@h2@ OVER windowNameOrSpecification
","
Returns the ratio of a value to the sum of all values.
If argument is NULL or sum of all values is 0, then the value of function is NULL.
Window ordering and window frame clauses are not allowed for this function.

Window functions in H2 may require a lot of memory for large queries.
","
SELECT X, RATIO_TO_REPORT(X) OVER (PARTITION BY CATEGORY), CATEGORY FROM TEST;
"

"System Tables","Information Schema","
INFORMATION_SCHEMA
","
To get the list of system tables, execute the statement SELECT * FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'INFORMATION_SCHEMA'
","
"

"System Tables","Range Table","
@h2@ SYSTEM_RANGE(start, end [, step])
","
Contains all values from start to end (this is a dynamic table).
","
SYSTEM_RANGE(0, 100)
"




© 2015 - 2024 Weber Informatics LLC | Privacy Policy