日期:2014-05-16  浏览次数:20727 次

PostgreSQL建表 主键自增类型如何搞定?
Mysql 进行如下建表是成功的,
mysql> create table t1(
  -> id1 int(10) not null primary key AUTO_INCREMENT,
  -> t1c1 varchar(100),
  -> t1c2 varchar(100)
  -> )AUTO_INCREMENT = 1;
那么 用PostgreSQL 建具有如上所示的 属性列 的表,应该如何书写呢?

和mysql 相同肯定是错的啊

------解决方案--------------------
SQL code
create table t1(
    id1 SERIAL primary key,
    t1c1 varchar(100),
    t1c2 varchar(100)
);