title: using WHERE clause to check if record is receiving different values
body: <p>I wish to check if a bunch of values in a DB record with a given primary key are different from some user provided values.</p>
  
  <p>One approach is to retrieve the values from the DB and compare them to the user provided values using PHP.</p>
  
  <p>Another approach is to use DB directly to compare the values, and if a record is returned, you know there is an exact match:</p>
  
  <pre><code>SELECT COUNT(*)
  FROM t
  WHERE pk=123
  AND c1=321
  AND c2=222
  ...
  AND c8=555
  AND c9=434;
  </code></pre>
  
  <p>Is there any pros or cons from using one approach over the other?  Will the DB be smart enough to filter on the pk before the other values?</p>
  
  <p>PS.  Based on this query, if something is changed, I will then do an UPDATE of the new values plus update a date_changed column and a changed_by_user column.  Since I am also updating these last two columns, <code>PDOStatement::rowCount()</code> can't be used.  Am I missing something?</p>