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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top