Is it possible to create a check saying:
"in computer_system, check if ram (from ram_table) matches ram_type (from motherboard_table)"
I've been all over google and stackoverflow, and I've read it was 'impossible' to refer to foreign table column in a check ? But is there a work-around, or how is my logic flawed? Any help is appreciated!
(Edited for relevant code)
create table computer_system(
system_id int primary key,
ram int not null references ram(ram_id),
cpu int not null references cpu(cpu_id),
mb int not null references motherboard(mb_id),
case int not null references computer_case(case_id),
graphics int references gfx(gfx_id)
);
create table motherboard(
mb_id int primary key,
ram_type varchar(10) not null,
socket varchar(10) not null,
form_factor varchar(30) not null,
ob_gfx boolean default(false)
)
create table ram(
ram_id int primary key,
speed int not null,
size int not null,
type varchar(10) not null
)