oracle 语法
1.基本语法:SELECT *[列名 [[AS] 别名],列名2...] FROM 表名 [[AS] 别名];
9. SQL函数:数据库管理系统(DBMS)提供的一些功能封装。不同的数据库产品所提供的函数不尽相同。 1) 单行函数:同时只能对一行进行操作,且对于每一行返回一个值。 聚合函数:同时对多行进行操作,这多行只返回一个值。 2) 单行函数: a) 字符串:lower(char),upper(char),length(char),initcap(x) b) 数字:round(number,n) c) 日期时间:sysdate 返回数据库所在操作系统的当前日期时间。 systimestamp 返回数据库所在操作系统的当前时间戳。 last_day(d) 返回指定日期当月的最后一天的日期时间 trunc(d[,unit]) 截断日期时间,unit: 'year','month','day' d) dual表是Oracle提供给任何用户的一个表,常用在没有目标表的SELECT语句中。 e) 转换函数: to_char(datatime[,format]),format: yyyy,mm,dd,hh24,mi,ss to_char(number[,format: l,9,',' to_date(char[,字符串-->日期时间 to_timestamp(char[,字符串-->日期时间戳 to_number(expr[,format]) f)其它函数: nvl(expr1,expr2) 如果expr1为空,返回expr2的值,否则返回expr1。 nvl2(expr1,expr2,expr3) 如果expr1不为空,返回expr2,否则返回expr3。 decode(expr,search1,result1,search2,result2,...) case expr when search1 then result1 when search2 then result2 ... else resultn end (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |