title: How to create/add a column in an SQL select query based on another column's values?
body: <p>I want to dynamically add another column <code>hook_name</code>, via an SQL select query, based on a condition.</p>
  
  <p>For example if <code>hook_type = 0</code>, table <code>hook_name</code> should have a value of <code>OFFER</code>, and similarly for <code>hook_type = 1</code>, <code>hook_name</code> should show "ACCEPT".</p>
  
  <p>Below is a screenshot of the result:</p>
  
  <p><a href="https://i.stack.imgur.com/qfJsr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qfJsr.png" alt="enter image description here"></a></p>
  
  <p>The select query is this:</p>
  
  <pre><code>select hook_type, 'hook name' as hook_name,
         count(*) as number_of_exchange_activities 
  from `exchange` 
  group by hook_type # hook_type 0 for OFFER, 1 for ACCEPT and 2 for offer EXPIRED;
  </code></pre>
  
  <p>Thanks in advance.</p>