title: SQL, Checking if all record's value greater than 5 in a table
body: <p>I am using PHP and I need a sql query which will check whether all records value greater then 5.. Won't return any data from database. Just will return true if all records are greater then 5.</p>
  
  <p>If the answer is true I will update another table..</p>
  
  <p>Pseudo Code is</p>
  
  <pre><code>if(the value column in table1 is greater then 5 for all records)
  then
      $update = mysql_query("UPDATE table2 SET q_value = '0' ")
  else
  do nothing
  
  
  Table Example:
  ------------------------
  
  | question |  value   |
  |    X1    |     6    |
  |    X2    |     6    |
  |    X3    |     6    | //value column for all records are greater then 5 
  |    X4    |     7    | //must return true
  |    X5    |     8    | //and will update table2
  |    X6    |     6    |
  
  | question |  value   |
  |    X1    |     6    |
  |    X2    |     3    |
  |    X3    |     0    | //value column for all records not greater then 5 
  |    X4    |     7    | //there are 0 and 3 values and must return false
  |    X5    |     8    | //won't update table2 
  |    X6    |     6    |
  </code></pre>
  
  <p>Could you please give me an idea for this. How can I check something for all records. Won't return any data. Just will return true if all values greater then something...</p>
  
  <p>Thank you in advance</p>