HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What are these single letter SQL keywords?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thesewhataresqlsinglekeywordsletter

Problem

I am looking at list of SQL keywords here https://www.postgresql.org/docs/current/sql-keywords-appendix.html

There are some single letter keywords there. I cannot find any information about them.
Where can I find the information and what are these for?

Examples,
A, C, F, G, K, M, P, T.

Solution

Checking my copy (of a draft) of the SQL standard (version 2011), I see that K, M, G, T, P are mentioned in section 5.2 and :

 ::=
  ... 

 ::=
    K
  | M 
  | G
  | T
  | P


and they obviously mean Kilo, Mega, Giga, Tera, Peta. They are explained in section 6.1 , Syntax Rules 9:

9) The numeric value of a  LOL is determined as follows.  
Case:  
    a)  If LOL immediately contains  and does not immediately 
    contain , then the numeric value of  is the
    numeric value of the specified .  
    b)  If LOL immediately contains  or immediately 
    contains  and , then let D be the value of
    the specified  or the numeric value of the sequence of 
    s of  interpreted as an . 
    The numeric value of LOL is the numeric value resulting from the 
    multiplication of D and MS, where MS is:  
        i) If  is K, then 1,024.  
        ii) If  is M, then 1,048,576.  
        iii) If  is G, then 1,073,741,824.  
        iv) If  is T, then 1,099,511,627,776.  
        v) If  is P, then 1,125,899,906,842,624.


C and M are mentioned in 10.2 :

 ::=
  LANGUAGE 

 ::=
    ADA
  | C
  | COBOL
  | FORTRAN
  | M | MUMPS
  | PASCAL
  | PLI
  | SQL


I haven't found A. It might have been in older versions of the SQL standard and then removed or might have been added in later versions.

Code Snippets

<large object length token> ::=
  <digit>... <multiplier>

<multiplier> ::=
    K
  | M 
  | G
  | T
  | P
9) The numeric value of a <large object length> LOL is determined as follows.  
Case:  
    a)  If LOL immediately contains <unsigned integer> and does not immediately 
    contain <multiplier>, then the numeric value of <large object length> is the
    numeric value of the specified <unsigned integer>.  
    b)  If LOL immediately contains <large object length token> or immediately 
    contains <unsigned integer> and <multiplier>, then let D be the value of
    the specified <unsigned integer> or the numeric value of the sequence of 
    <digit>s of <large object length token> interpreted as an <unsigned integer>. 
    The numeric value of LOL is the numeric value resulting from the 
    multiplication of D and MS, where MS is:  
        i) If <multiplier> is K, then 1,024.  
        ii) If <multiplier> is M, then 1,048,576.  
        iii) If <multiplier> is G, then 1,073,741,824.  
        iv) If <multiplier> is T, then 1,099,511,627,776.  
        v) If <multiplier> is P, then 1,125,899,906,842,624.
<language clause> ::=
  LANGUAGE <language name>

<language name> ::=
    ADA
  | C
  | COBOL
  | FORTRAN
  | M | MUMPS
  | PASCAL
  | PLI
  | SQL

Context

StackExchange Database Administrators Q#323043, answer score: 6

Revisions (0)

No revisions yet.