Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top