← All notes

SQLite generated columns compute a value from other columns in the row

Answer: A generated column, sometimes also called a computed column, stores or exposes a value that is a function of other columns in the same row. You can read generated columns, but their values can not be directly written. To change a generated column's value, modify the other columns used to calculate the generated column.

Syntax

Syntactically, generated columns are designated using a GENERATED ALWAYS column-constraint. The example has three ordinary columns and two generated columns.

Adding a generated column

Verify that constraints are still satisfied. This requires a scan of the entire table if: the new column has a CHECK constraint, or the new column is a NOT NULL generated column, or the table is STRICT and the new generated column has a type other than ANY.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: SQLite, Generated Columns; SQLite, alter.c generated column checks. Public-Domain; Public-Domain. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: SQLite, Generated Columns; SQLite, alter.c generated column checks. Public-Domain; Public-Domain.

Cite this

Permanent ID: iil:note:4appbf1p

iinventedlight. 2026. "SQLite generated columns compute a value from other columns in the row." iinventedlight Library, iil:note:4appbf1p, version of 2026-11-20. https://iinventedlight.com/library/notes/sqlite-generated-columns/. License: CC-BY-4.0.

@misc{iil_note_4appbf1p,
  author = {{iinventedlight}},
  title = {{SQLite generated columns compute a value from other columns in the row}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-20},
  url = {https://iinventedlight.com/library/notes/sqlite-generated-columns/},
  note = {Permanent ID iil:note:4appbf1p. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/sqlite-generated-columns.md.