考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

建立如下数据库表: CREATE TABLE department( departid int not null primary key, deptname varchar(20) not null ); CREATE TABLE employee( employeeid int not null, deptid int not null, ename varchar(20) not null, job varchar(10),sal decimal(10,2) ); (1)要想保证employee表中每一个雇员是唯一的,且只能属于在department表中已经存在的部门,最有效的做法是
A. 把employeeid和deptid设为联合主键
B. 把employeeid设为主键,同时在deptid列上创建一个外键约束
C. 把employeeid设为主键,同时在deptid列上创建一个唯一约束
D. 在deptid列上创建一个唯一约束,同时在deptid列上创建一个外键约束
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

【解析】要想保证employee表中每一个雇员是唯一的,把employeeid设为主键或唯一约束。每个雇员只能属于在department表中已经存在的部门,在deptid列上创建一个外键约束。