Definition
The next language element that needs to be addressed are the lowest term representations. These are terms that cannot be broken down further. Again, these are taken directly from the SAP documentation:
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<letter> ::= a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
<any_character> ::= !!any character.
<comma> ::= ,
<dollar_sign> ::= $
<double_quotes> ::= "
<greater_than_sign> ::= >
<hash_symbol> ::= #
<left_bracket> ::= [
<left_curly_bracket> ::= {
<lower_than_sign> ::= <
<period> ::= .
<pipe_sign> ::= |
<right_bracket> ::= ]
<right_curly_bracket> ::= }
<sign> ::= + | -
<single_quote> ::= '
<underscore> ::= _
<apostrophe> ::= <single_quote>
<approximate_numeric_literal> ::= <mantissa>E<exponent>
<cesu8_restricted_characters> ::= <double_quote> | <dollar_sign> | <single_quote> | <sign> | <period> | <greater_than_sign> | <lower_than_sign> | <pipe_sign> | <left_bracket> | <right_bracket> | <left_curly_bracket> | <right_curly_bracket> | ( | ) | ! | % | * | , | / | : | ; | = | ? | @ | \ | ^ | `
<exact_numeric_literal> ::= <unsigned_integer>[<period>[<unsigned_integer>]]
| <period><unsigned_integer>
<exponent> ::= <signed_integer>
<hostname> ::= {<letter> | <digit>}[{ <letter> | <digit> | <period> | - }...]
<identifier> ::= <simple_identifier> | <special_identifier>
<mantissa> ::= <exact_numeric_literal>
<numeric_literal> ::= <signed_numeric_literal> | <signed_integer>
<password> ::= {
<letter> [ { <letter_or_digit> | # | $ }[…] ]
| <digit> [ <letter_or_digit> […] ]
| <special_identifier> }
<port_number> ::= <unsigned_integer>
<schema_name> ::= <unicode_name>
<simple_identifier> ::= {<letter> | <underscore>} [{<letter> | <digit> | <underscore>
| <hash_symbol> | <dollar_sign>}...]
<special_identifier> ::= <double_quotes><any_character>...<double_quotes>
<signed_integer> ::= [<sign>] <unsigned_integer>
<signed_numeric_literal> ::= [<sign>] <unsigned_numeric_literal>
<string_literal> ::= <single_quote>[<any_character>...]<single_quote>
<unicode_name> ::= !! CESU-8 string excluding any characters listed in <cesu8_restricted_characters>
<unsigned_integer> ::= <digit>...
<unsigned_numeric_literal> ::= <exact_numeric_literal> | <approximate_numeric_literal>
<user_name> ::= <unicode_name>
An example of interpreting this notation can be seen from the following example:
SELECT [TOP <unsigned_integer>]
The term <unsigned_integer> , can be broken down as follows. From the term list
<unsigned_integer> ::= <digit>...
<unsigned_integer> consists of a <digit>, but the inclusion of ellipses (...) means that <digit> can be repeated any number of times.
Thus all the following statements will be legal:
SELECT TOP 1
SELECT TOP 100
SELECT TOP 4556752456565
To go a step further, the SELECT statement specifies:
SELECT [TOP <unsigned_integer>] [ ALL | DISTINCT ] <select_list>
Two statements are enclosed in square brackets. These are alternatives. Within the second square brackets, the keywords are separated by the alternative operator |. This means that we can select one or the other, but not both. From these rules, the following are then legal syntax:
SELECT *
SELECT TOP 100 *
SELECT ALL *
SELECT DISTINCT *
SELECT TOP 100 ALL *
SELECT TOP 100 DISTINCT *
But the following would be illegal statements:
select top *
select all distinct *
No comments:
Post a Comment