Wednesday, 28 August 2013

MySQL cascading tables

MySQL cascading tables

(My website is built using PHP and MySQL.)
My DB structure for users is mainly composed of 2 tables: "doctors" and
"clients".
However, in order to integrate a chat system, I need to create a third
table, namely 'chat_users', which combines both doctors and clients:
fields of 'chat_users' table are
userid (unique integer),
username,
type (0:client, 1:doctor),
refid (id of the user in the associated clients or doctors table)
But I do not want to insert/delete/update this table manually each time a
client or doctor is inserted/updated/deleted. I heard about cascading
table some time ago...
What would be the best way performance-wise to do so? How can I achieve it?

No comments:

Post a Comment