Updated on 2026-11-06 GMT+08:00

Show Views

Function

The SHOW VIEWS statement is used to list all views in a specified database. View names can be filtered using pattern matching. If no database is specified, views from the current database are listed. If the specified database is the global temporary view database, global temporary views are listed. Note: Local temporary views are always listed, regardless of the database specified.

Syntax

SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE regex_pattern ]

Parameters

Parameter

Description

FROM / IN database_name

Optional. Specifies the database name for which to view views. If omitted, the current database is used.

LIKE regex_pattern

Optional. Filters view names using a regular expression. Matches zero or more characters.

Examples

List all views in the current database.

SHOW VIEWS;

Result:

namespace

viewName

isTemporary

default

sam

false

default

sam1

false

default

suj

false

default

temp2

true

List views in a specified database.

SHOW VIEWS FROM userdb;

Result:

namespace

viewName

isTemporary

userdb

user1

false

userdb

user2

false

userdb

temp2

true

List global temporary views.

SHOW VIEWS IN global_temp;

Result:

namespace

viewName

isTemporary

global_temp

temp1

true

global_temp

temp2

true

Filter views using pattern matching.

SHOW VIEWS FROM default LIKE 'sam*';

Result:

namespace

viewName

isTemporary

default

sam

false

default

sam1

false

Use multiple patterns for matching.

SHOW VIEWS LIKE 'sam|suj|temp*';

Result:

namespace

viewName

isTemporary

default

sam

false

default

suj

false

default

temp2

true

Precautions

  • This statement only displays views, not regular tables. To view all tables, use SHOW TABLES.
  • Local temporary views always appear in the results, regardless of the database specified.
  • The * in the regex pattern is equivalent to % in SQL, and | represents logical OR.
  • If the database does not exist, an error is raised.