I want a column in sql to be the sum of 2 columns in the same table. For example: columns : score, assists, rebound While creating this table ı want score = assist + rebound value.
CREATE TABLE macDetay (
macID INT , oyuncuID INT ,
CONSTRAINT PKDETAY PRIMARY KEY (macID, oyuncuID),
CONSTRAINT FK1 FOREIGN KEY(macID) REFERENCES Mac(macID),
CONSTRAINT FK2 FOREIGN KEY(oyuncuID) REFERENCES Oyuncu(oyuncuID),
macSkor INT, asistSayisi INT,reboundSayisi INT,
CONSTRAINT skor CHECK (macSkor = asistSayisi+ReboundSayisi))
I'm forcing to enter the sum in my way but I want it to be automatic