REVERSE()

Description

Returns the string str with the order of the characters reversed.

Syntax

  1. > REVERSE(str)

Arguments

ArgumentsDescription
StrRequired. both CHAR and VARCHAR are supported.

Examples

  1. > drop table if exists t1;
  2. > create table t1(a varchar(12),c char(30));
  3. > insert into t1 values('sdfad ','2022-02-02 22:22:22');
  4. > insert into t1 values(' sdfad ','2022-02-02 22:22:22');
  5. > insert into t1 values('adsf sdfad','2022-02-02 22:22:22');
  6. > insert into t1 values(' sdfad','2022-02-02 22:22:22');
  7. > select reverse(a),reverse(c) from t1;
  8. +-------------+---------------------+
  9. | reverse(a) | reverse(c) |
  10. +-------------+---------------------+
  11. | dafds | 22:22:22 20-20-2202 |
  12. | dafds | 22:22:22 20-20-2202 |
  13. | dafds fsda | 22:22:22 20-20-2202 |
  14. | dafds | 22:22:22 20-20-2202 |
  15. +-------------+---------------------+
  16. > select a from t1 where reverse(a) like 'daf%';
  17. +-------------+
  18. | a |
  19. +-------------+
  20. | adsf sdfad |
  21. | sdfad |
  22. +-------------+
  23. > select reverse(a) reversea,reverse(reverse(a)) normala from t1;
  24. +-------------+-------------+
  25. | reversea | normala |
  26. +-------------+-------------+
  27. | dafds | sdfad |
  28. | dafds | sdfad |
  29. | dafds fsda | adsf sdfad |
  30. | dafds | sdfad |
  31. +-------------+-------------+

Constraints

Currently, MatrixOne doesn’t support select function() without from tables.