title: GROUP BY without aggregate function
body: <p>I am trying to understand GROUP BY <em>(new to oracle dbms)</em> without aggregate function.<br />
  How does it operate?<br />
  Here is what i have tried.</p>
  <p>EMP table on which i will run my SQL.<br />
  <img src="https://i.stack.imgur.com/37oYU.jpg" alt="EMP TABLE" /></p>
  <pre><code>SELECT ename , sal
  FROM emp
  GROUP BY ename , sal
  </code></pre>
  <p><img src="https://i.stack.imgur.com/3n3JM.jpg" alt="Result" /></p>
  <pre><code>SELECT ename , sal  
  FROM emp  
  GROUP BY ename;  
  </code></pre>
  <blockquote>
  <h2>Result</h2>
  <p>ORA-00979: not a GROUP BY expression<br />
  00979. 00000 -  &quot;not a GROUP BY expression&quot;<br />
  *Cause:<br />
  *Action:<br />
  Error at Line: 397 Column: 16</p>
  </blockquote>
  <pre><code>SELECT ename , sal  
  FROM emp  
  GROUP BY sal;  
  </code></pre>
  <blockquote>
  <h2>Result</h2>
  <p>ORA-00979: not a GROUP BY expression<br />
  00979. 00000 -  &quot;not a GROUP BY expression&quot;<br />
  *Cause:<br />
  *Action: Error at Line: 411 Column: 8</p>
  </blockquote>
  <pre><code>SELECT empno , ename , sal  
  FROM emp  
  GROUP BY sal , ename;  
  </code></pre>
  <blockquote>
  <h2>Result</h2>
  <p>ORA-00979: not a GROUP BY expression<br />
  00979. 00000 -  &quot;not a GROUP BY expression&quot;<br />
  *Cause:<br />
  *Action: Error at Line: 425 Column: 8</p>
  </blockquote>
  <pre><code>SELECT empno , ename , sal  
  FROM emp  
  GROUP BY empno , ename , sal;  
  </code></pre>
  <p><img src="https://i.stack.imgur.com/pP6BB.jpg" alt="Result" /></p>
  <p>So, basically the number of columns have to be equal to the number of columns in the GROUP BY clause, but i still do not understand why or what is going on.</p>