SQLite 表创建日期

发布于 2024-09-02 21:35:39 字数 323 浏览 2 评论 0原文

有没有办法在 SQLite 中查询表的创建日期? 总的来说,我对 SQL 很陌生。我刚刚发现这个 SQL Server 表创建日期查询。 我假设 sqlite_master 相当于 SQLite 中的 sys.tables。这是正确的吗? 但我的 sqlite_master 表只有“type”、“name”、“tbl_name”、“rootpage”和“sql”列。 如果这在 SQLite 中不可能,那么我自己实现此功能的最佳方法是什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝天白云 2024-09-09 21:35:39

SQLite 本身不存储这些数据。正如您所说,sqlite_master 表没有任何相关列。

我无法想出特别好的方法来实现它。您可以创建某种用于创建表的界面,并让它在创建新表时记录时间,但通过不同方法创建的任何内容都不会经历相同的过程。看起来也没有办法在 CREATE TABLE 上设置触发器,所以这也不是一个选项。

为什么需要这个功能?创建表似乎是您不会经常做的事情,也许有更好的方法来解决这个问题?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文