Disclaimer: I just started with databases, so I'm probably missing something extremely trivial.
I have two (somewhat related, but not enough to be a single table) tables: table_one
and table_two
.
table_one
has two columns of significance:
name
of typevarchar(n)
intersects
of typebit
table_two
has one column of significance:
name
of typevarchar(n)
I would like to automatically set intersects
to either 0
or 1
depending on whether name
is present in table_two
.
Can I somehow delegate this responsibility to the database engine? I'm currently using MySQL, if that matters.
EDIT: Does this sort of close-coupling even make sense when dealing with databases?