oracle 数据库设置表和字段的别名
select * from all_tab_cols
-- 设置表别名
COMMENT ON TABLE EMPLOYEE is '雇员';
COMMENT ON TABLE PRODUCT is '产品';
COMMENT ON TABLE PRODUCT_CLASS is '产品分类';
COMMENT ON TABLE STORE is '商品';
COMMENT ON TABLE TIME_BY_DAY is '时间转换';
--设置字段别名
COMMENT ON COLUMN PRODUCT.PRODUCT_CLASS_ID IS '产品分类代码';
COMMENT ON COLUMN PRODUCT.PRODUCT_ID IS '产品代码';
COMMENT ON COLUMN PRODUCT.BRAND_NAME IS '产品名称';
--取得表别名
SELECT
t1.table_name as 表名
,t2.comments as 表别名
FROM all_all_tables t1
LEFT JOIN all_tab_comments t2
ON t1.table_name=t2.table_name
WHERE t1.table_name='EMPLOYEE'
--取得字段别名
SELECT
t1.table_name as 表名
,t3.comments as 表别名
,t1.column_name as 字段名
,t2.comments as 字段别名
FROM all_tab_cols t1
LEFT JOIN all_tab_comments t3
ON t1.table_name=t3.table_name
LEFT JOIN all_col_comments t2
ON t1.table_name=t2.table_name
AND t1.column_name=t2.column_name
WHERE t1.table_name='PRODUCT'