All Forums Database
dylanzwick 5 posts Joined 11/14
20 May 2015
What's going on with the median function in Teradata?

If I type median in a Teradata query, the word becomes blue, but it does not become bold and blue.
So, I suspect what's going on is that median is not, in fact, a function in Teradata, but the word is reserved and cannot, for example, be assigned to a user written function. Is this correct?
Second, if median is not a function, what's up wih this page? - http://www.info.teradata.com/HTMLPubs/DB_TTU_15_00/ index.html#page/SQL_Reference/B035_1145_015K/ Ordered_Analytical_Functions.081.134.html
Thanks!
-Dylan

"Don't Panic" - Douglas Adams
Fred 1096 posts Joined 08/04
20 May 2015

MEDIAN function was introduced in TD15.0 but it was a reserved word long before that. Highlighting also depends on the version of the client tool in use (SQL Assistant or Studio).

dnoeth 4628 posts Joined 11/04
20 May 2015

@Fred:
MEDIAN is available in TD14.10 already :-)
@Dylan:
The easiest way to find out if it's a reserved keyword is to see if it fails as a column name:

select 1 as median;

median
------
     1

Or use the built-in view:

SELECT *
FROM SYSLIB.SQLRestrictedWords
WHERE restricted_word = 'MEDIAN';

restricted_word                 category  ANSI_restricted
------------------------------  --------  ---------------
MEDIAN                          N         T

So MEDIAN is a keyword, but not restricted. IMHO blue, but not bold, is correct :-)

Dieter

dylanzwick 5 posts Joined 11/14
21 May 2015

Thanks Fred and Dieter!
Dieter - What determines whether a word is blue vs. bold and blue?

"Don't Panic" - Douglas Adams

dnoeth 4628 posts Joined 11/04
21 May 2015

There's a language file which determines the parsing & highlighting rules:
C:\Program Files (x86)\Teradata\Client\15.00\Teradata SQL Assistant\teradata.lng

Dieter

You must sign in to leave a comment.