1. exists:
select * from table1 where exists (select * from table2)2. sequence
3. 
create sequence CustomerID increment by 1 start with 1000;
insert into Customer (name, id)
values ('whatever',CustomerID.NextVal);

解决方案 »

  1.   

    谢谢 karma(无为)
    原来我第一个问题是exists少写了个“s”。这样自动加一,好像太麻烦了。我想的是
    insert into Customer(name)
    values('whatever');
    时,对应的id自动加一。
    用触发器不知道可不可以呢?
      

  2.   

    建立BEFORE INSERT触发器
    Begin
    :new.id := 序列号;
    End; 
      

  3.   

    序列号是用sequence来记录?我试过用after insert来加触发器,但有问题啊。