BEGIN DECLARE s_tablename VARCHAR(100); /*显示表的数据库中的所有表 SELECT table_name FROM information_schema.tables WHERE table_schema='databasename' Order by table_name ; */ #显示所有 DECLARE cur_table_structure CURSOR FOR SELECT table_name FROM INFORMATION_SCH…
1. 在已存在的表中添加字段约束AUTO_INCREMENT修饰符 mysql> alter table user modify uid int auto_increment primary key; ERROR 1062 (23000): ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY' 理解:uid有0, 而auto_increment是从1开始…