TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Best practices for creating dynamic SQL Tables?

3 点作者 pandatigox超过 3 年前
Anki allows creation of custom flashcard types[0] and I was wondering how that was done programmatically. I know about CREATE TABLE in SQL, but is it unsafe to define a table on the fly? I tried checking Anki&#x27;s source code[1], but there doesn&#x27;t seem to be any mention of how this is achieved.<p>Thanks in advance<p>[0]: https:&#x2F;&#x2F;docs.ankiweb.net&#x2F;editing.html#adding-a-note-type [1]: https:&#x2F;&#x2F;github.com&#x2F;ankitects&#x2F;anki&#x2F;tree&#x2F;ca0374782e709b6877162328945b55181cdb2445&#x2F;rslib&#x2F;src&#x2F;storage&#x2F;notetype

2 条评论

dyeje超过 3 年前
Dynamic tables like you&#x27;re describing are covered in the Metadata Tribbles chapter of the book SQL Antipatterns.<p><a href="https:&#x2F;&#x2F;pragprog.com&#x2F;titles&#x2F;bksqla&#x2F;sql-antipatterns&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pragprog.com&#x2F;titles&#x2F;bksqla&#x2F;sql-antipatterns&#x2F;</a>
评论 #28476585 未加载
allwein超过 3 年前
It&#x27;s not done using dynamic SQL tables.<p>The key insight is to note that FIELDS table actually defines the name, ordering, and config for each of the fields of a given note type, and that the actual notes data is stored in the Notes table in the DATA column, most likely as JSON.
评论 #28473520 未加载
评论 #28476591 未加载