sql基础常用函数总结
2016-05-16 23:50
477 查看
--查表,*可以替换为table列的名称,select是对table的筛选,*代表所有列 select * from table --更新UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值 update table set username='jack' --删除 delete from table --删除一列 delete from table where username is null --字符串处理 lower()--转化小写 select lower(username) from table intcap--首字母大写 select initcap(username) from table --截取 select substr(username,开始(int),结束(int)) from table --判断字符串的位置 select instr('被搜索的字符串','希望搜索到的字符串') from table --字符串替换, select replace(列名,'需替换字段','替换字段') from table --数字处理 --数字四舍五入 select round(列) from table --小数截断 select trunc(列,截断几位) from table --取余 select mod(列,取余第几位) from table
--日期转化 --to_date()yyyy-mm-dd hh24:mi:ss日期格式根据需求的修改 select to_date('2016-05-16 18:22:22','yyyy-mm-dd hh24:mi:ss') from table
--字符串处理函数 to_char(),to_numbe()r,to_date()
--to_char用法如图
相关文章推荐
- SQL中的三值逻辑
- SQL Server 作业批量停止
- 结束SQL阻塞的进程
- 动态生成SQL Server视图作业
- SQL Server 语句操纵数据库
- SQL(结构化查询语句)
- oracle sql日期比较
- linux快速部署mysql服务器
- Mootools 1.2教程 函数
- autoit InputBox 函数
- sql 存储过程分页
- 文件遍历排序函数
- 在WINXP系统上安装SQL Server企业版的方法
- 通过批处理调用SQL的方法(osql)
- SQL Server 存储过程的分页
- ASP程序与SQL存储过程结合使用详解
- SQL SERVER编写存储过程小工具
- 防御SQL注入攻击时需要注意的一个问题