Re:20 Database Design Best Practices
by viggity on Monday July 25, 2011 @01:19PM
(#2803553)
I know this is a religious debate but this one bugs the hell out of me:
Use singular for table names (i.e. use StudentCourse instead of StudentCourses). Table represents a collection of entities, there is no need for plural names.
NOOOOOO!!!!!! The table stores MULTIPLE things, ergo, the table name should be pluralized. SQL makes more sense to read aloud this way. I mean, does anyone name their (code's) collections as singular?
Re:20 Database Design Best Practices
by pbreit on Monday July 25, 2011 @02:40PM
(#2803940)
Yeah, the jury seems to still be out on this one. If you are using SQL then plural sounds better. But if you are using some sort of ORM or data access layer, singular frequently works better (ie "rows = db(db.item.id>0).select()").
#10 also seems to be routinely violated, again, especially when ORM is used.
Use singular for table names (i.e. use StudentCourse instead of StudentCourses). Table represents a collection of entities, there is no need for plural names.
NOOOOOO!!!!!! The table stores MULTIPLE things, ergo, the table name should be pluralized. SQL makes more sense to read aloud this way. I mean, does anyone name their (code's) collections as singular?
#10 also seems to be routinely violated, again, especially when ORM is used.
plural of name represents the table name / collection.
singular of name represents an instance of collection / row of table.
e.g. the students table represents a collection of student rows.