tags:

views:

28

answers:

1
SQL> select * from employee;

ID   FIRST_NAME LAST_NAME  START_DAT END_DATE      SALARY CITY       DESCRIPTION
---- ---------- ---------- --------- --------- ---------- ---------- ---------------
03   Jason      Martin     25-JUL-96 25-JUL-06    1234.56 Toronto    Programmer
03   Alison     Mathews    21-MAR-76 21-FEB-86   13323.56 Vancouver  Tester
04   James      Smith      12-DEC-78 15-MAR-90   52358.24 Vancouver  Tester
05   Celia      Rice       24-OCT-82 21-APR-99    2344.78 Vancouver  Manager
03   Linda      Green      30-JUL-87 04-JAN-96    4322.78 New York   Tester
03   David      Larry      31-DEC-90 12-FEB-98    7897.78 New York   Manager

6 rows selected.

SQL> select id,first_name
  2  from employee
  3  group by id, first_name;

ID   FIRST_NAME
---- ----------
03   Linda
03   Jason
04   James
05   Celia
03   David
03   Alison

I want to know the flow of records ... In what manner these records are displayed ... Please tell me how groups are created here ...

+1  A: 

I'm not sure I understand the question correctly, but I'll attempt an answer.

You second query is this:

select id,first_name
from employee
group by id,first_name;

This means, find all employees and group them together based on the id and the first_name. Then return these results in any order whatsoever.

The order that the results come out depends internally how Oracle decided to execute the query (hash group by or sort group by) and perhaps where the data was physically stored on disk. It could change from day to day, Oracle version to Oracle version etc.

If you want them to come out in a particular order, you must use ORDER BY

WW
Thank you very much WW i thought oracle will be fallowing a particular approach in deciding which record should come first and which to come later on any way once again thank you very much for your reply..
musicking123