Search code examples
sqlitedatecreation

SQLite table creation date


Is there a way to query the creation date of a table in SQLite? I am new to SQL, overall. I just found this SQL Server table creation date query. I am assuming that sqlite_master is the equivalent to sys.tables in SQLite. Is that correct? But then my sqlite_master table only has the columns "type", "name", "tbl_name", "rootpage" and "sql". If this is not possible in SQLite, what would be the best way to implement this functionality by myself?


Solution

  • SQLite does not store this data itself. Like you said, the sqlite_master table doesn't have any relevant column.

    There's no particularly nice way that I can come up with to implement it. You could create some sort of interface for creating tables, and have it note the time whenever you create a new one, but anything created through a different method won't go through the same process. It also looks like there's no way to set a trigger on CREATE TABLE, so that's not an option either.

    Why do you want this functionality? Creating tables seems like something you wouldn't be doing very often, maybe there's a better way to approach the problem?