title: How to (quickly) ascertain the subtype in a "Class Table Inheritance" relational database model?
body: <p>Lets say I use class table inheritance in the following way:</p>
  
  <pre><code>CREATE TABLE person
  (
     id INT(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
     forename VARCHAR(30) NOT NULL,
     surname VARCHAR(30) NOT NULL
  );
  
  CREATE TABLE employee
  (
     id INT(10) NOT NULL,
     salary INT(10),
     FOREIGN KEY (id) REFERENCES person (id)
  );
  
  CREATE TABLE volunteer
  (
     id INT(10) NOT NULL,
     FOREIGN KEY (id) REFERENCES person (id)
  );
  </code></pre>
  
  <p>Ok, now say I want to check permissions on my site, i.e. I need to check if a person is an employee or a volunteer. I could put a foreign key in 'person' to a 'type' table but surely this introduces a problem because a subtype of an employee could change to a volunteer and this 'type' in the superclass would also need to be updated.</p>
  
  <p>Without this I would have to search for the existance of the id in either table to find its subtype which would be very inefficient. I need a way where I can use a single field to figure out the subtype. Can anyone help?</p>