Subqueries must be in parentheses, up to 32 levels of subqueries can be nested, the database system executes from inner to outer, executing the inner subquery first then the outer main query, table subqueries must be aliased.
正确答案是:A: Subqueries must be enclosed in parentheses。
专业分析:
A: Subqueries must be enclosed in parentheses(子查询必须用括号括起来)——这是正确的语法规则。在SQL中,子查询必须被括号括起来,以便数据库管理系统能够正确识别和解析它们。
B: Execution is from outer to inner, executing the outer main query first, then the inner subquery(执行顺序是从外到内,先执行外部主查询,然后执行内部子查询)——这是错误的。实际上,子查询是先执行的,然后其结果会被用于外部查询。
C: Unlimited levels of nested subqueries can be used(可以使用无限级别的嵌套子查询)——虽然许多数据库管理系统支持多级嵌套子查询,但实际上有些系统可能对嵌套层级有一定限制,以避免性能问题和复杂性。
D: All subqueries must be aliased(所有子查询必须有别名)——这不是必须的。虽然在某些情况下为子查询取别名可以提高可读性或在特定情况下是必要的,但这并不是一条强制性的语法规则。
综上所述,正确答案是A。