title: How can I group data by id and get the median value using SQL?
body: <p>I have a table with the time a given store opened during a couple of days, like you can see below (OPENING_HOUR is set as 24h time format, so all the hours on the table are AM).</p>
  <pre><code>&gt;&gt;&gt; BUSINESS_HOURS
      DATE       | STORE_ID | OPENING_HOUR
  ________________________________________
  0   2021-06-01 |   222    |  11
  1   2021-06-02 |   222    |  11
  2   2021-06-03 |   222    |  11
  3   2021-06-04 |   222    |  11
  4   2021-06-05 |   222    |  11
  5   2021-06-06 |   222    |  11
  6   2021-06-07 |   222    |  12
  7   2021-06-08 |   222    |  11
  8   2021-06-09 |   222    |  11
  9   2021-06-10 |   222    |  12
  </code></pre>
  <p>Now I need to group the data by id and tell which opening_hour was most frequent. In the case bellow, 11am was present in 80% of the cases, so I need something like this:</p>
  <pre><code>&gt;&gt;&gt; DATA_GROUPED
      STORE_ID   | OPENING_HOUR | FREQUENCY
  ________________________________________
  0   222        |   11         |  0.8
  
  </code></pre>
  <p>Is that possible using only SQL? Thank you for your help, guys!</p>