B
B
Bakewka2019-03-18 08:58:36
SQL
Bakewka, 2019-03-18 08:58:36

How to create a software package for automating video rental activities?

i want to join main tables with auxiliary tables
create table project_client2 (client_id number primary key not null
,client_name varchar2(2000) not null,
client_lastname varchar2(2000) not null,
join_date date default SYSDATE not null,
phone number,
address varchar2(2000)
);
create table project_kartoteka2 (
disk_id number not null,
disk_title varchar2(2000) not null,
disk_type number not null,
category number not null,
status number not null
);
create table project_reg_date2 (
transaction_id number primary key not null,
client_id number ,
disk_id number ,
reg_dat date not null,
exp_dat date not null
);
alter table project_reg_date2 add constraint project2_client_id_fk foreign key(client_id) references project_client2(client_id);
alter table project_reg_date2 add constraint project2_kartoteka_fk foreign key(disk_id) references project_kartoteka2(disk_id);
create table project_category2 (
cat_id number not null,
cat_name varchar2(2000) not null
);
create table project_status2 (
status_id number not null,
status_name varchar2(15) not null
);
create table project_type2 (
type_id number not null,
type_name varchar2(2000) not null
);
alter table project_category2 add constraint category_pk2 primary key(cat_id);
alter table project_category2 add constraint project_category_id_fk2 foreign key (cat_id) references project_kartoteka2(category);
alter table project_type2 add constraint type_pk2 primary key(type_id);
alter table project_type2 add constraint project_type_id_fk2 foreign key(type_id) references project_kartoteka2(disk_type);
alter table project_type2 add constraint project_type_name_check2 check (type_name in ('KASSETA','DISK'));
where bold is displayed no primary key or unique error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EVGENY T., 2019-03-18
@Bakewka

The project_kartoteka2.category field is not unique and not a key one, a foreign key cannot refer to such a field.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question