What happens if MySQL query returns no rows?


From the output returned by MySQL, it is very much clear that how many rows are there in the result set along with the execution time.

Example

For example, in the following MySQL output we can see there are 3 rows in the result set.

mysql> Select * from ratelist ORDER BY Price LIMIT 3;
+----+------+-------+
| Sr | Item | Price |
+----+------+-------+
|  5 | T    |   250 |
|  1 | A    |   502 |
|  2 | B    |   630 |
+----+------+-------+
3 rows in set (0.00 sec)

But suppose if MySQL query has no rows to be returned in the result set then it will return Empty Set along with the execution time. In other words, we can say that MySQL returns no data and no error. Consider the following example in which write a MySQL query whose output is an empty set.

mysql> Select * from ratelist where price > 2000;
Empty set (0.08 sec)

We can see the empty set and execution time as output.

Updated on: 13-Feb-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements