SHOW Statements¶
Important
Confluent Cloud for Apache Flink®️ is currently available for Preview. A Preview feature is a Confluent Cloud component that is being introduced to gain early feedback from developers. Preview features can be used for evaluation and non-production testing purposes or to provide feedback to Confluent. The warranty, SLA, and Support Services provisions of your agreement with Confluent do not apply to Preview features. Confluent may discontinue providing Preview releases of the Preview features at any time in Confluent’s sole discretion. Check out Getting Help for questions, feedback and requests.
For SQL features and limitations in the preview program, see Notable Limitations in Public Preview.
Confluent Cloud for Apache Flink®️ enables listing available environments, Apache Kafka® clusters, and topics.
Syntax¶
SHOW CATALOGS;
SHOW CURRENT CATALOG;
SHOW CURRENT DATABASE;
SHOW DATABASES;
SHOW JOBS;
SHOW TABLES;
SHOW CREATE TABLE [table_name];
SHOW FUNCTIONS;
Description¶
List SQL objects within their corresponding parent.
SHOW statements list objects within their corresponding parent, like catalogs, databases, tables, and functions.
Examples¶
In the Confluent CLI, run the following commands to see examples of SHOW statements.
Create a table.
-- Create a users table. CREATE TABLE users ( user_id STRING, registertime BIGINT, gender STRING, regionid STRING );
-- Populate the table with mock users data. INSERT INTO users VALUES ('Thomas A. Anderson', 1677260724, 'male', 'Region_4'), ('Trinity', 1677260733, 'female', 'Region_4'), ('Morpheus', 1677260742, 'male', 'Region_8'), ('Dozer', 1677260823, 'male', 'Region_1'), ('Agent Smith', 1677260955, 'male', 'Region_0'), ('Persephone', 1677260901, 'female', 'Region_2'), ('Niobe', 1677260921, 'female', 'Region_3'), ('Zee', 1677260922, 'female', 'Region_5');
Press ENTER to return to the SQL shell. Because INSERT INTO VALUES is a point-in-time statement, it exits after it completes inserting records.
Flink SQL> SHOW CATALOGS; default_catalog Flink SQL> USE CATALOG `default_catalog`; +---------------------+-------------------+ | Key | Value | +---------------------+-------------------+ | sql.current-catalog | `default_catalog` | +---------------------+-------------------+ Flink SQL> SHOW DATABASES; +------------------+--------------+ | database name | database id | +------------------+--------------+ | default_database | lkc-example | +------------------+--------------+ Flink SQL> USE `lkc-example`; +----------------------+-------------+ | Key | Value | +----------------------+-------------+ | sql.current-database | lkc-example | +----------------------+-------------+ Flink SQL> CREATE TABLE my_table (...); Statement phase is COMPLETED. Flink SQL> SHOW TABLES; +---------------------------+ | table name | +---------------------------+ | my_table | +---------------------------+ Flink SQL> SHOW FUNCTIONS; +------------------------+ | function name | +------------------------+ | ABS | | ACOS | | AND | | ARRAY | | ARRAY_CONTAINS | | ... | +------------------------+
SHOW FUNCTIONS¶
SHOW [USER] FUNCTIONS;
Show all functions including system functions and user-defined functions in the current catalog and current database.
The USER
option shows only user-defined functions in the current catalog
and current database.
SHOW TABLES¶
SHOW TABLES [ [catalog_name.]database_name ] [ [NOT] LIKE <sql_like_pattern> ]
Show all tables for the current database. Additionally, the output of this statement may be filtered by an optional matching pattern.
LIKE Show all tables with given table name and optional LIKE
clause, whose name is whether similar to the <sql_like_pattern>
.
The syntax of sql pattern in LIKE
clause is the same as that of
MySQL
dialect.
%
matches any number of characters, even zero characters.\%
matches one%
character_
matches exactly one character.\_
matches one_
character.
SHOW TABLES EXAMPLES¶
Assumes that the current database has the following tables: flights
and
orders
.
Shows all tables of the current database, which are similar to the given sql pattern.
SHOW TABLES LIKE 'f%'; +------------+ | table name | +------------+ | flights | +------------+ 1 row in set
Shows all tables of the given database, which are not similar to the specified SQL pattern.
SHOW TABLES NOT LIKE 'f%'; +------------+ | table name | +------------+ | orders | +------------+ 1 row in set
Shows all tables of the current database.
SHOW TABLES; +------------+ | table name | +------------+ | flights | | orders | +------------+