title: Automatically Delete Row if Certain Columns Empty?
body: <p>I have a database that contains participant contact information for studies: homePhone, altPhone, and email.</p>
  
  <p>We check participants in and out of the database by keeping a log table. Everytime participants are checked back in in bulk, I run it through a Java application that I wrote, which can also update/remove contact information if necessary.</p>
  
  <p>When a participant has 0 out of the 3 pieces of contact information, it is useless to keep them in the database. Rather than implementing a check in my Java program, is there any way to have the database (running on MySQL) to do this automatically? I tried to create a trigger that checks the 3 columns on UPDATE, but I read online that you cannot alter the table the trigger is associated to?</p>
  
  <p>I know that I could just run :</p>
  
  <pre><code>DELETE FROM participants WHERE homePhone=0 AND altPhone=0 AND email=''
  </code></pre>
  
  <p>But I want the database to do this automatically. I'm not too much of a database guru, so if anyone has any insight that would be great. Worst case would be implementing the above line of SQL at the end of my Java program.</p>