我正在尝试确认或否认您是否可以将 MS Access 2003 中的表列定义为集合。看来此已在 Office 2007 中实现 - 您可以定义一个列以在查询/查找中具有“多选列表”,但此功能似乎是新的 access 2007 文件格式所独有的据我所知。
换句话来说,MS Access 2003 是否有与 SQL 语句等效的语句:
CREATE TABLE mytable (foo VARCHAR(10), bar VARCHAR(5) MULTISET);
或者是否有一个聪明的解决方法来实现类似的目标?我愿意接受提供有关 Access 2003 中任何集合构造函数的信息的答案。
最佳答案
您指的是 Access 数据库引擎的 multivalued data types ?如果是这样,那么是的,这些是 ACE (2007) 版本引擎的新功能,并且在作为 Access2003 版本引擎的 Jet 4.0 中不可用。
FWIW 我在 Access2007 中使用 ANSI-92 查询模式(OLE DB,引擎类型 = 5)尝试了您的 SQL,并且无法识别 MULTISET 关键字。
请注意,您可能不需要也不想要多值类型。一项特别的批评是 Access 数据库 SQL DML 表达式服务尚未进行更改以考虑多值类型。另请参阅这篇文章Multivalued datatypes considered harmful :
both Suraj [Poozhiyil, the MS Access Program Manager] and I agree wholeheartedly that developers do not need to use multi-valued fields. People who understand databases already have a good way of implementing many to many relationships and will gain no benefit from multi-valued fields.
So, my clear and certain advice to developers is not to use multi-valued fields. They have nothing to offer us except potential pain.
更新:
MULTISET is a new datatype officially beginning with SQL:2003 so I'm guessing part of the reason for adding it in Access 2007 is to be fully compliant with the SQL standard
这几乎很有趣。 Access 团队没有表现出添加符合任何 SQL 标准的 SQL 语法的兴趣。
[当 SQL Server 团队修改 Jet 的 4.0 版本时,他们希望获得 SQL-92 合规性,但 Windows 团队阻止了这样做,因为 Windows 团队的组件依赖于一些仍然不合规的功能...但那是另一个故事。 Access 团队拥有自己的代码库私有(private)人员,因此他们没有这样的借口...除非 SharePoint 团队现在拥有不当影响力?我离题了...]
请考虑有关 SQL2003 标准的文档中的这段引用:
Values of a
MULTISET
type can be created either by enumerating the individual elements or by supplying the elements through a query expression; e.g.,
MULTISET[1, 2, 3, 4]
or
MULTISET(
SELECT grades
FROM courses
)
...Conversely, a multiset value can be used as a table reference in the
FROM
clause using theUNNEST
operator.
Access 团队尚未向 ACE SQL DML 语法添加任何新表达式或任何运算符。所以,不,这与 SQL 标准无关,而与 SharePoint 有关。
David W. Fenton: No, [support for multivalued types] was added in the ACCDB format (not the ACE, as @onedaywhen says...)
考虑 the Access Team's own blog 中的这句话:
The primary feature we added to the new Access engine is support for “complex data”.
这绝对是引擎功能!
关于ms-access - Microsoft Access 2003 是否包含集或多集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1717081/