SQLite Forum

Are result values always the same?
> UPDATE pltable SET checkbox = (pl_id=?);

I think you mean

    UPDATE pltable SET checkbox = 1 WHERE pl_id = ?;

> Are the result values for this operation always 0 or 1?

I'm not quite sure what you mean by "result."

If you're asking what an `UPDATE` query returns, it is a SQLite result code, which is either `SQLITE_OK` or some error code.

If you're asking what value gets put into `checkbox`, then it's the integer 1 with the query above.

> is it implementation dependent?

SQLite doesn't have a distinct Boolean data type, so if you put 99 into the column, SQLite will store that, and truth tests on that value will then [proceed as documented][2].

> should I define an index for this kind of query?

Assuming `pl_id` is the first column of the table and it's an integer, it becomes the [autoincrement ID column][1], so it *might* auto-index itself, but for a case like this, I see no harm in creating the index explicitly:

    CREATE UNIQUE INDEX idx_pl_id on pltable(pl_id);

[1]: https://sqlite.org/autoinc.html
[2]: https://www.sqlite.org/datatype3.html#type_conversions_prior_to_comparison