Dev Helpers
← Back

Create a generated column

Create a generated column using SQLite.

Open this example in the interactive library

Source code

CREATE TABLE line(qty INTEGER,price INTEGER,total INTEGER GENERATED ALWAYS AS(qty*price));
INSERT INTO line(qty,price) VALUES(2,7);
SELECT total FROM line;

Sample output

[
  {
    "total": 14
  }
]