-----------数值函数
---绝对值
select abs(-123) from dual; --求模
select mod (12,5) from dual; --取整
--上限值
select ceil(123.45) from dual; --下限值
select floor (123.45) from dual; --四舍五入
select round(123.55) from dual; select round(123.5267,2) from dual;--参数2表示小数点保留几位数 select round(126.5267,-1) from dual;--参数-1表示小数点向左移动1位

  

字符串函数、替换函数----------------------------------------------------------------------------

--截取,直接舍掉
select trunc (123.52) from dual;
select trunc (126.5267,2) from dual; select cno, round ( avg(degree) ,2) from score group by cno; --计算字符串长度
select sname, length (sname) from student;
select * from student where length (sname)>2; --去空格
select trim (' 付 s十b 亮 ') from dual;
select ltrim (' 付 s十b 亮 ') from dual;
select rtrim (' 付s十b亮 ') from dual; --替换
select replace(' abc def ', ' ' , '#' )from dual;--把空格换成# select replace (sname, '王', '李') ,sname from student where sname like '王%'; --更新姓王的学生名称为姓李的
update student set sname = replace (sname, '王', '李') where sname like '王%'; -- 查找字符串
select instr ('bac', 'a') from dual; --数据库中索引和字符串位置从1开始 --截取字符串
select substr('abdjhwkfjf', 2) from dual; --从第2位截取后面所有
select substr('abdjhwkfjf', 2,5) from dual; --从第2个截取到第五位结束
select substr('abdjhwkfjf', -8,5) from dual; --从右边向左数8位向右截取5位长度,长度不能是负数 select sname, substr(sname,1,1) || '同学'from student ; --成绩为空的替换成0
select t.*, nvl (degree ,0) from score t; select t.*, nvl (degree ,100,0) from score t;-- 100是不为空的替换成100,为空的默认为0 --替换
select t.* , decode (ssex, '1' , '男' ,'2','女' ,'不知道') from student t; -- 返回当前用户
select user from dual ;

  

聚合函数------------------------------------------------------

--1.聚合函数   返回单个值
--记录条数
select count (sno)from student where sclass=95031; --查平均成绩
select sum(degree)/count (1) from score;
select avg(degree) 平均值 from score; --合计总成绩
select sum(degree) from score; --最高成绩
select * from score order by degree desc; select max (degree)最大值, min (degree)最小值,avg(degree) 平均值 from score;

  

时间函数-------------------------------------------------------------------------

--字符串数字之间运算

select cast('123'  as number ) +123 from dual;
----------------------时间函数
--查询系统时间
select sysdate from dual; insert into course values ('8-123','设计素描','856',sysdate); select sysdate +1 from dual;
--增加系统月份
select add_months (sysdate,2) from dual;
--查询系统本月最后一天
select last_day (sysdate) from dual;

  

转换函数-----------------------------------------------------------------

--22、查询和学号为108的同学同年出生的所有学生的Sno、Sname和Sbirthday列。

select t.sbirthday, to_char (t.sbirthday,'yyyy-mm-dd hh24:mi:ss') from student t where sno='108'

select sno,sname,sbirthday from student  where to_char (sbirthday,'yyyy')=
(select to_char (t.sbirthday,'yyyy') from student t where sno='108'); select * from student where sbirthday >= to_date('1977-1-1','yyyy-mm-dd');

  

