数据库基础查询语句中的几个细节

运算

  select 姓名列,工资列,工资列*12 from 表名

  计算年薪

字符串拼接

  irst_name||'是'||start_date||'入职的,工资是'||salary||',职位是'||title 备注 from 表名

空值置换函数 nav()

  nvl(列|值|表达式,0)

  例子:查询所有员工的名字,年薪(考虑提成)

    select
    first_name,salary*12*(1+nvl(commission_pct/100,0)) 年薪
    from
    s_emp;

  如果不使用函数,若commission_pct中有空置,则输出时显示为空值

  

原文地址:https://www.cnblogs.com/wangqun1234/p/7762777.html