DEV Community

Cover image for TLDR: Database Naming
An Pham
An Pham

Posted on

3 1

TLDR: Database Naming

Credit: Photo by Tobias Fischer on Unsplash

  • Table names should be plural (ex: users, customers,...)
  • Use underscore_names (ex: user_id, user_role,...)
  • Don't name primary key column id
  • Don't make column names unclear (ex: u_role,...)
  • Name foreign key columns the same as the columns they refer to

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs