SQL 数据库 -(行或记录、列或字段)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9140626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Database - (rows or records, columns or fields)?
提问by toop
In database terminology:
在数据库术语中:
What is the difference between a row and a record?
行和记录有什么区别?
Likewise, aren't columns and fields the same thing?
同样,列和字段不是一回事吗?
On the blog Joe Celko The SQL Apprentice , I noticed that the banner mentions that they are different things.
在博客Joe Celko The SQL Apprentice 上,我注意到横幅提到它们是不同的东西。
回答by vc 74
Row and record can arguably be considered as the same thing.
Row 和 record 可以说是一回事。
Fields and columns are different, a field is the intersection of a row and a column.
i.e. if your table has 10 rows and 10 columns, it has 100 fields.
字段和列不同,字段是行和列的交集。
即,如果您的表有 10 行和 10 列,则它有 100 个字段。
When you create a table using DDL statements, you define columns (metadata). When you add rows using DML statements, you define rows and their fields.
回答by Andrea Colleoni
In a broader sense, rows and columns refers to a matrix structure. When a database, not limited to a relational database, has a matrix structured data, it can be borrowed this terminology, but there might be a more specifical one.
从广义上讲,行和列是指矩阵结构。当一个数据库(不限于关系型数据库)有矩阵结构的数据时,可以借用这个术语,但可能有更具体的一个。
In relational databases, for example, a table is always a matrix, so at each column in a table corresponds a field in a record and at each row corresponds a record: different concepts pointing to the same object.
例如,在关系数据库中,表总是一个矩阵,所以表中的每一列对应一个记录中的一个字段,每行对应一个记录:指向同一个对象的不同概念。
A field can be present even in NoSQLdatabases, where often there's a free schema (no columns) and each row can have a different number of fields.
即使在NoSQL数据库中也可以存在字段,其中通常有一个免费模式(没有列)并且每行可以有不同数量的字段。
Similarly, a record can be a complex value in non-relational databases: it can contain fields with multiple distinct values (not 1NF). A row (a tuple in relational algebra) otherwise contains a single value for each field.
类似地,记录可以是非关系数据库中的复杂值:它可以包含具有多个不同值(不是1NF)的字段。一行(关系代数中的元组)否则包含每个字段的单个值。
回答by J. Manchester
As stated in a previous answer to this question, row and record can arguably be used interchangeably.
正如之前对该问题的回答所述,行和记录可以互换使用。
Column and field can also arguably be used interchangeably. See the following article:Column (database)Here's a quote (as of this writing), from the article mentioned above, which makes that point:
列和字段也可以互换使用。请参阅以下文章:列(数据库)这是上述文章中的引用(在撰写本文时),它说明了这一点:
"The term field is often used interchangeably with column, although many consider it more correct to use field (or field value) to refer specifically to the single item that exists at the intersection between one row and one column."
“术语字段通常与列互换使用,尽管许多人认为使用字段(或字段值)来专门指代存在于一行和一列之间的交叉处的单个项目更为正确。”
Here's some additional background info which may be helpful:
以下是一些可能有用的额外背景信息:
During my IT career as an analyst and programmer, I've typically used the terms field and record, not column and row, in both programming and relational database contexts. I think that comes from the instruction that I received during my university studies, and the fact that I learned the basic data hierarchy of bit, byte, field, record, file, before learning about relational databases. In researching this question, I found that it is common practice, and arguably correct, to use row and record interchangeably and to use column and field interchangeably. I was actually quite surprised, though, when my research indicated that row and column are preferred terms over record and field, in database terminology.
在我作为分析师和程序员的 IT 职业生涯中,我通常在编程和关系数据库上下文中使用术语字段和记录,而不是列和行。我认为这来自我在大学学习期间收到的指导,以及在学习关系数据库之前学习了位,字节,字段,记录,文件的基本数据层次结构的事实。在研究这个问题时,我发现交替使用行和记录以及交替使用列和字段是常见的做法,而且可以说是正确的。然而,当我的研究表明在数据库术语中行和列比记录和字段更受欢迎时,我实际上感到非常惊讶。
回答by snassr
The terms Record and Field, predate relational databases, a time when computerized file systems ruled persistence storage, mainframes ruled the computing market and DBAs/Data Analysts were called DPs (Data Processing specialists).
术语记录和字段早于关系数据库、计算机文件系统统治持久性存储、大型机统治计算市场和 DBA/数据分析师被称为 DP(数据处理专家)的时代。
A file with data organized in a 2-d matrix form, where a piece of information is called a field (column) and a collection of related fields a record (row). This data file is similar to a table (without standardized relationships governing the contents), therefore, the terms used during the file processing times were inherited. Technically, a row <> record and column <> field.
数据以二维矩阵形式组织的文件,其中一条信息称为字段(列),相关字段的集合称为记录(行)。该数据文件类似于表格(没有管理内容的标准化关系),因此,文件处理期间使用的术语被继承。从技术上讲,行 <> 记录和列 <> 字段。
--For more information: Database Systems: Design, Implementation & Management - Coroner (Chapter 1, Section 5)
--有关更多信息:数据库系统:设计、实施和管理 - 验尸官(第 1 章第 5 节)
回答by Mark
Records and fields make up a database table. Rows and Columns are found in spreadsheets.
记录和字段组成了一个数据库表。行和列可在电子表格中找到。