メインコンテンツまでスキップ
バージョン: 3.2

nullif

説明​

expr1 が expr2 と等しい場合、NULL を返します。それ以外の場合は、expr1 を返します。

構文​

nullif(expr1,expr2);

パラメータ​

expr1 と expr2 はデータ型が互換性がある必要があります。

戻り値​

戻り値は expr1 と同じ型です。

例​

mysql> select nullif(1,2);
+--------------+
| nullif(1, 2) |
+--------------+
| 1 |
+--------------+

mysql> select nullif(1,1);
+--------------+
| nullif(1, 1) |
+--------------+
| NULL |
+--------------+
Rocky the happy otterStarRocks Assistant

AI generated answers are based on docs and other sources. Please test answers in non-production environments.