Naming & Conventions

Naming Guidelines

  • Be consistent: pick singular or plural table names (Customer or Customers) and stick to it.
  • Use one case style: PascalCase or snake_case. Avoid spaces and reserved words (Order, User, Date).
  • Name keys predictably: CustomerID as PK, the same name for the FK in other tables.
  • Name constraints and indexes: PK_Orders, FK_Orders_Customers, IX_Orders_OrderDate.
  • Booleans read as questions: IsActive, HasShipped.

Common Columns

CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UpdatedAt TIMESTAMP NULL,
CreatedBy INT NULL REFERENCES Users(UserID),
IsDeleted BOOLEAN NOT NULL DEFAULT FALSE      -- "soft delete"

Tip: Store times in UTC and convert to local time in the application.