I'm new to databases, and is exploring SQL vs noSQL.
我是数据库的新手,正在探索SQL与noSQL。
What kind of data is highly relational and benefits from SQL and what kind of data does not?
哪种类型的数据具有高度的关系性,并且受益于SQL以及哪种数据没有?
Please provide some examples.
请提供一些例子。
2 个解决方案
#1
2
Relational data fits into the definition of a relation:
关系数据适合关系的定义:
- A header defines a finite set of columns.
- Each column has a name and a data type.
- Data types are a named, finite set of distinct values.
- Each column in a given row of the relation contains one value of the appropriate data type for the respective column.
- Rows have no implicit order.
- Columns have no implicit order.
- Duplicate rows are not allowed.
标头定义了一组有限的列。
每列都有名称和数据类型。
数据类型是一组命名的,有限的不同值。
关系的给定行中的每列包含相应列的适当数据类型的一个值。
行没有隐含的顺序。
列没有隐式顺序。
不允许重复的行。
These conditions are prerequisites for all the Normal Forms of relations. That is, a table doesn't qualify even for First Normal Form unless it's a relation. Many operations in SQL don't work right if the table isn't relational.
这些条件是所有正常形式关系的先决条件。也就是说,除非是关系,否则表格甚至不符合第一范式。如果表不是关系表,SQL中的许多操作都无法正常工作。
To be more practical, a relational table must have the same properties on every row, by the same names, and must have a primary key defined over one or more columns so you can reference each row individually.
更实际的是,关系表必须在每一行上具有相同的属性,具有相同的名称,并且必须在一列或多列上定义主键,以便您可以单独引用每一行。
NoSQL is actually a marketing term used to brand and promote some data management products. It's not a computer science term.
NoSQL实际上是用于标记和推广某些数据管理产品的营销术语。这不是计算机科学术语。
But if you mean non-relational, then you can see that a non-relational data store is allowed to break some of the rules above:
但如果你的意思是非关系型,那么你可以看到一个非关系数据存储被允许打破上面的一些规则:
- Two entries (rows) in a given collection can be duplicates.
- The fields can vary per entry. Different number, different names, different data types.
- A given field can contain the same value in two entries, yet the value is considered different for some reason (for example, depending on the value in another field).
- Order of entries is significant (for example, the entries are assumed to be in chronological order).
- Order of fields is significant (for example, the first field is assumed to be a key of some kind).
给定集合中的两个条目(行)可以是重复的。
每个条目的字段可能不同。不同的数字,不同的名称,不同的数据类型。
给定字段可以在两个条目中包含相同的值,但由于某种原因(例如,取决于另一个字段中的值),该值被视为不同。
条目顺序很重要(例如,假设条目按时间顺序排列)。
字段顺序很重要(例如,假设第一个字段是某种键)。
But by breaking these rules, you lose the foundation on which relational operations work.
但是,通过违反这些规则,您将失去关系运作的基础。
#2
2
Your question seems to be burdened with a few misconceptions. Relational as in Relational Database refers to a type of data model - the system of representation used for data. Any information that consists of facts (propositions) can be represented relationally if your DBMS supports that type of information. There is no intrinsic quality of any information that makes it more or less suitable for an RDBMS.
你的问题似乎有一些误解。关系数据库中的关系是指一种数据模型 - 用于数据的表示系统。如果您的DBMS支持该类型的信息,那么由事实(命题)组成的任何信息都可以通过关系表示。任何信息的内在质量都不会使其或多或少地适合RDBMS。
SQL is a (strictly non-relational) database language.
SQL是一种(严格非关系型)数据库语言。
NOSQL is a loose term that can be applied to any database system that doesn't use SQL or that extends the capabilities of SQL. NOSQL and relational are not mutually exclusive concepts. NOSQL does not have to mean "non-relational", it just means "not SQL".
NOSQL是一个松散的术语,可以应用于任何不使用SQL或扩展SQL功能的数据库系统。 NOSQL和关系不是相互排斥的概念。 NOSQL不一定意味着“非关系”,它只是意味着“不是SQL”。
#1
2
Relational data fits into the definition of a relation:
关系数据适合关系的定义:
- A header defines a finite set of columns.
- Each column has a name and a data type.
- Data types are a named, finite set of distinct values.
- Each column in a given row of the relation contains one value of the appropriate data type for the respective column.
- Rows have no implicit order.
- Columns have no implicit order.
- Duplicate rows are not allowed.
标头定义了一组有限的列。
每列都有名称和数据类型。
数据类型是一组命名的,有限的不同值。
关系的给定行中的每列包含相应列的适当数据类型的一个值。
行没有隐含的顺序。
列没有隐式顺序。
不允许重复的行。
These conditions are prerequisites for all the Normal Forms of relations. That is, a table doesn't qualify even for First Normal Form unless it's a relation. Many operations in SQL don't work right if the table isn't relational.
这些条件是所有正常形式关系的先决条件。也就是说,除非是关系,否则表格甚至不符合第一范式。如果表不是关系表,SQL中的许多操作都无法正常工作。
To be more practical, a relational table must have the same properties on every row, by the same names, and must have a primary key defined over one or more columns so you can reference each row individually.
更实际的是,关系表必须在每一行上具有相同的属性,具有相同的名称,并且必须在一列或多列上定义主键,以便您可以单独引用每一行。
NoSQL is actually a marketing term used to brand and promote some data management products. It's not a computer science term.
NoSQL实际上是用于标记和推广某些数据管理产品的营销术语。这不是计算机科学术语。
But if you mean non-relational, then you can see that a non-relational data store is allowed to break some of the rules above:
但如果你的意思是非关系型,那么你可以看到一个非关系数据存储被允许打破上面的一些规则:
- Two entries (rows) in a given collection can be duplicates.
- The fields can vary per entry. Different number, different names, different data types.
- A given field can contain the same value in two entries, yet the value is considered different for some reason (for example, depending on the value in another field).
- Order of entries is significant (for example, the entries are assumed to be in chronological order).
- Order of fields is significant (for example, the first field is assumed to be a key of some kind).
给定集合中的两个条目(行)可以是重复的。
每个条目的字段可能不同。不同的数字,不同的名称,不同的数据类型。
给定字段可以在两个条目中包含相同的值,但由于某种原因(例如,取决于另一个字段中的值),该值被视为不同。
条目顺序很重要(例如,假设条目按时间顺序排列)。
字段顺序很重要(例如,假设第一个字段是某种键)。
But by breaking these rules, you lose the foundation on which relational operations work.
但是,通过违反这些规则,您将失去关系运作的基础。
#2
2
Your question seems to be burdened with a few misconceptions. Relational as in Relational Database refers to a type of data model - the system of representation used for data. Any information that consists of facts (propositions) can be represented relationally if your DBMS supports that type of information. There is no intrinsic quality of any information that makes it more or less suitable for an RDBMS.
你的问题似乎有一些误解。关系数据库中的关系是指一种数据模型 - 用于数据的表示系统。如果您的DBMS支持该类型的信息,那么由事实(命题)组成的任何信息都可以通过关系表示。任何信息的内在质量都不会使其或多或少地适合RDBMS。
SQL is a (strictly non-relational) database language.
SQL是一种(严格非关系型)数据库语言。
NOSQL is a loose term that can be applied to any database system that doesn't use SQL or that extends the capabilities of SQL. NOSQL and relational are not mutually exclusive concepts. NOSQL does not have to mean "non-relational", it just means "not SQL".
NOSQL是一个松散的术语,可以应用于任何不使用SQL或扩展SQL功能的数据库系统。 NOSQL和关系不是相互排斥的概念。 NOSQL不一定意味着“非关系”,它只是意味着“不是SQL”。