SQL statement to prove that A->B in a R(ABCD)

后端 未结 3 1309
被撕碎了的回忆
被撕碎了的回忆 2021-01-14 16:38

How do I write a SQL statement that proves the functional dependency A → B holds given a relation with attributes ABCD knowing that no record has NULL values?

3条回答
  •  粉色の甜心
    2021-01-14 17:08

    SELECT * from R r1, R r2 where r1.A=r2.A and r1.B <> r2.B
    

    This should return an empty set if the FD holds.

提交回复
热议问题