title: MySQL: Computed Column
body: <p>I'm just started using SQL and ran into a problem.</p>
  
  <p>In my database, I presently have two tables, Cinemas and Theatres. 
  I'm trying to create a column "# of Theatres# in the Cinemas table that counts the number of Theatres in the Theatres table with the same CinemaID (foreign key) as a Cinema in the Cinemas table. I got it to work as an SQL query:</p>
  
  <pre><code>SELECT cinemas.CinemaID,Town,COUNT(*) AS '# of Theatres'
  FROM cinemax.cinemas,cinemax.theatres
  WHERE cinemas.CinemaID=theatres.CinemaID
  GROUP BY cinemas.CinemaID;
  </code></pre>
  
  <p>But wanted to know if it's possible to create a column in the Cinemas table, that automatically performs the above query and inserts the value into each row.</p>
  
  <p>It is going to be a very small database so speed isn't really an issue, I just want to learn how to make such a computed column (if even possible).</p>