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?
You could also group by the functional dependency you want to check (in this case A->B), and count if there are distinct B´s for each A.
SELECT *
FROM R
GROUP BY A
HAVING COUNT (DISTINCT B) > 1;
If you would like to check if A -> B,C you could expand the query:
SELECT *
FROM R
GROUP BY A
HAVING COUNT (DISTINCT B) > 1 OR COUNT (DISTINCT C)>1;