Results 1 to 4 of 4

Thread: what is SQL sorting based on?

  1. #1
    Join Date
    Feb 2005
    Posts
    3

    what is SQL sorting based on?

    Hello, I'm a software tester and wish to know the exact rules apply to sql sorting.

    If you do something like
    SELECT * FROM tablename ORDER BY column ASC

    suppose the column is a text field - varchar (50), how does it sort?

    For example
    I have the following data:
    New Comment Category
    New Comment Category1
    New Comment Category3
    JKLM
    ABCabc1234567890
    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx
    DevelopmentOfIdeas
    Overall
    Reasoning
    ~!@#$%^&*()_+{}|:"<>?`-=[]\;',./
    <CommentCategory>


    WHEN SORTED, they look like this:
    JKLM
    <CommentCategory>
    ABCabc1234567890
    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx
    DevelopmentOfIdeas
    New Comment Category
    New Comment Category1
    New Comment Category3
    Overall
    Reasoning
    ~!@#$%^&*()_+{}|:"<>?`-=[]\;',./


    I know the sorting by default is case-insensitive. but what about the rules on the special characters? i don't understand why some special character gets placed in front of others? it's definitely not how the ascii table is sorted.

    Could someone give me an explanation or point me to the right direction?

    thanks!

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

  3. #3
    Join Date
    Feb 2005
    Posts
    3
    what about J?
    ascii 74.. placed in front of < ??

  4. #4
    Join Date
    Feb 2005
    Posts
    3
    never mind
    there is a space in front of 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
  •