I have 2 tables:
create table numbers2
(
id1 int IDENTITY(1,1) not null,
id2 int not null,
primary key(id1, id2)
)
and table 2
create table ttt
(
id int identity(1,1) not null,
first_name varchar(50) null,
last_name varchar(50) null,
sex varchar(1) check (sex in ('m', 'f')) null,
number_id int not null,
id_id1 int not null,
id_id2 int not null,
primary key(id),
constraint fk_numbers_id1 foreign key (id_id1) references numbers2(id1)
on update no action
on delete no action
)
The problem is how to add constraint "fk_numbers_id1" so it will only reference one part of the composite key from table numbers2. Is it possible or there is other solution?