A generated column iku kolom kanthi nilai sing dihitung kanthi otomatis saka kolom liyane, tinimbang dilebokake langsung. PostgreSQL ndhukung stored generated columns (Postgres 12+) — nilai sing dihitung dikompilasi nalika nulis lan disimpen. Dheweke njaga data turunan tetep konsisten kanthi otomatis.
Nggawe generated column
products (
id SERIAL ,
price ,
quantity ,
total GENERATED ALWAYS (price quantity) STORED
);
products (price, quantity) (, );
total products;
