'Writing code for derived values with datetime in SQLite

I have a question regarding how you can derive a new value from two other values that are written in datetime format/type in SQLite. In my case, I have constructed a small database, where one of my tables, 'Appointment', includes two attributes named 'Appointment_start' and 'Appointment_finish. Given the two attributes, I would like to be able to execute a derived value, so that a new attribute named 'Appointment_duration' automatically will be created in which the duration of a every instance of 'Appointment' is given.

So far I've tried with the following code:

ALTER TABLE Appointment ADD Appointment_Duration datetime GENERATED ALWAYS AS (Appointment_Start+Appointment_Finish)

However, this won't execute in SQLite. Anyone who has an idea of how I can fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source