title: How to create a derived attribute in DDL
body: <pre><code>CREATE TABLE Matches
  (
  mID INTEGER PRIMARY KEY,
  date DATE NOT NULL,
  location CHAR(25) NOT NULL,
  teamA CHAR(15) NOT NULL,
  goalsForA INTEGER,
  pointsA INTEGER,
  teamB, CHAR(15) NOT NULL,
  goalsForB INTEGER,
  pointsB INTEGER,
  /*
  M1: The match number must be under 65
  */
  CONSTRAINT M1 CHECK (mID &lt; 65),
  /*
  M2: location must refer to stadiumName in the Locations. 
  */
  CONSTRAINT M2 FOREIGN KEY (location) REFERENCES Stadiums (stadiumName)
  ON DELETE CASCADE,
  /*
  M3: 
  */
  CONSTRAINT M3 ()
  )
  </code></pre>
  
  <p>okay so I need to make it so pointsA and pointsB is calculated by goalsForA and goalsForB. If goalsForA = goalsForB then pointsA and pointsB get 1 each. If goalsForA > goalsForB, then pointsA gets 3 added and vice versa for B. My professor never taught us about how to do this, and I can't find it anywhere.</p>