← Back to the generator

Database naming conventions by engine

Every major database engine has its own rules for identifiers — length limits, case handling and reserved words. Name for the strictest engine you might ever use, and you will never have to rename.

Identifier rules at a glance

EngineMax lengthCase behaviorNotes
PostgreSQL63 bytesUnquoted identifiers fold to lowercase"MyDB" and mydb are different; unquoted MyDB becomes mydb.
MySQL / MariaDB64 charactersCase sensitivity follows the OS on LinuxA database named Shop on macOS may break when moved to Linux.
SQL Server128 charactersUsually case-insensitive (collation-dependent)Bracket quoting [My DB] allows spaces — do not use them anyway.
SQLiteNo practical limitCase-insensitive for ASCIIVery permissive, but name as if you will migrate one day.

The universal convention: lowercase snake_case

Every engine accepts lowercase letters, digits and underscores without quoting. atlas_billing works in PostgreSQL, MySQL, SQL Server and SQLite exactly as written. That is why it is the default style in our database name generator — it is the only style with zero quoting surprises everywhere. If your team standardizes on one rule, make it this one.

Environment suffixes

When one logical database spans environments, append the environment: _dev, _staging, _prod (or _test for CI). Keep the order consistent — domain first, environment last: shop_prod, not prod_shop. Sorting and shell globbing (shop_*) both work better this way. Our generator can emit dev/staging/prod trios from a single base word automatically.

Prefixes: when they help and when they hurt

A short project prefix like atlas_ or db_ groups databases that belong together and prevents collisions on shared servers. On a dedicated server with one database, the prefix adds noise — drop it. Never prefix with the engine name (pg_shop, mysql_shop): engines change, and the name should not lie after a migration.

Reserved words to avoid

Common SQL reserved words that make terrible database names: select, table, order, group, user, index, database, schema. Some engines will reject them outright; the rest will accept them and then require quoting in every statement. There are hundreds more per engine — when in doubt, pick a name that is obviously not a keyword.

Characters: the safe set

Restrict database names to a–z, 0–9 and _, never starting with a digit. Hyphens, dots and spaces are technically possible with quoting on most engines, but they break shell scripts, ORM quoting assumptions and backup tooling in practice. A name that survives a pg_dump, a cron job and a connection string without escaping is a name you will never think about again.

For what separates a good name from a bad one, read what makes a good database name, or browse database name examples to see these conventions applied.