On 9 Jun 2018, at 9:21pm, Andy Goth <andrew.m.g...@gmail.com> wrote:

> I suggest extending SQLite views and common table expressions to be the 
> vehicle for defining table-valued functions directly in SQL.

I'll raise your bid.  I want computed columns (SQL SERVER), otherwise known as 
generated columns (MySQL).

        CREATE TABLE tempLog (
                datestamp TEXT COLLATE NOCASE PRIMARY KEY,
                centTemp REAL,
                fahrTemp AS (centTemp*9/5 + 32) )

I'm happy with another syntax as long as it does the same thing.

Niggle 1: Can a computed column refer to a column defined after it ?

Niggle 2: Should a computed value be stored with the other values or calculated 
when required ?

With regard to Niggle 2, some SQL variants support both answers.  SQL SERVER 
allows you to use PERSISTED after the calculation to say that you want 
calculations performed and stored on INSERT and UPDATE.  Whoever picked the 
word PERSISTED should be shot.  We hates it.  MySQL uses either VIRTUAL or 
STORED, defaulting to VIRTUAL.  I prefer those words.

This should obsolete indexes on expressions, though it probably wouldn't in 
SQLite 3 for historical compatibility reasons.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to