SQL ARRAY: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:


=Overview=
=Overview=
=Declaration=
SQL declaration for unidimensional arrays:
<syntaxhighlight lang='sql'>
CREATE TABLE some_table (
  some_column text ARRAY
  ...
)
</syntaxhighlight>
<code>ARRAY</code> can be declared for any data types.
=Insert=
<syntaxhighlight lang='sql'>
INSERT INTO some_table (some_column, ...) VALUES (ARRAY['string1', 'string2', ...], ...)
</syntaxhighlight>
=Implementation-Specific Details=
{| class="wikitable" style="text-align: left;"
|-
| [[PostgreSQL_Concepts#Arrays|PostgreSQL]] || MySQL
|-
|}

Revision as of 22:55, 24 May 2024

Internal

Overview

Declaration

SQL declaration for unidimensional arrays:

CREATE TABLE some_table (
  some_column text ARRAY
  ...
)

ARRAY can be declared for any data types.

Insert

INSERT INTO some_table (some_column, ...) VALUES (ARRAY['string1', 'string2', ...], ...)

Implementation-Specific Details

PostgreSQL MySQL