SQLite: Default a datetime field to the current time (now)

SQLite FAQ: How do I default a SQLite datetime field to the current date and time? (i.e., how do I default it to now?)

Just use the SQLite current_timestamp function, like this:

last_updated datetime default current_timestamp

In a more complete create table example I just used on an Android project, this looks like this:

create table projects (
    _id integer primary key autoincrement,
    name text not null,
    description text,
    date_created datetime default current_timestamp,
    last_updated datetime default current_timestamp
);

Also, as you can see from this example, you can use the current_timestamp function more than once in a single SQLite "create table" statement. (This doesn't seem like a big deal, but you can't do the same thing in MySQL.)