Skip to content

EMPTY()

Function Description

Determines whether the entered string is empty. If at least one byte is included, it is not empty, even if it is a space or NULL.

Function Syntax

> EMPTY(str)

Parameter definition

Parameters Description
str Required parameters, CHAR and VARCHAR types are available.

Return value

Empty string returns 1, non-empty string returns 0.

Example

> drop table if exists t1;
> create table t1(a varchar(255),b varchar(255));
> insert into t1 values('', 'abcd');
> insert into t1 values('1111', '');
> select empty(a),empty(b) from t1;
+-------------------------+
| empty(a) | empty(b) |
+-------------------------+
| 1 | 0 |
| 0 | 1 |
+-------------------------+