zoukankan      html  css  js  c++  java
  • 数据库

    单行函数
    字符函数:lower:大写转换成小写 upper:initcap:首字母大写
    concat:连接
    substr('helloworld',2,4)输出ello(从1开始数的)
    length:长度
    instr:首次出现的位置
    lpad:不足左侧用别的代替:相当于右对齐
    rpad:相当于左对齐
    trim:去掉首尾的指定字符
    replace:讲一个字符串中替换另一个
    round:四舍五入


    trunc:截断


    months_between:两个日期之间的月份数
    add_months:向指定的日期加上几个月
    next_day:从现在看下一个星期几
    last_day:本月的最后一天
    max:一列中最大的值
    ceil:向上取整
    floor:向下取整

     

    显示数据转换:tochar todate tonumber


    日期格式:'yyyy'"年"'mm'"月"'dd'"日"

     

    分组函数:与group by连用
    mod:取余
    avg:平均值
    count:计数
    sum:和


    通用函数:适用于任何数据类型和空值

    nvl:(exrt1,exrt2)将空值转换为已知值,若为空返回2,不为空返回本身,2只能写数字
    nvl2(exrt1,exrt2,exrt3):若1为空,返回2,若1不为空,返回3
    nullif(exrt1,exrt2):若相等返回null,不相等返回exrt1,

    条件表达式

    case:case exrt1 when exrt2 then。。
    when。。then。。。
    else。。。
    end

    SELECT p_emp.deptno,ename,sal,CASE deptno WHEN 10 THEN sal*1.1
                                              WHEN 20 THEN sal*1.2
                                              ELSE sal*1.5
                                              END new_sal
    FROM p_emp
    WHERE deptno IN(10,20,30) ;


    decode:decode(exrt1,。。,。。
    ..,..)

    SELECT p_emp.deptno,ename,sal,DECODE (deptno ,10 , sal*1.1,
                                                  20 ,sal*1.2,
                                                  sal*1.5)
                                               new_sal
    FROM p_emp
    WHERE deptno IN(10,20,30) ;
  • 相关阅读:
    Qt进程间通信
    reinterpret
    vs调试技巧
    利用QSystemSemaphore和QSharedMemory实现进程间通讯
    QLocalSocket
    QShareMemory
    qt动态库实现无边框窗体的消息处理 nativeEvent的使用
    BCB6常用快捷键
    1219个人总结
    冲刺二 12.6
  • 原文地址:https://www.cnblogs.com/NCL--/p/7309005.html
Copyright © 2011-2022 走看看