oracle、mysql 建表时创建主键

oracle 建表时创建主键

create table student (id number constraint id_pri primary key, name1 varchar(8) );

 

创建复合主键:
create table teacher (id number, name1 varchar(8), constraint aba_pri primary key(id, name1) );


---------------------------------------------------------------------

mysql 建表时创建主键

CREATE TABLE car ( id int not null primary key, name char(20) );

 

创建复合主键:
CREATE TABLE plane (
    id int not null,
    name char(20),
    primary key (id, name)
);

你可能感兴趣的:(数据库)