Question

Can someone explain to me how arrays work in SQLite?

I've tried: CREATE TABLE foo (bar ARRAY);

Works without errors but: INSERT INTO foo VALUES ([1,2]); doesn't.

Note: The array can have any number of elements, element number is not limited.

Était-ce utile?

La solution

SQLite3 does not support arrays directly. Here are all types which are supported in SQLLite -> http://www.sqlite.org/datatype3.html.

To accomplish what you need, you have to use a custom encoding (JSON for example), or use an FK, i.e. create another table, where each item in the array is stored as a row.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top