Archives of the TeradataForum
Message Posted: Sun, 07 Aug 2005 @ 10:15:58 GMT
Subj: | | Re: Regarding usage Of MAX function |
|
From: | | Victor Sokovin |
| I saw that MAX function can be used with the VARCHAR too.. | |
| Can any one put light on it.... | |
| LIKE an example i saw was MAX(UPPER(TRIM(VARCHAR VALUE))).... | |
As long as the values are *ordered* we can consider taking the maximum. In IT, sets of values are always finite, so sooner or later we will
find the maximum value.
With numbers we never even ask ourselves how we order them. The order seems to come naturally from our math classes: 1<2, 2<3, etc.
Although this is not the only order mathematics can come up with, it seems that in SQL we cannot go wrong with our "natural" feeling about
ordering numbers.
The situation is *absolutely* different when we start ordering alphanumeric values. They can be ordered in many different ways and SQL has to
be aware of the specific ordering used. The way values are ordered is called collation. Collation is simply a concrete set of rules describing
the order of pairs of values in the specified set. So far, so good. The trouble is, however, that there are way too many different and conflicting
collation rules on the market.
Teradata is of course well aware of collations. It does not cover them all (and who does?) but what it does cover is well described. The best
source of information on collation in TD I am aware of is the manual entitled "International Character Set Support".
It is even useful when you work with other vendor's products. For example, I have recently mailed it to a friend who had encountered problems
with the roll-out of some Swedish software in Holland. They have found the hard way that the default Swedish collation rules would cause a lot of
problems when the software is integrated into the rest of the environment. He confirmed that the manual was useful by itself (Sweden and Norway
are listed as exceptional cases in the manual) even if they were not interested in TD as such. So, I don't hesitate to recommend it as an
introductory reading on the subject.
Regards,
Victor
|