关系数据库系统将是自切片面包以来最好的东西……
... 那就是当我们(希望)得到它们的时候。SQL数据库太糟糕了,一点都不好笑。
我觉得有趣的是,认证dba认为SQL数据库系统是关系数据库系统。这说明了上述认证的质量。
困惑吗?读c·j·戴特的书。
edit
为什么叫关系?这个词是什么意思?
如今,拥有强大(哎呀,任何)数学背景的程序员(或认证DBA, wink)是例外,而不是常见情况(我也是常见情况的一个实例)。SQL的表、列和行,以及被称为实体/关系建模的笑话,只是在伤害上加了侮辱。难怪有一种误解,认为关系数据库系统之所以这样叫,是因为实体(表)之间的某些关系(外键?)是如此普遍。
事实上,关系源于关系的数学概念,因此与集合理论和函数密切相关(在数学意义上,而不是任何编程意义上)。
[http://en.wikipedia.org/wiki/Finitary_relation][2]:
In mathematics (more specifically, in set theory and logic), a relation is a property that assigns truth values to combinations (k-tuples) of k individuals. Typically, the property describes a possible connection between the components of a k-tuple. For a given set of k-tuples, a truth value is assigned to each k-tuple according to whether the property does or does not hold.
An example of a ternary relation (i.e., between three individuals) is: "X was-introduced-to Y by Z", where (X,Y,Z) is a 3-tuple of persons; for example, "Beatrice Wood was introduced to Henri-Pierre Roché by Marcel Duchamp" is true, while "Karl Marx was introduced to Friedrich Engels by Queen Victoria" is false.
维基百科说得很清楚:在SQL数据库管理系统中,这样的三元关系将是一个“表”,而不是一个“外键”(我冒昧地重命名了关系的“列”:X = who, Y = to, Z = by):
CREATE TABLE introduction (
who INDIVIDUAL NOT NULL
, to INDIVIDUAL NOT NULL
, by INDIVIDUAL NOT NULL
, PRIMARY KEY (who, to, by)
);
此外,它将包含(可能在其他中)这个“row”:
INSERT INTO introduction (
who
, to
, by
) VALUES (
'Beatrice Wood'
, 'Henri-Pierre Roché'
, 'Marcel Duchamp'
);
但不是这个:
INSERT INTO introduction (
who
, to
, by
) VALUES (
'Karl Marx'
, 'Friedrich Engels'
, 'Queen Victoria'
);
关系数据库字典:
relation (mathematics) Given sets s1, s2, ..., sn, not necessarily distinct, r is a relation on those sets if and only if it's a set of n-tuples each of which has its first element from s1, its second element from s2, and so on. (Equivalently, r is a subset of the Cartesian product s1 x s2 x ... x sn.)
Set si is the ith domain of r (i = 1, ..., n). Note: There are several important logical differences between relations in mathematics and their relational model counterparts. Here are some of them:
Mathematical relations have a left-to-right ordering to their attributes.
Actually, mathematical relations have, at best, only a very rudimentary concept of attributes anyway. Certainly their attributes aren't named, other than by their ordinal position.
As a consequence, mathematical relations don't really have either a heading or a type in the relational model sense.
Mathematical relations are usually either binary or, just occasionally, unary. By contrast, relations in the relational model are of degree n, where n can be any nonnegative integer.
Relational operators such as JOIN, EXTEND, and the rest were first defined in the context of the relational model specifically; the mathematical theory of relations includes few such operators.
And so on (the foregoing isn't meant to be an exhaustive list).