create table emp2( eid int, name varchar(20), deptId int, salary double, constraint pk1 primary key(eid) -- constraint pk1 可以省略 ); 2.添加多列主键(联合主键) -- 联合主键,就是由多个字段组成一个主键约束 create table emp3( name varchar(20), deptId int, salary double, constraint pk2...
1.主键约束 primary key #主键约束primarykey #添加主键 添加后系统会默认为对应的列添加索引 提高检索速度 #方法一(单列主键):idintPRIMARYKEY//方法一是创建表时 当前定义字段后 方法二是创建表时 所有定义字段后 #方法二(单|多列主键):CONSTRAINTpk1PRIMARYKEY(name,deptId)//CONSTRAINTpk1可以省略 pk1是索...
create table emp1( eid int primary key, name varchar(20), edptId int, salary double ); 1. 2. 3. 4. 5. 6. 7. constraint <约束名> 可以省略(相当于给约束起一个名字) create table emp2( eid int, name varchar(20), deptId int, salary double, constraint pk1 primary key(eid) -- c...
Extensions to Referential Integrity in SQL2 create table YEAR (yearno number(8), yeartutorid number(4) constraint fk_tut references STAFF(staffid) on delete set null on update cascade), constraint year_pk1 primary key (yearno)); 君,已阅读到文档的结尾了呢~~ 立即下载 相似精选,再来一篇 ...
i use MySQL 5.1.35-community-log vie TCP/IP and I'm stuck with the following FOREIGN KEY problem: CREATE TABLE record ( pk1 TIMESTAMP NOT NULL, pk2 CHAR(23) NOT NULL, PRIMARY KEY (pk1,pk2), sessionId VARCHAR(124) NOT NULL )ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TA...
GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits 1 parent e4c6072 commit 9fb97477afba7726ddc6ff3232b8f6f6c5fb120e Unified Split Showing 5 changed files with 54 additions and 10 deletions. +7 −0 ...rc/java/org/apache/hadoop/hive/ql/ddl/table/constraint/drop/AlterTableDr...
1 2 3 4 5 6 7 constraint <约束名> 可以省略(相当于给约束起一个名字) createtableemp2(eidint,namevarchar(20),deptIdint,salarydouble,constraintpk1primarykey(eid)-- constraint pk1 可以省略); 1 2 3 4 5 6 7 8 2.添加多列主键(联合主键) ...