Skip to content

Commit

Permalink
Add doctest sample.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
  • Loading branch information
Yury-Fridlyand committed Jan 13, 2023
1 parent 2705283 commit e86e703
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/user/dql/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,30 @@ Here is an example for different type of comparison operators::
It is possible to compare datetimes. When comparing different datetime types, for example `DATE` and `TIME`, both converted to `DATETIME`.
The following rule is applied on coversion: a `TIME` applied to today's date; `DATE` is interpreted at midnight.

os> SELECT current_time() > current_date() AS `now.time > today`, typeof(current_time()) AS `now.time.type`, typeof(current_date()) AS `now.date.type`;
fetched rows / total rows = 1/1
+--------------------+-----------------+-----------------+
| now.time > today | now.time.type | now.date.type |
+--------------------+-----------------+-----------------+
| True | TIME | DATE |
+--------------------+-----------------+-----------------+

os> SELECT current_time() = now() AS `now.time = now`, typeof(current_time()) AS `now.time.type`, typeof(now()) AS `now.type`;
fetched rows / total rows = 1/1
+------------------+-----------------+------------+
| now.time = now | now.time.type | now.type |
+------------------+-----------------+------------+
| True | TIME | DATETIME |
+------------------+-----------------+------------+

os> SELECT subtime(now(), current_time()) = current_date() AS `midnight = now.date`, typeof(subtime(now(), current_time())) AS `midnight.type`, typeof(current_date()) AS `now.date.type`;
fetched rows / total rows = 1/1
+--------------------+-----------------+-----------------+
| midnight = today | midnight.type | now.date.type |
+--------------------+-----------------+-----------------+
| True | DATETIME | DATE |
+--------------------+-----------------+-----------------+


LIKE
----
Expand Down

0 comments on commit e86e703

Please sign in to comment.