title: Structure to store logical expressions into RDBMS
body: <p>Consider the following variables are generated by the <strong>player</strong> analyzer service:</p>
  
  <pre><code>    level = 6;
      errors = 4;
      score = 12;
      ...
  </code></pre>
  
  <p>And we have some rules and messages:</p>
  
  <pre><code> 1. errors == 0 AND level &gt; 5 : Senior player
   2. score == 10 OR errors == 3: Border line player
   3. score &gt; 10 AND score &lt; 13: Not good, just passed
   4. ...
  </code></pre>
  
  <h2>Now we should print proper messages.</h2>
  
  <p>Another example: Consider the following variables are generated by the <strong>food</strong> analyzer service:</p>
  
  <pre><code>    fruit = 2;
      coca = 6;
      ...
  </code></pre>
  
  <p>And we have some rules and messages:</p>
  
  <pre><code> 1. fruit == 0 : Consider buying some fruits
   2. coca == 0: That's healthy
   3. ...
  </code></pre>
  
  <h2>Now we should print proper messages.</h2>
  
  <p>How should I save rules and messages in a RDBMS like MySQL so it becomes easy to query and find the messages. </p>
  
  <p>The worst method is to save rules in one column and messages in another column and loading every record to test in host programming language.</p>
  
  <p><a href="https://i.stack.imgur.com/mKt1I.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mKt1I.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/aUDkn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aUDkn.jpg" alt="enter image description here"></a></p>
  
  <p>Can you suggest a better method for this situation? This isn't a good method when we have a few thousand messages, we need  a method to filter messages on DB side.</p>