I first had the following table:
CREATE  TABLE simpleLog (
   datetime    TEXT NOT NULL PRIMARY KEY DEFAULT CURRENT_TIMESTAMP,
   description TEXT NOT NULL
)

?But datetime then takes 19 bytes. I understood you can also use an Integer
or Real and that this should be more efficient. At the moment I have the
following (I do not expect more as one record in a second):
CREATE  TABLE simpleLog (
   datetime    INT  NOT NULL PRIMARY KEY DEFAULT (strftime('%s')),
   description TEXT NOT NULL
)

And a select is then done by (in my select minute is precision enough):
SELECT   strftime('%Y-%m-%d %H:%M', datetime, 'unixepoch', 'localtime') as
datetime
,        description
FROM     simpleLog
ORDER BY datetime DESC

Is this a good way to go, or is there a better way?

-- 
Cecil Westerhof

Reply via email to