1. 程式人生 > >Vertica的這些事—— 關於vertica常用函式介紹(持續更新ing)

Vertica的這些事—— 關於vertica常用函式介紹(持續更新ing)

  • 取絕對值:select abs(-1);
  • 向上取整:select ceil(-1.001);
  • 向下取整:selectfloor(-1.001);
  • 取整:select trunc(-1.002);
  • 四捨五入:select round(1.23456,4.0);
  • 取隨機數:select random();
  • 數值比較:select greatest(1,-2,4,3);
  • 連結字元:select '11'||'22'||'33';
  • 返回字串位置:select INSTR('sdsq','s',2);
  • 擷取字串:select substr('abcd',2,2);
  • 替換字串:SELECT Replace('abcdef', 'bcd', 'ijklmn');
  • 格式化日期:select to_char(sysdate(),'YYYY-MM-DD');
  • 返回幾號:select day(sysdate);
  • 返回幾月:select month(sysdate);
  • 返回年份:select year(sysdate);
  • 返回第幾周:select week(sysdate);
  • 返回第幾季度:select quarter(sysdate);
  • 日期直接相加減
  • 查詢一個表有哪個使用者有哪些許可權 select grantor,grantee,privileges_description from grants where object_name=