Hello,
I might have missed something about MySQL.
I'm trying to find a way to store a "count" in a column. It has to be dynamically updated without any manual update.
I don't want to add or remove 1 to the count any time the member creates or delete a content. The field in contentcount must automatically be a count of every content owned by this member.
create table content
(
id_content int not null auto_increment,
id_member int not null,
primary key (id_content)
);
create table member
(
id_member int not null auto_increment,
contentcount ???????????????,
primary key (id_member)
);
alter table content add constraint fk_member_content foreign key (id_member)
references member (id_member) on delete cascade on update cascade;
How can I achieve this ? Thank you for any help.