内置函数----整理、例题 、xmin的更多相关文章

  1. python3.7 内置函数整理

    #!/usr/bin/env python __author__ = "lrtao2010" #python3.7 内置函数整理 #abs(x) #返回数字的绝对值. 参数可以是整 ...

  2. python3.7内置函数整理笔记

    #python3.7 内置函数整理 #abs(x) #返回数字的绝对值. 参数可以是整数或浮点数. 如果参数是复数,则返回其大小 # print(abs(1)) # print(abs(-1)) # ...

  3. python常用内置函数整理

    1.最常见的内置函数是print print("Hello World!") 2.数学运算 abs(-5) # 取绝对值,也就是5 round(2.6) # 四舍五入取整,也就是3 ...

  4. golang中字符串内置函数整理

    字符串内置函数 1. 判断字符串的长度 str := "korea国" fmt.Println("str len=", len(str)) 2. 字符串遍历,同 ...

  5. pythonchallenge学到的python内置函数整理

    第0关: 计算x的n次方: x**n 第一关: maketrans(from,to):建立一个翻译规则,将from翻译成to的翻译规则,因为要从from翻译成to,所以俩个参数的长度必须一致 tran ...

  6. python内置函数整理

    1. abs() 函数返回数字的绝对值 2 divmod() 函数把除数和余数运算结果结合起来,返回一个包含商和余数的元组(a // b, a % b). 3, input() 相等于 eval(ra ...

  7. Python常用内置函数整理(lambda,reduce,zip,filter,map)

    匿名函数lambda lambda argument1,argument2,...argumentN :expression using arguments 1.lambda是一个表达式,而不是一个语 ...

  8. (二)SQL注入常用的内置函数整理(以MySql为例)

    [1]@@datadir 函数作用:返回数据库的存储目录构造SQL语句 select @@datadir;   [2]@@version_compile_os 函数作用:查看服务器的操作系统SQL语句 ...

  9. MySQL常用内置函数整理

    [1]@@datadir 函数作用:返回数据库的存储目录构造SQL语句 select @@datadir;ps:@@basedir返回mysql的根目录[2]@@version_compile_os ...

随机推荐

  1. 配置ogg异构oracle-mysql(3)目的端配置

    目的端配置大致分为如下三个步骤:配置mgr,配置checkpoint table,配置应用进程 在目的端先创建一张表,记得带主键: mysql> create database hr;Query ...

  2. C[泊车管理系统]

    // //  main.c //  泊车管理系统 // //  Created by 丁小未 on 13-7-14. //  Copyright (c) 2013年 dingxiaowei. All ...

  3. android开源项目和框架(转)

    特效: http://www.androidviews.net/ http://www.theultimateandroidlibrary.com/ 常用效果: 1. https://github.c ...

  4. 小甲鱼PE详解之IMAGE_OPTIONAL_HEADER32 结构定义即各个属性的作用(PE详解03)

    咱接着往下讲解IMAGE_OPTIONAL_HEADER32 结构定义即各个属性的作用! (视频教程:http://fishc.com/a/shipin/jiemixilie/) 接着我们来谈谈 IM ...

  5. Hadoop RPC机制的使用

    一.RPC基础概念 1.1 RPC的基础概念 RPC,即Remote Procdure Call,中文名:远程过程调用: (1)它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网 ...

  6. 模仿QQ左滑删除

    需求: 1.左滑删除 2.向左滑动距离超过一半的时候让它自动滑开,向右滑动超过一半的时候自动隐藏 3.一次只允许滑开一个item 还有,根本不需要自定义view来实现,谨防入坑 布局: <?xm ...

  7. 大端模式 VS 小端模式

    简单点说,就是字节的存储顺序,如果数据都是单字节的,那怎么存储无所谓了,但是对于多字节数据,比如int,double等,就要考虑存储的顺序了.注意字节序是硬件层面的东西,对于软件来说通常是透明的.再说 ...

  8. js整理1

    数组 比较时的隐式转化 var a = [1,2,3]; var b = [1,2,3]; a == b; //false a == '1,2,3'; //true; // var c = []; B ...

  9. 04 DOM一窥

    BOM 浏览器对象模型 * window       alert(); 弹出框 confirm() 询问框 setInterval("run()",1000); 每隔1秒执行run ...

  10. PHP 垃圾回收机制

    PHP垃圾回收说到底是对变量及其所关联内存对象的操作, 所以在讨论PHP的垃圾回收机制之前,先简要介绍PHP中变量及其内存对象的内部表示(其C源代码中的表示). PHP官方文档中将PHP中的变量划分为 ...