openGauss插件使用指南:别名

别名

SQL可以重命名一个字段的名称,这个名称为该表或该字段的别名,别名的形式可以是单引号字符串,ansi_quotes关闭的情况下,双引号字符串也可以。

语法格式

  • 列别名语法

    SELECT 
    { * | [column [ AS ] output_name, ...] }
    [ FROM from_item [, ...] ]
    [ WHERE condition ];
    

参数说明

  • output_name

    AS是可选字段,通过使用子句AS(可选) output_name可以为输出字段取个别名,output_name支持单引号形式的字符串。

示例

openGauss=# select id 'test_id' from tab;
 test_id
---------
      22
(1 row)

openGauss=# select id as 'test_id' from tab;
 test_id
---------
      22
(1 row)
posted @ 2024-07-10 17:31  openGauss-bot  阅读(44)  评论(0)    收藏  举报