[表]。[field] vs table.field的区别?([table].[field] vs table.field difference?)

编程入门 行业动态 更新时间:2024-10-23 09:24:39
[表]。[field] vs table.field的区别?([table].[field] vs table.field difference?)

我不太明白它们之间的区别,例如:

SELECT [Products].[ID], [Products].[ProductName] FROM Products ORDER BY [ProductName];

和....相比

SELECT Products.ID, Products.ProductName FROM Products ORDER BY ProductName;

有人可以给我一些见解吗? 该查询为我生成相同的结果。

I don't quite understand the difference between, for example:

SELECT [Products].[ID], [Products].[ProductName] FROM Products ORDER BY [ProductName];

compared with

SELECT Products.ID, Products.ProductName FROM Products ORDER BY ProductName;

Can someone give me some insight please? The query produces same result for me.

最满意答案

在编程语言中,变量名称在其上下文中必须是唯一的,并且不能包含空格

VariableA is valid variable b is not valid variable_b is valid

有些语言甚至区分大小写。

variableA is valid VariableA is valid and different from variableA

另一方面,MS ACCESS允许表格,查询,表格等的免费格式化名称。这意味着你可以有一个名为的表

This is a fruit table

识别“这是一个水果表”作为一个单词/项目访问以某种方式需要评估/知道变量名称是一个单词或其变量名称而不是文本。 因此,Access使用[]来封装单词,以便它可以评估其内容。

如果您遵循最理想的编码风格,您可以使用tbl_fruits,frm_fruits,qry_view_fruits等前缀命名您的表格,这将有助于您和Access了解您所指的内容。

In a programming language a variable name must be unique throughout its context and cannot have Spaces.

VariableA is valid variable b is not valid variable_b is valid

Some languages are even case sensitive.

variableA is valid VariableA is valid and different from variableA

On the other hand MS ACCESS allows free formatted names for it tables, queries, forms etc. This means you could have a table called

This is a fruit table

to identify "this is a fruit table" as one word/item Access somehow needs to evaluate/know that the variable name is one word or its a variable name and not a text. Therefore Access uses [] to encapsulate the word so it can evaluate its content.

if you follow a most desired coding style you would name your tables with prefix such as tbl_fruits, frm_fruits, qry_view_fruits which will help you as well as Access to understand what you are referring to.

更多推荐

本文发布于:2023-04-29 09:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335906.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   field   table   difference

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!