Results 1 to 5 of 5

Thread: Difference

  1. #1
    Join Date
    Mar 2005
    Posts
    1

    Unanswered: Difference

    Hi

    Can any body differenciate between order by and group by with an examples

    Thanks and Regards
    Reddy

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Imagine one hundred students - some of them are male, and some female. Then you ask them to separate - boys to go left, and girls to go right. Now you have two groups of them, grouped by sex. Next, kindly request to form a line: tallest one first, then a little bit smaller, etc. etc., and the smallest should be at the end of the line. When they finish that, you have them ordered by height.

    Oracle deals with such things in a way you can read about here. Search for "group_by_clause" and "order_by_clause".
    Last edited by Littlefoot; 03-08-05 at 02:28.

  3. #3
    Join Date
    Jun 2004
    Posts
    796
    Provided Answers: 1
    Littlefoot, that is the clearest simplest analogy I have seen to explain the difference between the two! Hope you don't mind if I 'borrow' your analogy in the future when I'm trying to explain this to someone
    90% of users' problems can be resolved by punching them - the other 10% by switching off their PCs.

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Be my guest

  5. #5
    Join Date
    May 2004
    Location
    BA [ARG]
    Posts
    137
    Hahahaha... Littlefoot rules!!!
    Excelent example!!!

    How would you explain a "HAVING" clause in that example?

    Like we say in Argentina "quiero re-truco!" (It's a card game, like poker, and when we raise the bet we say that).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •