I have this table
CREATE TABLE game (
idp serial NOT NULL,
start_pl integer NOT NULL,
finis_pl integer NOT NULL,
points integer NOT NULL
);
When I insert or update column finis_pl
, I want to autocomplete column points. For example when insert number 1
in finis_pl
column I want to autoinsert value 15
in points
column.
I made a function using CASE (because I have only 16 possible values for inserting in points) but I can't make it work with a trigger.
Any idea how to make it work?