SHOW TABLES
Applies to: Databricks SQL Databricks Runtime
Returns all the tables for an optionally specified schema. Additionally, the output of this statement may be filtered by an optional matching pattern. If no schema is specified then the tables are returned from the current schema.
Parameters
-
Specifies schema name from which tables are to be listed. If not provided, uses the current schema.
regex_pattern
The regular expression pattern that is used to filter out unwanted tables.
Except for
*
and|
character, the pattern works like a regular expression.*
alone matches 0 or more characters and|
is used to separate multiple different regular expressions, any of which can match.The leading and trailing blanks are trimmed in the input pattern before processing. The pattern match is case-insensitive.
Examples
-- List all tables in default schema
> SHOW TABLES;
database tableName isTemporary
-------- --------- -----------
default sam false
default sam1 false
default suj false
-- List all tables from usersc schema
> SHOW TABLES FROM usersc;
database tableName isTemporary
-------- --------- -----------
usersc user1 false
usersc user2 false
-- List all tables in usersc schema
> SHOW TABLES IN usersc;
database tableName isTemporary
-------- --------- -----------
usersc user1 false
usersc user2 false
-- List all tables from default schema matching the pattern `sam*`
> SHOW TABLES FROM default LIKE 'sam*';
database tableName isTemporary
-------- --------- -----------
default sam false
default sam1 false
-- List all tables matching the pattern `sam*|suj`
> SHOW TABLES LIKE 'sam*|suj';
database tableName isTemporary
-------- --------- -----------
default sam false
default sam1 false
default suj false