Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2002
    Location
    iceland
    Posts
    15

    ascending descending for date types

    what does it mean to sort date values from earliest to latest?
    asc or desc ?

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Are you actually asking what it means? Or what the keywords are?

    Anyway, an example should clarify:
    Code:
    SQL> select * from dept
      2  order by deptno asc;
    
        DEPTNO DNAME          LOC
    ---------- -------------- -------------
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    
    SQL> select * from dept
      2  order by deptno desc;
    
        DEPTNO DNAME          LOC
    ---------- -------------- -------------
            40 OPERATIONS     BOSTON
            30 SALES          CHICAGO
            20 RESEARCH       DALLAS
            10 ACCOUNTING     NEW YORK
    If you don't specify asc or desc, then ascending order is the default.

  3. #3
    Join Date
    May 2004
    Location
    Elmira, NY USA
    Posts
    5
    Earliest to latest date is ascending. You've probably found that out, already, right?

  4. #4
    Join Date
    Feb 2002
    Location
    iceland
    Posts
    15
    i already of course know what asc and desc does. my question is actually about the wording:

    SYSDATE > SYSDATE-1 .ya.
    i just wondered the earliest to latest, according to which date ?
    according to say now, SYSDATE, earliest is SYSDATE-1 and latest is say 2 years ago.

    But this may be also interpreted the reverse, not?
    earliest being 2 years ago, and latest today, or today-1.
    that was my point!


    latest is "far away from today"
    or "as near to today as possible"
    Last edited by commageneus; 07-13-04 at 12:18.

  5. #5
    Join Date
    Apr 2004
    Posts
    246
    earliest date is the earliest in relation to the birth of the cosmos.
    Oldest date would be the one furthest back in time from today.
    So, unless your users have invented a time-machine, and can travel backwards through the space-time continuum, I think everybody will agree that sysdate-200 is earlier than sysdate-2.

  6. #6
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    ...as in:

    "Earlier today I had breakfast; later on I had lunch".
    "Early in the last century there was no TV"
    "The latest news is..."

  7. #7
    Join Date
    May 2013
    Posts
    1
    Quote Originally Posted by commageneus View Post
    what does it mean to sort date values from earliest to latest?
    asc or desc ?
    Earliest to latest: Time is described numerically, where latest means "most recent."
    So, if we go from YEAR 0 to YEAR 2013, we go from earliest to latest.
    The year numbers increase, so earliest to latest is ASCENDING.

  8. #8
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,431
    And of course 4000BC is earlier then 100AD
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  9. #9
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,628
    badgerbay,

    I am sure that there are thousands upon thousands of threads on this forum that are more recent than this NINE YEAR old thread.

    I applaud your desire to contribute, but suggest you focus on only recently opened threads.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    There are no stupid questions, but there are a LOT of Inquisitive Idiots.

  10. #10
    Join Date
    Apr 2014
    Posts
    1
    Just to re-necro... Belated thanks to badgerbay, this was the info I wanted.

Posting Permissions

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