Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3354893
  • 博文数量: 1450
  • 博客积分: 11163
  • 博客等级: 上将
  • 技术积分: 11101
  • 用 户 组: 普通用户
  • 注册时间: 2005-07-25 14:40
文章分类

全部博文(1450)

文章存档

2017年(5)

2014年(2)

2013年(3)

2012年(35)

2011年(39)

2010年(88)

2009年(395)

2008年(382)

2007年(241)

2006年(246)

2005年(14)

分类: Mysql/postgreSQL

2006-05-18 14:19:34

create table tab(
    id int not null  AUTO_INCREMENT primary key,
    isMarry int default 1
);

insert into tab() values();//向表中插入记录

alter table tab add info char(50) null;

alter table tab add info1 char(50) not null default 123;

alter table tab drop info1; //删除字段

mysql> SET @auto_increment_increment=10;
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE 'auto_inc%';

+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+

| auto_increment_increment | 10    |
| auto_increment_offset    | 1     |

+--------------------------+-------+


mysql> SELECT col FROM autoinc1;

 +-----+
 | col |
 +-----+
 | 1   |
 | 11  |
 | 21  |
 | 31  |
 +-----+

mysql> SET @auto_increment_offset=5;
 Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE 'auto_inc%';

+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| auto_increment_increment | 10    |
| auto_increment_offset    | 5     |
+--------------------------+-------+


阅读(2240) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~