array()

array()

description

Syntax

ARRAY<T> array(T, ...)

construct an array with variadic elements and return it, T could be column or literal

example

  1. mysql> select array("1", 2, 1.1);
  2. +----------------------+
  3. | array('1', 2, '1.1') |
  4. +----------------------+
  5. | ['1', '2', '1.1'] |
  6. +----------------------+
  7. 1 row in set (0.00 sec)
  8. mysql> select array(null, 1);
  9. +----------------+
  10. | array(NULL, 1) |
  11. +----------------+
  12. | [NULL, 1] |
  13. +----------------+
  14. 1 row in set (0.00 sec)
  15. mysql> select array(1, 2, 3);
  16. +----------------+
  17. | array(1, 2, 3) |
  18. +----------------+
  19. | [1, 2, 3] |
  20. +----------------+
  21. 1 row in set (0.00 sec)
  22. mysql> select array(qid, creationDate, null) from nested limit 4;
  23. +------------------------------------+
  24. | array(`qid`, `creationDate`, NULL) |
  25. +------------------------------------+
  26. | [1000038, 20090616074056, NULL] |
  27. | [1000069, 20090616075005, NULL] |
  28. | [1000130, 20090616080918, NULL] |
  29. | [1000145, 20090616081545, NULL] |
  30. +------------------------------------+
  31. 4 rows in set (0.01 sec)

keywords

ARRAY,ARRAY,CONSTRUCTOR