重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

标题: 【SQL基础】Concatenation operator 和 Literal character string语句例子 [打印本页]

作者: 5dm    时间: 2012-10-15 15:48
标题: 【SQL基础】Concatenation operator 和 Literal character string语句例子

SQL> select last_name||'''s job_id is '||job_id   
  2  AS "Employees'id"
  3  from employees;

 

结果如下:

Employees'id
------------------------------------------------
Abel's job_id is SA_REP
Ande's job_id is SA_REP
Atkinson's job_id is ST_CLERK
Austin's job_id is IT_PROG
Baer's job_id is PR_REP
Baida's job_id is PU_CLERK
Banda's job_id is SA_REP
Bates's job_id is SA_REP
Bell's job_id is SH_CLERK
Bernstein's job_id is SA_REP
Bissot's job_id is ST_CLERK

 

分析:

SQL语句中,两个单引号可以转意为一个单引号,两个双引号里面的那个单引号保留愿意。双竖线连接两个字段成为一个字段。

 


作者: 郑全    时间: 2012-10-15 16:20
对,不错




欢迎光临 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2