ERD Naming Conventions for Tables and Columns

Best practices for naming tables and columns in ER diagrams. Covers snake_case, plural table names, foreign key naming patterns, and avoiding reserved words.

ERD Basics

Detailed Explanation

Why Naming Conventions Matter

Consistent naming conventions make your database schema readable, maintainable, and less error-prone. When multiple developers work on the same database, agreed-upon conventions prevent confusion and reduce bugs.

Table Naming Rules

Rule Good Bad
Use plural nouns users, orders user, order
Use snake_case order_items OrderItems, orderitems
Be descriptive user_preferences prefs, up
Avoid reserved words user_orders order (SQL reserved)

Column Naming Rules

  1. Use snake_case: first_name, created_at, is_active
  2. Primary keys: Name them id (simple) or {table_singular}_id (explicit)
  3. Foreign keys: Use {referenced_table_singular}_id — e.g., user_id references users.id
  4. Boolean columns: Prefix with is_, has_, or can_ — e.g., is_active, has_verified_email
  5. Timestamps: Use created_at, updated_at, deleted_at

Junction Table Naming

For many-to-many relationships, the junction table should combine both table names in alphabetical order:

  • users + rolesroles_users (alphabetical) or user_roles (contextual)
  • courses + studentscourse_enrollments (semantic name preferred)

Avoid These Pitfalls

  • Abbreviations: usr, addr, qty — spell them out unless universally understood
  • Prefixes: tbl_users, t_orders — the table type is already clear from context
  • Mixed conventions: Mixing camelCase and snake_case in the same schema
  • Generic names: data, info, details — these convey no meaning

Applying in the ERD Editor

When you create entities in the ERD editor, name the table in the properties panel. The tool passes table and column names directly into the generated SQL, so following conventions here means your exported CREATE TABLE statements are production-ready from the start.

Use Case

You are establishing coding standards for a new team or onboarding new developers. Having clear naming conventions documented and applied from the ERD design phase ensures consistency from the initial schema design through application code and ORM models.

Try It — ERD Editor

Open full tool