funykatebird的个人博客分享 http://blog.sciencenet.cn/u/funykatebird

博文

数据库常用命令

已有 2470 次阅读 2018-9-13 11:40 |个人分类:资料收集|系统分类:科研笔记

mysql 字符串 拼接 截取 替换

https://blog.csdn.net/yuqiongran/article/details/52571857

 MySQL 字符串截取函数

https://blog.csdn.net/mycms5/article/details/52725877


MySQL日期和字符串转换函数实例

https://www.2cto.com/database/201805/743743.html


替换掉mysql数据库指定字段的所有数据的中指定字符串

https://blog.csdn.net/superit401/article/details/53929443


sql 如何删除(代替)字段内某一部分内容

https://www.cnblogs.com/laozhanghahaha/p/6907069.html

SQLServer SQL语句格式化日期时间年月日时分秒,去掉毫秒

https://blog.csdn.net/chinaplan/article/details/80469638

mysql日期加减

https://www.cnblogs.com/winner-0715/p/6132838.html

select curdate(),now(),date(now());

mysql 获取当前日期周一和周日

https://blog.csdn.net/huanghanqian/article/details/53540392

select subdate(curdate(),date_format(curdate(),'%w')-1)//获取当前日期在本周的周一 

select subdate(curdate(),date_format(curdate(),'%w')-2)//获取当前日期在本周的周二 

select subdate(curdate(),date_format(curdate(),'%w')-7)//获取当前日期在本周的周日 

%W     星期名字(Sunday……Saturday)    

%w     一个星期中的天数(0=Sunday   ……6=Saturday   )


mysql日期 获取本月第一天 获取下个月的第一天

https://www.cnblogs.com/wujf/p/9364878.html







mysql加减时间-函数-时间加减 

https://blog.csdn.net/yuxiayiji/article/details/7480785

select dayofweek(now()); 

select DAYNAME('2019-03-02');##周六1,周日7


MySQL时间戳和时间的获取/相互转换/格式化

https://blog.csdn.net/lilongsy/article/details/79061639

sql点滴—mysql中查询表的信息

https://www.cnblogs.com/tylerdonet/p/5509398.html

https://blog.csdn.net/wolangjushi/article/details/19966563






mysql 字段 is not null 和 字段 !=null

https://blog.csdn.net/wangzaza/article/details/79484069

https://blog.csdn.net/wangzaza/article/details/79484069

MySQL ERROR 1799 (HY000) innodb_online_alter_log_max_size参数过小的一则case

https://www.linuxidc.com/Linux/2017-06/145042.htm

解决MySql查询语句报Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre异常的问题

https://blog.csdn.net/fansili/article/details/78664267

https://blog.csdn.net/qq_34246315/article/details/81584343







mongo的安装和运行

https://blog.csdn.net/qq_39729527/article/details/81285072

MongoDB Shell和Robo3T使用以及与SQL语法比较

https://blog.csdn.net/freeking101/article/details/80795412

MongoDB常用操作命令大全

https://blog.csdn.net/piaocoder/article/details/52384756

robomongo(robo3T)操作MongoDB数据库常用命令

https://blog.csdn.net/qq_27378621/article/details/80006734

mongodb报错1: connecting to:mongodb://127.0.0.1:27017. connect failed

https://blog.csdn.net/qq_39729527/article/details/81285405?utm_source=blogxgwz0

Mongodb连接失败问题的几种情况和解决方式

https://blog.csdn.net/u011642782/article/details/79193188






11/19/2014 13:37:51 格式转换 2014-11-19


变换日期的分割符

UPDATE tab_a_time_copy1  SET `下单时间`=REPLACE(`下单时间`,'/','-') 

将时间去除

方法1

update tab_a_time_delimiter_copy1 

set `下单时间`=replace(`下单时间`,substring(`下单时间`,-9,9),'')

方法2


update tab_a_time_delimiter_copy1 

set `下单时间`= substring_index(`下单时间`, ' ', 1);


#UPDATE tab_a_time_copy1 Set  `下单时间`=REPLACE(`下单时间`,'/','-') 

update tab_a_time_copy1 

set `下单时间`=replace(`下单时间`,substring(`下单时间`,-9,9),'')


#set `下单时间`=replace(`下单时间`,substring(`下单时间`,-9,9),'')


#substring(str, pos, length) 



#select substring_index('3-28-2017 14:52:19', ' ', 1);   

#select str_to_date(‘2014-04-22 15:47:06’,’%Y-%m-%d %H:%i:%s’)


在前面加上-

update tab_a_time_delimiter_copy1

set `下单时间`=replace(`下单时间`,substring(`下单时间`,1,1),concat('-',substring(`下单时间`,1,1)))

年份放在最前面

update tab_a_time_delimiter_copy1

set `下单时间`=replace(`下单时间`,substring(`下单时间`, 1),concat(substring(`下单时间`,-4,4),substring(`下单时间`, 1)))

去除后面的年份

update tab_a_time_delimiter_copy1 

set `下单时间`=replace(`下单时间`,substring(`下单时间`,-5,5),'')

补齐单位数月份前面的0

update tab_a_time_delimiter_copy1_copy1

set 

`下单时间`=replace(`下单时间`,substring(`下单时间`, 1, 5),concat(substring(`下单时间`,1,5),'0')) WHERE `下单时间` LIKE '%-_-%'


select * from tab_a_time_delimiter_copy1_copy1 WHERE `下单时间` LIKE '%-_-%'


补齐单位数日子前面的0

update tab_a_time_delimiter_copy1_copy1

set 

`下单时间`=replace(`下单时间`,substring(`下单时间`, 1, 8),concat(substring(`下单时间`,1,8),'0')) WHERE `下单时间` LIKE '%-_'

select * from tab_a_time_delimiter_copy1_copy1 WHERE `下单时间` LIKE '%-_'





https://blog.sciencenet.cn/blog-597740-1134572.html

上一篇:英文写作常用短语二
下一篇:ETL相关工具常见问题
收藏 IP: 36.102.222.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-20 17:15

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部