2011/6/25 Max Vlasov <max.vla...@gmail.com>

> Use ORDER BY ... DESC. Sure, if you have a large dataset, it'd better be
> indexed.
>

At the moment it is not a large dataset, but it is better to be prepared. I
have the following definition:
    CREATE TABLE IF NOT EXISTS weights (
      id                     INTEGER        PRIMARY KEY,
      categoryID             INTEGER        NOT NULL,
      measureDate            DATE           DEFAULT (DATE('now')),
      weight                 FLOAT          NOT NULL,
      fat                    FLOAT,
      water                  FLOAT,
      muscle                 FLOAT,

      UNIQUE (
        categoryID,
        measureDate
      )
    );

The select is on the categoryID and measureDate. The UNIQUE constraint is
good enough, or is there needed more?

-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to