SHOW

SHOW is an SQL statement used to fetch information about databases, tables, columns, or the status of a server. It is typically used for database monitoring and debugging. Depending on its usage context, it can retrieve differing types of metadata.

Example

SHOW TABLES;

Output

+-----------------+
| Tables_in_Shop |
+-----------------+
| Customers |
| Orders |
| Products |
+-----------------+

Explanation

The SHOW TABLES statement lists all the tables in the current database. The output displays the tables ‘Customers’, ‘Orders’, and ‘Products’ under the ‘Tables_in_Shop’ heading, indicating these are the tables present in the ‘Shop’ database.

Example

SHOW timezone;

Output

TimeZone
------------
UTC
(1 row)

Explanation

The SHOW command in PostgreSQL is used to display current runtime parameters. In the example code, SHOW timezone; is used to display the current time zone setting. The output indicates that the current time zone setting is ‘UTC’.

Example

USE AdventureWorks2012;
GO
SHOW STATISTICS Sales.SalesOrderDetail;

Output

Name Updated Rows Rows Sampled Steps
--------------------------------------------- -------------------- -------------------- -------------------- ----
_pkc_SalesOrderDetailID Aug 13 2021 3:54AM 121315 121315 200
...

Explanation

The SHOW command in SQL Server is used to return information about the statistics of a table. In the above example, SHOW STATISTICS returns the statistical information about the SalesOrderDetail table from the Sales schema in the AdventureWorks2012 database. This command is helpful to understand distribution of data in table columns which can help in query performance tuning.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.