mysql-3

  1. 去重

group时取的是id最小的那一条记录

1
2
3
4
5
6
7
8
9
10
delete sprint_score
from sprint_score,
(select min(id) id, user_id, score, create_time, count(*) from sprint_score
GROUP BY user_id, score, create_time
HAVING count(*) > 1) t2
where
sprint_score.user_id = t2.user_id
and sprint_score.score = t2.score
and sprint_score.create_time = t2.create_time
and sprint_score.id > t2.id

linux-account

  1. 查看所有的用户
1
2
3
4
5
[root@localhost ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
  1. 查看所有的用户组
1
2
3
4
5
6
[root@localhost ~]# cat /etc/group
root:x:0:
bin:x:1:
daemon:x:2:
sys:x:3:
adm:x:4: