I noticed this article today: http://www.sitepoint.com/blogs/2009/...e-development/
I've never used explicit foreign key contraints before. Looking at this section:
It seems to me like this is using the database for business logic. If that's true, then which is the better location for keeping referential integrity between a primary key on one table and a foreign key on another? PHP or MySQL? Also, could DB views be considered business logic? How do you decide how much to have the database do, and how much to do yourself?
ALTER TABLE borrowed
ADD CONSTRAINT FK_borrowed
FOREIGN KEY (employeeid) REFERENCES employee(id)
ON UPDATE CASCADE
ON DELETE CASCADE;