link_schema
1. LINK_SCHEMA Function
=======link_schema
1. LINK_SCHEMA Function
>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62beThe LINK_SCHEMA function in H2 database is used to retrieve information about the linked tables in the current schema.
2. Syntax
The syntax for the LINK_SCHEMA function in H2 database is as follows:
LINK_SCHEMA('schemaPattern', 'tableNamePattern')
Arguments
schemaPattern
(optional): The pattern to match the schema names. By default, it matches all schemas.tableNamePattern
(optional): The pattern to match the table names. By default, it matches all tables.
Return
- The LINK_SCHEMA function returns a result set with the following columns:
TABLE_CAT
: The catalog name (database name).TABLE_SCHEM
: The schema name.TABLE_NAME
: The table name.TABLE_TYPE
: The type of the table.
3. Notes
- The LINK_SCHEMA function in H2 database provides information about linked tables, which are tables defined in other databases or schemas that are linked to the current database.
- If no arguments are provided, the function returns information about all linked tables in all schemas.
- The schema and table name patterns can contain wildcard characters like
%
and_
for pattern matching.
4. Examples
Here are a few examples demonstrating the usage of the LINK_SCHEMA function in H2 database:
Example 1 - Retrieving information about all linked tables:
SELECT * FROM LINK_SCHEMA();
Output:
TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE
----------+-------------+------------+-----------
mydb | public | customers | TABLE
mydb | public | orders | TABLE
Example 2 - Retrieving information about linked tables in a specific schema:
SELECT * FROM LINK_SCHEMA('public', '%');
Output:
TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE
----------+-------------+------------+-----------
mydb | public | customers | TABLE
mydb | public | orders | TABLE
Example 3 - Retrieving information about a specific linked table:
SELECT * FROM LINK_SCHEMA('%', 'customers');
Output:
TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE
----------+-------------+------------+-----------
mydb | public | customers | TABLE
5. Related Functions
- TABLES - Retrieve information about tables in the current database.