7.43

Although SQL does not support functional dependency constraints, if the database system supports constraints on materialized views, and materialized views are maintained immediately, it is possible to enforce functional dependency constraints in SQL. Given a relation \(r(A,B,C)\), explain how constraints on materialized views can be used to enforce the functional dependency \(B \rightarrow C\).


We will create a materialized view of the following SQL query:

SELECT B, COUNT(DISTINCT C) AS X 
FROM r
GROUP BY B

with the added constraint that \(X \leq 1\).