Conventions
Following a set of database conventions improves the readability and understanding of the database and related SQL. Every DBA has their own thoughts about which convention to follow. This is ours, tailored for MySQL.
Note: While we typically recommend PascalCase naming for Linx development (e.g.,
UpdateCustomer), MySQL identifier case sensitivity depends on the underlying operating system and thelower_case_table_namessetting. To avoid portability issues between Windows and Linux servers, we encourage snake_case naming in MySQL for practical and technical consistency.
Naming
Names must clearly describe the object.
Use
snake_casefor all object names in MySQL.Avoid Hungarian notation (e.g.,
int_number).Avoid abbreviations unless they are widely recognized.
Tables
noun, singular
customer
Stored Procedures
verb_noun
update_customer
Views
noun
customer_orders
Fields
noun
surname
You can use PascalCase object names in MySQL if you quote them consistently in every SQL statement (e.g.,
`Customer`). However, this is discouraged as it leads to more verbose and error-prone SQL, and can break when moving between operating systems.
SQL Queries
Use consistent indentation.
Use UPPERCASE for SQL keywords:
SELECT,FROM,WHERE,JOIN, etc.Use meaningful aliases—avoid single-letter or cryptic abbreviations.
Use single quotes (
'string') for string literals.Use backticks (
`identifier`) only when necessary to refer to case-sensitive or reserved identifiers.
Links
Last updated