title: SQL provide data with predefined rules
body: <p>I am looking for an elegant way, to provide data, with rules regard to contents.</p>
  
  <p>Let´s assume the following:
  I want to calculate the discount for customers. I have Customer-Categories, "HappyHours" and the discount.</p>
  
  <p>I have 9 different categories, and for each category there are 3 different Happy-Hour-Times. The discount depends on a combination of category and time. The values won´t change frequently, so I am looking for a "constant" way to solve this issue.</p>
  
  <p>Example:</p>
  
  <ol>
  <li>categoryPremium &amp;&amp; timeOne equals 20% discount</li>
  <li>categoryPremium &amp;&amp; timeTwo equals 22% discount</li>
  <li>categoryPremium &amp;&amp; timeThree equals 30% discount</li>
  <li>categoryRegular &amp;&amp; timeOne equals 10% discount</li>
  <li>categoryRegular &amp;&amp; timeTwo equals 15% discount</li>
  </ol>
  
  <p>and so on...</p>
  
  <p>This is for an application, and the discount is required at each execution. So it would be really nice to find a way, which is clean and fast.</p>
  
  <p>I thought of two possibilities: </p>
  
  <ol>
  <li>A table, with composite primary key (category and happyHour) filled once manually</li>
  <li>A hard coded assignment-function (similar to <a href="https://stackoverflow.com/questions/28380180/the-number-of-matches-between-two-rows-mysql/28430898#28430898">the number of matches between two rows mysql</a>)</li>
  </ol>
  
  <p>What do you think? Is there a way which is more dynamic?</p>