将多值依赖项转换为SQL

时间:2014-07-13 23:21:33

标签: sql sqlite functional-dependencies

假设我们在关系R(X,Y,Z)中有以下MVD:

X ->> YZ

因为我可以在SQL中编写FD X -> Y

SELECT X
FROM R
GROUP BY A
HAVING COUNT (DISTINCT Y) > 1

我尝试将相同的逻辑思想应用于上面提到的MVD:

SELECT X
FROM R AS R1
INNER JOIN 
R as R2
ON R1.X = R2.X
GROUP BY R1.X, R2.X 
HAVING COUNT(DISTINCT R1.B > 1) and COUNT(DISTINCT R1.C > 1)

但有些内容对我来说并不合适,特别是JOINHAVING语句。有人可以告诉我这里有什么问题吗?

0 个答案:

没有答案