3 Best Practice In PostgerSQL

3 Big Point
Each column has only one value
All non-key columns must be fully dependent on the primary key, not just partially
There should be no transitive dependencies, that is, non-key columns depending on other non-key columns.
Example
create table for save contact
Wrong way
The right way
Practice
Study Case
online shop, Create a table to record orders and goods
The Wrong Way
The Right way
Case Study
Table for mini library
Wrong Way
Right Way
Practice
Why you can't use "order" for a table name in PostgreSQL?
It's like having a special key for a specific door. In PostgreSQL, ORDER
is a reserved keyword. This means it has a special job—it's used to sort data (like in ORDER BY
).
Because it's a reserved word, the database won't let you use it for a table or column name, as it would cause confusion and errors.
To fix this, you just need to pick a different name that isn't already "taken," like orders
or purchase_orders
.
— GEMINI
END !!!!
SEE YOU NEXT TIME .
Subscribe to my newsletter
Read articles from MUHAMMAD directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
