title: How query works with missing Group by values
body: <p>I am tryng to write a query to pull the total discount as well as revenue of my customer's orders by day. Note that for each ship_id there will be several items so I want to have the sum clauses as below and in the end, I have that group by and I want to group them by ship_id (this is unique for each order). </p>
  
  <p>I got a result of 2M rows (this could be correct because we are a big) but I am not sure if my group by is correct. What if I only put ship_id there? How my query understands it?</p>
  
  <pre><code>            d.ship_id 
              ,to_char(d.order_datetime,'yyyy/mm/dd hh24:mi:ss') as datetime_order
              ,to_char(d.order_datetime, 'D') as day_order
              ,to_char(d.order_datetime, 'MM') as month_order
              ,sum(di.discount) as discount 
              ,sum(di.price * di.units) AS price 
  
          FROM 
              table1 d 
              JOIN 
              table2 di
              ON 
                  d.ship_id = di.ship_id
         GROUP BY
              d.ship_id
              ,to_char(d.order_datetime,'yyyy/mm/dd hh24:mi:ss') 
              ,to_char(d.order_datetime, 'D') 
              ,to_char(d.order_datetime, 'MM') 
  </code></pre>