看看session表的结构
1 mysql> desc session;
2
3 +——————-+———————+——+—–+———+——-+
4
5 | Field | Type | Null | Key | Default | Extra |
6
7 +——————-+———————+——+—–+———+——-+
8
9 | sky_id | int(10) unsigned | NO | PRI | NULL | |
10
11 | user_name | char(32) | NO | | NULL | |
12
13 | nick_name | char(32) | YES | | NULL | |
14
15 | nick_name1 | char(64) | YES | | NULL | |
16
17 | gender | tinyint(1) | YES | | NULL | |
18
19 | age | int(10) unsigned | YES | | NULL | |
20
21 | portrait_id | int(10) unsigned | YES | | NULL | |
22
23 | token | int(10) unsigned | YES | | NULL | |
24
25 | province | char(32) | YES | | NULL | |
26
27 | city | char(32) | YES | | NULL | |
28
29 | pos_code | int(10) unsigned | YES | | NULL | |
30
31 | pos_desc | varchar(64) | YES | | NULL | |
32
33 | acc_esbaddr | int(10) unsigned | YES | | NULL | |
34
35 | acc_session_index | int(10) unsigned | YES | | NULL | |
36
37 | acc_type | tinyint(3) unsigned | YES | | NULL | |
38
39 | ip | char(15) | YES | | NULL | |
40
41 | alive_check | int(10) unsigned | YES | | NULL | |
42
43 | longitude | int(11) | YES | MUL | NULL | |
44
45 | latitude | int(11) | YES | MUL | NULL | |
46
47 | loc_desc | varchar(64) | YES | | NULL | |
48
49 | rand_tag | int(11) | YES | MUL | NULL | |
50
51 | mid | varchar(256) | YES | | NULL | |
52
53 | last_oltime | int(11) | YES | | 0 | |
54
55 | logintime | int(11) | YES | | 0 | |
56
57 +——————-+———————+——+—–+———+——-+
58
59 24 rows in set (0.05 sec)
2
3 +——————-+———————+——+—–+———+——-+
4
5 | Field | Type | Null | Key | Default | Extra |
6
7 +——————-+———————+——+—–+———+——-+
8
9 | sky_id | int(10) unsigned | NO | PRI | NULL | |
10
11 | user_name | char(32) | NO | | NULL | |
12
13 | nick_name | char(32) | YES | | NULL | |
14
15 | nick_name1 | char(64) | YES | | NULL | |
16
17 | gender | tinyint(1) | YES | | NULL | |
18
19 | age | int(10) unsigned | YES | | NULL | |
20
21 | portrait_id | int(10) unsigned | YES | | NULL | |
22
23 | token | int(10) unsigned | YES | | NULL | |
24
25 | province | char(32) | YES | | NULL | |
26
27 | city | char(32) | YES | | NULL | |
28
29 | pos_code | int(10) unsigned | YES | | NULL | |
30
31 | pos_desc | varchar(64) | YES | | NULL | |
32
33 | acc_esbaddr | int(10) unsigned | YES | | NULL | |
34
35 | acc_session_index | int(10) unsigned | YES | | NULL | |
36
37 | acc_type | tinyint(3) unsigned | YES | | NULL | |
38
39 | ip | char(15) | YES | | NULL | |
40
41 | alive_check | int(10) unsigned | YES | | NULL | |
42
43 | longitude | int(11) | YES | MUL | NULL | |
44
45 | latitude | int(11) | YES | MUL | NULL | |
46
47 | loc_desc | varchar(64) | YES | | NULL | |
48
49 | rand_tag | int(11) | YES | MUL | NULL | |
50
51 | mid | varchar(256) | YES | | NULL | |
52
53 | last_oltime | int(11) | YES | | 0 | |
54
55 | logintime | int(11) | YES | | 0 | |
56
57 +——————-+———————+——+—–+———+——-+
58
59 24 rows in set (0.05 sec)
可以看出,sky_id上是主键。