Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 SQLite3。在我的模式中,是否可以要求给定字段仅包含预定集合中的值?
如果不是,我想要做的事情是用允许的值填充一个单独的表,然后在相关字段中使用该表中的一个 id。
您可以添加一个检查约束:
CREATE TABLE MyTable( MyField TEXT CHECK(MyField IN ('a', 'predetermined', 'set')) );