mysql 主键自动增长 主键是p001,p002的增长 用什么办法可以实现表主键p001p002p003p004的增长,写一个函数,还是过程来实现那?怎么编? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 表主键定为 1,2,3 N显示的时候select p+right(id+1000,3) == 思想重于技巧 == 你确定都是'p' + 001, 002, ... 999的这种模式吗?不知道下边是不是你想要的?mysql> create table t3(fid int(3) zerofill not null auto_increment primary key,col2 varchar(32));Query OK, 0 rows affected (0.08 sec)mysql> insert into t3 values(null, 'iihero');Query OK, 1 row affected (0.03 sec)mysql> insert into t3 values(null, 'iihero1');Query OK, 1 row affected (0.03 sec)mysql> insert into t3 values(null, 'iihero3');Query OK, 1 row affected (0.08 sec)mysql> select concat('p', fid), col2 from t3;+------------------+---------+| concat('p', fid) | col2 |+------------------+---------+| p001 | iihero || p002 | iihero1 || p003 | iihero3 |+------------------+---------+3 rows in set (0.00 sec) create table t3(fid int(3) zerofill not null auto_increment primary key, col2 varchar(32);中的zerofill是什么意思?为什么就只是001三位那,那他自动增加到999以后还会增加吗? int(4)可以到9999int(10)可以到9999999999 存储过程内使用declare的变量如何用在里面的LIMIT中?? 存储过程 新手问路 还是postgresql菜鸟问题连接数据库 [原创]将MSSQL数据导入MySQL My SQL 中,日期时间格式问题。 我现在需要从mysql导一个库到postgresql,有没有什么好工具或方法 我用mysqldump备份的mysql innodb的库不能正确恢复,因为数据内容有gb2312码和big5码!! 请问mysql是不是可以装在非c盘根目录下,比如f:\,我的c:只剩9M了! 关于Mysql触发器的一点疑问 用户-朋友列表数据库设计与性能 请教一个MYSQL查询的问题,感谢关注的朋友:)
定为 1,2,3 N
显示的时候
select p+right(id+1000,3)
mysql> create table t3(fid int(3) zerofill not null auto_increment primary key,
col2 varchar(32));
Query OK, 0 rows affected (0.08 sec)mysql> insert into t3 values(null, 'iihero');
Query OK, 1 row affected (0.03 sec)mysql> insert into t3 values(null, 'iihero1');
Query OK, 1 row affected (0.03 sec)mysql> insert into t3 values(null, 'iihero3');
Query OK, 1 row affected (0.08 sec)mysql> select concat('p', fid), col2 from t3;
+------------------+---------+
| concat('p', fid) | col2 |
+------------------+---------+
| p001 | iihero |
| p002 | iihero1 |
| p003 | iihero3 |
+------------------+---------+
3 rows in set (0.00 sec)
col2 varchar(32);
中的zerofill是什么意思?
为什么就只是001三位那,那他自动增加到999以后还会增加吗?
int(10)可以到9999999999