Select an Empty Result Set in MySQL



Select an empty result set with the help of dummy table ‘dual’ from MySQL. The query is as follows −

mysql> select 1 from dual where false;
Empty set (0.00 sec)

In the above query, “dual” is a dummy table and the above condition false. Therefore, it returns empty set.

Let us check with true condition. It will return the selected value. The query is as follows −

mysql> select 1 from dual where true;

The following is the output −

+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
Updated on: 2019-07-30T22:30:24+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements