BNF Grammar of EJB QL 
Here is the entire BNF diagram for EJB QL: EJB QL ::= select_clause from_clause [where_clause] 
[orderby_clause]from_clause ::=FROM identification_variable_declaration
    [, identification_variable_declaration]*identification_variable_declaration ::= 
collection_member_declaration |
    range_variable_declarationcollection_member_declaration ::= IN ( 
collection_valued_path_expression) [AS ] identifierrange_variable_declaration ::= 
    abstract_schema_name [AS ] identifiercmp_path_expression ::=
    {identification_variable |
     single_valued_cmr_path_expression}.cmp_fieldsingle_valued_cmr_path_expression ::=
    identification_variable.[single_valued_cmr_field.]*
     single_valued_cmr_fieldsingle_valued_path_expression ::=
    cmp_path_expression | single_valued_cmr_path_expressioncollection_valued_path_expression ::=
    identification_variable.[single_valued_cmr_field.]
    *collection_valued_cmr_fieldselect_clause ::= SELECT [DISTINCT ] {select_expression 
    |OBJECT( identification_variable) }select_expression ::= single_valued_path_expression | 
aggregate_select_expressionaggregate_select_expression ::=
    {AVG |MAX |MIN |SUM |COUNT }( [DISTINCT ]
     cmp_path_expression) |
    COUNT ( [DISTINCT ] identification_variable |
     single_valued_cmr_path_expression)where_clause ::= WHERE conditional_expressionconditional_expression ::= conditional_term |
    conditional_expression OR conditional_termconditional_term ::= conditional_factor | 
    conditional_term AND conditional_factorconditional_factor ::= [NOT ] conditional_primaryconditional_primary ::= simple_cond_expression |
     (conditional_expression)simple_cond_expression ::=
    comparison_expression | between_expression | 
    like_expression | in_expression |
    null_comparison_expression |
    empty_collection_comparison_expression |
    collection_member_expressionbetween_expression ::=
    arithmetic_expression [NOT ]BETWEEN
    arithmetic_expression AND arithmetic_expressionin_expression ::=
    cmp_path_expression [NOT ] IN
    ( {literal | input_parameter} 
    [, { literal | input_parameter} ]*)like_expression ::=
    cmp_path_expression [NOT ] LIKE 
    pattern_value [ESCAPE escape_character]
    
null_comparison_expression ::=
    {single_valued_path_expression | 
    input_parameter}IS [NOT ] NULLempty_collection_comparison_expression ::=
    collection_valued_path_expression IS [NOT] EMPTYcollection_member_expression ::=
    {single_valued_cmr_path_expression |
     identification_variable | input_parameter}
    [NOT ] MEMBER [OF ] collection_valued_path_expressioncomparison_expression ::=
    string_value comparison_operator string_expression |
    boolean_value {= |<> } boolean_expression} |
    datetime_value comparison_operator datetime_expression |
    entity_bean_value {= |<> } entity_bean_expression |
    arithmetic_value comparison_operator arithmetic_expressionarithmetic_value ::= cmp_path_expression |
     functions_returning_numericscomparison_operator ::= 
    = |> |>= |< |<= |<>arithmetic_expression ::= arithmetic_term |
    arithmetic_expression {+ |- } arithmetic_termarithmetic_term ::= arithmetic_factor |
     arithmetic_term {* |/ } arithmetic_factorarithmetic_factor ::= [{+ |- }] arithmetic_primaryarithmetic_primary ::= cmp_path_expression | literal |
    (arithmetic_expression) | input_parameter |
    functions_returning_numericsstring_value ::= cmp_path_expression |
     functions_returning_stringsstring_expression ::= string_primary | input_parameterstring_primary ::= cmp_path_expression | literal |
    (string_expression) | functions_returning_stringsdatetime_value ::= cmp_path_expressiondatetime_expression ::= datetime_value | input_parameterboolean_value ::= cmp_path_expressionboolean_expression ::= cmp_path_expression | literal |
    input_parameterentity_bean_value ::= single_valued_cmr_path_expression |
    identification_variableentity_bean_expression ::= entity_bean_value | input_parameterfunctions_returning_strings ::=
    CONCAT( string_expression, string_expression) |
    SUBSTRING( string_expression, arithmetic_expression,
    arithmetic_expression)
functions_returning_numerics ::=
    LENGTH( string_expression) |
    LOCATE( string_expression, string_expression
    [, arithmetic_expression]) |
    ABS( arithmetic_expression) |
    SQRT( arithmetic_expression) |
    MOD( arithmetic_expression, arithmetic_expression)orderby_clause ::= ORDER BY orderby_item [, orderby_item]*orderby_item ::= cmp_path_expression [ASC |DESC ]