create or replace table department
(
dep_id char(10) not null,
pro_id char(10) null,
name char(10) null,
manager char(10) null,
project char(10) null,
constraint PK_DEPARTMENT primary key clustered (dep_id)
);
/==============================================================/
/* Index: department_PK /
/==============================================================*/
create unique clustered index department_PK on department (
dep_id ASC
);
/==============================================================/
/* Index: dep_assigned_pro_FK /
/==============================================================*/
create index dep_assigned_pro_FK on department (
pro_id ASC
);
/==============================================================/
/* Table: employee /
/==============================================================*/
create or replace table employee
(
emp_id char(10) not null,
name char(10) null,
Identi_id char(10) not null,
role_id char(10) null,
pro_id char(10) null,
sala_id char(10) null,
dep_id char(10) null,
gender char(10) null,
age char(10) null,
phone char(10) null,
department char(10) null,
position char(10) null,
project char(10) null,
constraint PK_EMPLOYEE primary key clustered (emp_id, Identi_id)
);
/==============================================================/
/* Index: employee_PK /
/==============================================================*/
create unique clustered index employee_PK on employee (
emp_id ASC,
Identi_id ASC
);
/==============================================================/
/* Index: emp_has_role_FK /
/==============================================================*/
create index emp_has_role_FK on employee (
role_id ASC
);
/==============================================================/
/* Index: emp_belong_dep_FK /
/==============================================================*/
create index emp_belong_dep_FK on employee (
dep_id ASC
);
/==============================================================/
/* Index: emp_gets_sal_FK /
/==============================================================*/
create index emp_gets_sal_FK on employee (
sala_id ASC
);
/==============================================================/
/* Index: emp_assigned_pro_FK /
/==============================================================*/
create index emp_assigned_pro_FK on employee (
pro_id ASC
);
/==============================================================/
/* Table: project /
/==============================================================*/
create or replace table project
(
pro_id char(10) not null,
name char(10) not null,
manager char(10) null,
department char(10) null,
starttime char(10) null,
endtime char(10) null,
constraint PK_PROJECT primary key clustered (pro_id)
);
/==============================================================/
/* Index: project_PK /
/==============================================================*/
create unique clustered index project_PK on project (
pro_id ASC
);
/==============================================================/
/* Table: role /
/==============================================================*/
create or replace table role
(
role_id char(10) not null,
dep_id char(10) null,
name char(10) not null,
department char(10) null,
constraint PK_ROLE primary key clustered (role_id)
);
/==============================================================/
/* Index: role_PK /
/==============================================================*/
create unique clustered index role_PK on role (
role_id ASC
);
/==============================================================/
/* Index: dep_sets_role_FK /
/==============================================================*/
create index dep_sets_role_FK on role (
dep_id ASC
);
/==============================================================/
/* Table: salary /
/==============================================================*/
create or replace table salary
(
sala_id char(10) not null,
emp_id char(10) null,
Identi_id char(10) null,
emp char(10) null,
base char(10) null,
bonus char(10) null,
deduction char(10) null,
constraint PK_SALARY primary key clustered (sala_id)
);
/==============================================================/
/* Index: salary_PK /
/==============================================================*/
create unique clustered index salary_PK on salary (
sala_id ASC
);
/==============================================================/
/* Index: emp_gets_sal2_FK /
/==============================================================*/
create index emp_gets_sal2_FK on salary (
emp_id ASC,
Identi_id ASC
);
alter table department
add constraint FK_DEPARTME_DEP_ASSIG_PROJECT foreign key (pro_id)
references project (pro_id)
on update restrict
on delete restrict;
alter table employee
add constraint FK_EMPLOYEE_EMP_ASSIG_PROJECT foreign key (pro_id)
references project (pro_id)
on update restrict
on delete restrict;
alter table employee
add constraint FK_EMPLOYEE_EMP_BELON_DEPARTME foreign key (dep_id)
references department (dep_id)
on update restrict
on delete restrict;
alter table employee
add constraint FK_EMPLOYEE_EMP_GETS__SALARY foreign key (sala_id)
references salary (sala_id)
on update restrict
on delete restrict;
alter table employee
add constraint FK_EMPLOYEE_EMP_HAS_R_ROLE foreign key (role_id)
references role (role_id)
on update restrict
on delete restrict;
alter table role
add constraint FK_ROLE_DEP_SETS__DEPARTME foreign key (dep_id)
references department (dep_id)
on update restrict
on delete restrict;
alter table salary
add constraint FK_SALARY_EMP_GETS__EMPLOYEE foreign key (emp_id, Identi_id)
references employee (emp_id, Identi_id)
on update restrict
on delete restrict;
Please modify the table attribute, replace the "char" type with other suitable type.