Синтаксис выражения случая SQL?

Учитывая, что вы отметили sql несколько продуктов, я бы sqlselect сказал, что полным правильным синтаксисом sql-statement будет тот, который можно sql-query найти в стандарте ISO / ANSI sql-query SQL-92:

 ::=
       
     | 

 ::=
       NULLIF   
               
     | COALESCE  
                {   }... 

 ::=
       
     | 

 ::=
     CASE 
          ...
        [  ]
     END

 ::=
     CASE
       ...
     [  ]
     END

 ::= WHEN  THEN 

 ::= WHEN  THEN 

 ::= ELSE 

 ::= 

 ::= 

 ::=  | NULL

 ::= 

Правила синтаксиса

1) NULLIF (V1, V2) is equivalent to the following :

     CASE WHEN V1=V2 THEN NULL ELSE V1 END

2) COALESCE (V1, V2) is equivalent to the following :

     CASE WHEN V1 IS NOT NULL THEN V1 ELSE V2 END

3) COALESCE (V1, V2, . . . ,n ), for n >= 3, is equivalent to the
   following :

     CASE WHEN V1 IS NOT NULL THEN V1 ELSE COALESCE (V2, . . . ,n )
     END

4) If a  specifies a , then let CO
   be the :

   a) The data type of each  WO shall be comparable
      with the data type of the .

   b) The  is equivalent to a 
      in which each  specifies a  of the form "CO=WO".

5) At least one  in a  shall specify a
   .

6) If an  is not specified, then ELSE NULL is im-
   plicit.

7) The data type of a  is determined by ap-
   plying Subclause 9.3, "Set operation result data types", to the
   data types of all s in the .

Access Rules

   None.

General Rules

1) Case:

   a) If a  specifies NULL, then its value is the null
      value.

   b) If a  specifies a , then its value
      is the value of that .

2) Case:

   a) If the  of some  in
      a  is true, then the value of the  is the value of the  of the first
      (leftmost)  whose  is
      true, cast as the data type of the .

   b) If no  in a  is true,
      then the value of the  is the value of the
       of the explicit or implicit , cast as
      the data type of the .

sql

2022-10-25T04:06:16+00:00