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.
我想知道是否需要 [ ] ?使用它们有什么好处?
标准 SQL 查询中从不需要方括号,因为它们不是标准的一部分。
一些数据库(尤其是 SQL Server 和相关方言)使用方括号作为标识符的转义字符。仅包含字母、数字和下划线(大部分)且不是保留字的标识符不需要转义。我强烈建议您的所有标识符都遵循这些规则。
在您的示例查询中,标识符都很好。他们不需要逃脱。方括号只是视觉上的混乱。