As far as I know, the single responsibility principle concerns functions, classes and modules. Now I am designing a database and I wonder if this principle should be applied to relational tables.
Concrete example: I see lot of similar design cases as the following table shows:
CREATE TABLE Units (
UnitId TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
UnitName VARCHAR(10) NOT NULL,
DateEntered DATETIME NOT NULL,
DateUpdated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (UnitId)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
My question is about that
DateEntered column: is it Ok to have it in
Units table or not? I mean does not this tell us somehow that an instance (row) of the
Units table should be aware of the date where it entered to the shop? To put it bluntly: should we apply SRP on the physical relational tables level too? Otherwise, does SRP affect the relational tables in anyway?