Skip to content

Commit 8147ea6

Browse files
authored
Update MySQL note.md
1 parent 27406a4 commit 8147ea6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

MySQL note.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
1.总天数 select to_days('2015-1-18')
2-
2. date('') yMd
3-
3.当前时间与特定时间所差周数的实现
1+
- 总天数 select `to_days('2015-1-18')`
2+
- 当前时间与特定时间所差周数的实现
3+
```
44
declare i int;
55
set i = timestampdiff(week,date(date_add(p_time,interval 8-dayofweek(p_time) day)),date(date_add(now(),interval 8-dayofweek(now()) day)));
66
return if(i<0,abs(i),i+1) ;
7-
4.limit后只能跟常量
8-
5.count() 返回hibernate是BigInteger
9-
6.hibernate 返回值不add scale,直接返回Object[] 时,sql里不能设置别名 如select text.text as name
10-
7.insert into table(columns) values(...),(...) mysql批量插入、
11-
8.update table set 。。 where id=(select * from (select max(id) from table) as A);必须再次select下
12-
9.SET GLOBAL event_scheduler = ON; 或者在mysql.ini下添加event_scheduler=1
13-
10.update可以用order by limit 1
14-
11.alter table users AUTO_INCREMENT=123456
15-
12.cursor 一定要在not found 时设置标记 然后leave loop。否则死循环!!!!2货
7+
```
8+
- `limit`后只能跟常量
9+
- `count()` 返回`hibernate``BigInteger`
10+
- `hibernate` 返回值不`add scale`,直接返回`Object[]` 时,sql里不能设置别名 如`select text.text as name`
11+
- `update table set 。。 where id=(select * from (select max(id) from table) as A)`必须再次select下
12+
- `SET GLOBAL event_scheduler = ON; 或者在mysql.ini下添加event_scheduler=1`
13+
- update可以用`order by limit 1`
14+
- `alter table users AUTO_INCREMENT=123456`
15+
- cursor 一定要在not found 时设置标记 然后leave loop。否则死循环!!!!2货

0 commit comments

Comments
 (0)