显示 TBLPROPERTIES

描述

该语句返回给定属性键的可选值的表属性值。如果未指定键,则返回所有属性。

语法

SHOW TBLPROPERTIES table_identifier
[ ( unquoted_property_key | property_key_as_string_literal ) ]

参数

注意

示例

-- 在数据库 `salesdb` 中创建一个表 `customer`
USE salesdb;
CREATE TABLE customer(cust_code INT, name VARCHAR(100), cust_addr STRING)
TBLPROPERTIES ('created.by.user' = 'John', 'created.date' = '01-01-2001');
-- 显示表 `customer` 的所有用户指定属性
SHOW TBLPROPERTIES customer;
+---------------------+----------+
| key| value|
+---------------------+----------+
| created.by.user| John|
| created.date|01-01-2001|
|transient_lastDdlTime|1567554931|
+---------------------+----------+
-- 显示经过限定的表 `customer` 的所有用户指定属性
-- 在数据库 `salesdb` 中
SHOW TBLPROPERTIES salesdb.customer;
+---------------------+----------+
| key| value|
+---------------------+----------+
| created.by.user| John|
| created.date|01-01-2001|
|transient_lastDdlTime|1567554931|
+---------------------+----------+
-- 显示未引用属性键 `created.by.user` 的值
SHOW TBLPROPERTIES customer (created.by.user);
+-----+
|value|
+-----+
| John|
+-----+
-- 显示属性 `created.date` 的值,以字符串字面值指定
SHOW TBLPROPERTIES customer ('created.date');
+----------+
| value|
+----------+
|01-01-2001|
+----------+