Use lowercase (a-z
), digits (0-9
) and the underscore character (_
) for table names.
This convention provides optimal usability and portability. This is documented in the MySQL Reference Manual here:
https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html
Excerpt:
To avoid problems caused by such differences, it is best to adopt a consistent convention, such as always creating and referring to databases and tables using lowercase names. This convention is recommended for maximum portability and ease of use.
An entity identified as "Smartphone Brand" can be implemented as tablename smartphone_brand
.
Another convention I tend to follow is to name tables in the singular; naming what one row in the table represents. Why I would not name the table smartphone_brands
.
Also use full words and avoid abbreviations. Also avoid prefixing/suffixing table names with object type identifier such as tbl_smartphone_brand
or smartphone_brand_table
.
--
Of course its possible to produce a successful software project following other conventions. The conventions I follow are just one possible pattern.
As an industry professional, once we run into significant problems with the other database identifier conventions (as in what should be a simple port of a database application from Windows to Linux turns into a laborious grind), which could have been avoided by following a different convention, we discover that those features that we might currently identify as minor annoyances turn out to be tremendous time savers.