计算两日期间隔天数values (days(current date) - days('2014-09-01'))去出某一字符串的的一个单词,空格为分隔符select substr(title,1,instr(title,' ')-1) from titles将字符串的一个空格替换为'--hello--'select substr(title,1,locate(' ',title)-1) || '--hello--' || substr(title,locate(' ',title)+1) from titlesdb2生成随机数select case when price is null then INT(rand()*100) else price end from titles两日期相差多少月,64代表月。参数可以更改求出周,小时等等。select TIMESTAMPDIFF(64,char(TIMESTAMP(CURRENT DATE) - TIMESTAMP(pubdate)) )from titles有关db2日期操作可参考此博客。http://www.cnblogs.com/wanghonghu/archive/2012/05/25/2518604.html建立数据表,有generated always列create table t1(c1 char(30),c2
...
继续阅读
(17)