Coding standards - PostgreSQL
PostgreSQL is a powerful, open source object-relational database system.
Naming conventions
Write keywords such as SELECT
, WHERE
, AND
, OR
etc. as all uppercase letters. Following PostgreSQL's website e.g.https://www.postgresql.org/docs/15/tutorial-populate.html.
Foreign-key relationships
It's best to avoid using foreign-key relationships in our database schemas where possible. This is to maintain flexibility and scalability in our systems. Foreign-key constraints can introduce tight coupling between tables, which complicates schema changes and migrations as our applications evolve.
Numeric (13,2)
Use numeric(13,2)
for currency values. This ensures consistent formatting and prevents issues with floating-point precision. Where more precision is needed, use numeric(15,4)
.