click to expand
Question. Suppose that we decompose the schema
Show that this decomposition is a lossless decomposition if the following set
Answer. click to expand
Recall that the sufficient condition to be a lossless decomposition is that at least one of the following dependencies is in
Since
Question. List all nontrivial functional dependencies satisfied by the relation of Figure 7.18.
Answer. click to expand
Question. Explain how functional dependencies can be used to indicate the following:
- A one-to-one relationship set exists between entity sets
studentandinstructor. - A many-to-one relationship set exists between entity sets
studentandinstructor.
Answer. click to expand
Let s_id and i_id be primary keys of student and instructor.
s_id → i_idandi_id → s_idare sufficient. Then, pairs of tuple ((a1, b1),(a1, b2)) and(are not viable.(a1, b1),(a2, b1))s_id → i_idconstraints tuples to be many-to-one.
Question Use Armstrong’s axioms to prove the soundness of the union rule. (Hint: Use the augmentation rule to show that, if
Answer. click to expand
Assume
Question Use Armstrong’s axioms to prove the soundness of the pseudotransitivity rule.
Answer. click to expand
Assume
Question. Compute the closure of the following set
Answer. click to expand
First, we can find the non-trivial dependencies with single attribute in LHS: A → B, A → C, A → D, A → E, B → D, E → A, E → B, E → C, E → D.
Next, find the non-trivial dependencies with two attributes in LHS that A, E are not included: BC → D, BC → E, BC → A, CD → E, CD → A, CD → B
Thus, A, E, BC, CD are superkeys for A _ → _, E _ → _, BC _ → _, CD _ → where is any subset of R.
Question. Using the functional dependencies of Exercise 7.6, compute the canonical cover
Answer. click to expand
The LHS of each FD in
Question. Consider the algorithm in Figure 7.19 to compute
Answer. click to expand
The algorithm is correct because:
-
If
$A$ is added to result then there is a proof that$\alpha \rightarrow A$ . To see this, observe that$\alpha \rightarrow \alpha$ trivially, so$\alpha$ is correctly part of result. If$A \not\in \alpha$ is added to result, there must be some FD$\beta \rightarrow \gamma$ such that$A \in \gamma$ and$\beta$ is already a subset of result. (Otherwise fdcount would be nonzero and the if condition would be false.) A full proof can be given by induction on the depth of recursion for an execution of addin, but such a proof can be expected only from students with a good mathematical background. -
If
$A \in \alpha^+$ , then$A$ is eventually added to result. We prove this by inductionon the length of the proof of$\alpha \rightarrow A$ using Armstrong's axioms. First observe that if procedure addin is called with some argument$\beta$ , all the attributes in$\beta$ will be added to result. Also if a particular FD's fdcount becomes 0, all the attributes in its tail will definitely be added to result. The base case of the proof,$A \in \alpha \Rightarrow A \in \alpha^+$ , is obviously true because the first call to addin has the argument$\alpha$ . The inductive hypothesis is that if$\alpha \rightarrow A$ can be proved in n steps or less, then$A \in$ result. If there is a proof in$n + 1$ steps that$\alpha \rightarrow A$ , then the last step was an application of either reflexivity, augmentation, or transitivity on a fact$\alpha \rightarrow \beta$ provided in$n$ or fewer steps. If reflexivity or augmentation was used in the$(n+1)^{st}$ step,$A$ must have been in result by the end of the$n^{th}$ step itself. Otherwise, by the inductive hypothesis,$\beta \subseteq$ result. Therefore, the dependency used in proving$\beta \rightarrow \gamma$ ,$A \in \gamma$ , will have fdcount set to 0 by the end of the$n^{th}$ step. Hence$A$ will be added to result.
To see that this algorithm is more efficient than the one presented in the chapter, note that we scan each FD once in the main program. The resulting array appears has size proportional to the size of the given FDs. The recursive calls to addin result in processing linear in the size of appears. Hence the algorithm has time complexity which is linear in the size of the given FDs. On the other hand, the algorithm given in the text has quadratic time complexity, as it may perform the loop as many times as the number of FDs, in each loop scanning all of them once.
Question. Given the database schema
Answer. click to expand
SELECT B
FROM r
GROUP BY B
HAVING COUNT (DISTINCT C) > 1CREATE ASSERTION B_to_C CHECK
(
NOT EXISTS (
SELECT B
FROM r
GROUP BY B
HAVING COUNT (DISTINCT C) > 1
)
)Question. Our discussion of lossless decomposition implicitly assumed that attributes on the left-hand side of a functional dependency cannot take on null values. What could go wrong on decomposition, if this property is violated?
Answer. click to expand
The natural join operator is defined in terms of the Cartesian product and the selection operator. The selection operator gives unknown for any query on a null value. Thus, the natural join excludes all tuples with null values on the common attributes from the final result. Thus, the decomposition would be lossy, if null values occur in the LHS of the functional dependency used to decompose the relation.
Question. In the BCNF decomposition algorithm, suppose you use a functional dependency
a. What primary and foreign-key constraint do you expect to hold on the decomposed relations?
b. Give an example of an inconsistency that can arise due to an erroneous update, if the foreign-key constraint were not enforced on the decomposed relations above.
c. When a relation schema is decomposed into 3NF using the algorithm in Section 7.5.2, what primary and foreign-key dependencies would you expect to hold on the decomposed schema?
Answer. click to expand
a. In
b. If the foreign key constraint is not enforced, then a deletion of a tuple from NULL in some tuples.
c. For every schema
Foreign-key constraints are created as follows: for each relation
Question. Let
Answer. click to expand
Let
By definition of natural join:
where the condition
The selection process is satisfied because all attributes with the same name must have the same value since they are projections from the same tuple. And the projection to
Question. Show that the decomposition in Exercise 7.1 is not a dependency-preserving decomposition.
Answer. click to expand
Note that
And
Question. Show that there can be more than one canonical cover for a given set of functional dependencies, using the following set of dependencies:
Answer. click to expand
There can be more than one canonical cover for a given set of functional dependencies due to the selection of extraneous attributes to discard when the canoncial cover is constructed. For example,
- Discard
$Z$ ,$Y$ , and$X$ :$X \to Y, Y \to XZ, Z \to XY$ $\implies$ $X \to Y, Y \to XZ, Z \to X$ $\implies$ $X \to Y, Y \to Z, Z \to X$ - Discard
$Z$ ,$X$ and$Y$ :$X \to YZ, Y \to X, Z \to XY$ $\implies$ $X \to YZ, Y \to X, Z \to Y$ $\implies$ $X \to Z, Y \to X, Z \to Y$ - Discard
$Z$ and$X$ :$X \to Y, Y \to XZ, Z \to XY$ $\implies$ $X \to Y, Y \to XZ, Z \to Y$
Question. The algorithm to generate a canonical cover only removes one extraneous attribute at a time. Use the functional dependencies from Exercise 7.14 to show what can go wrong if two attributes inferred to be extraneous are deleted at once.
Answer. click to expand
In
Question. Show that it is possible to ensure that a dependency-preserving decomposition into 3NF is a lossless decomposition by guaranteeing that at least one schema contains a candidate key for the schema being decomposed. (Hint: Show that the join of all the projections onto the schemas of the decomposition cannot have more tuples than the original relation.)
Answer. click to expand
Consider the dependency-preserving 3NF decomposition of schema
Claim: if
Proof: To prove this claim, we use the following inductive argument. Let for loop in this algorithm is executed:
-
Basis
$\mathrm{result} = X$ , and hence$t_1 [\mathrm{result}] = t_2 [\mathrm{result}]$ holds given that$t_1 [X] = t_2 [X]$ . -
Induction
Let$t_1 [\mathrm{result}] = t_2 [\mathrm{result}]$ be true at the end of the$k$ -th execution of theforloop. Suppose the functional dependency considered in the$(k + 1)$ -th execution of theforloop is$\beta \to \gamma$ and that$\beta \subseteq \mathrm{result}$ .$\beta \subseteq \mathrm{result}$ implies that$t_1 [\mathrm{result}] = t_2 [\mathrm{result}]$ . The facts that$\beta \to \gamma$ holds for some attribute set$R_i$ and that$t_1 [R_i]$ &$t_2 [R_i]$ are in$\Pi_{R_i} (r)$ imply that$t_1 [\gamma] = t_2 [\gamma]$ is also true. Since$\gamma$ is now added to the$\mathrm{result}$ by the algorithm, we know that$t_1[\mathrm{result}] = t_2[\mathrm{result}]$ is true at the end of the$(k + 1)$ -th execution of theforloop.
Since the decomposition is dependency-preserving and
Question. Give an example of a relation schema
Answer. click to expand
Consider Exercise 7.1;
-
$\alpha = A$ ,$\beta = BC$ $\implies$ $R_1 = \alpha \cup \beta = (A, B, C)$ and$R_2 = R - (\beta - \alpha) = (A, D, E)$ . -
$\alpha = B$ ,$\beta = D$ $\implies$ $R_1 = \alpha \cup \beta = (B, D)$ and$R_2 = R - (\beta - \alpha) = (A, B, C, E)$ .$\alpha = A, \beta = BC$ $\implies$ $R_2 = \alpha \cup \beta = (A, B, C)$ and$R_3 = R - (\beta - \alpha) = (A, E)$ . -
$\alpha = CD$ ,$\beta = E$ $\implies$ $R_1 = \alpha \cup \beta = (C, D, E)$ and$R_2 = R - (\beta - \alpha) = (A, B, C, D)$ $\alpha = B$ ,$\beta = D$ $\implies$ $R_2 = \alpha \cup \beta = (B, D)$ and$R_3 = R - (\beta - \alpha) = (A, B, C)$
Or, consider
Question. Let a prime attribute be one that appears in at least one candidate key. Let
Answer. click to expand
1. Suppose
-
$\beta \to A$ is non-trivial; -
$\beta \to R$ does not hold as$\beta \not\to \alpha$ . If$\beta$ is a key,$\beta \to \alpha$ should be satisfied; -
$A - \beta = A$ is not contained in the candidate keys of$R$ since$A$ is non-prime;
2. Suppose
-
$\alpha$ is not a superkey; - Some
$A$ in$\beta - \alpha$ is non-prime; note that$\alpha \to A$ .
But we can show that such
- Let
$\gamma$ be a candidate key for$R$ ; then$\gamma \to \alpha$ ; - Since
$\alpha$ is not a superkey,$\alpha \not\to \gamma$ ; -
$A$ is non-prime, thus$A \notin \gamma$ ; -
$A \notin \alpha$ as$A \in \beta - \alpha$ ;
Thus
Question. A functional dependency
- It appears in a candidate key.
- It is not partially dependent on a candidate key.
Show that every 3NF schema is in 2NF. (Hint: Show that every partial dependency is a transitive dependency.)
Answer. click to expand
Suppose that
- If
$A$ is prime attribute, then it appears in a candidate key and satisfies the first condition of 2NF; - If
$A$ is non-prime attribute,$A$ is not transitively dependent on any key for$R$ .- Therefore, it suffices to show that partial dependency
$\alpha \to A$ is a transitive dependency when$A$ is non-prime and$\alpha$ is a candidate key for$R$ . Suppose that$\alpha \to A$ is partial dependency; there is a proper subset$\gamma$ of$\alpha$ such that$\gamma \to A$ . - Then, we can show that
$A$ is transitively dependent on$\alpha$ :-
$\alpha \to \gamma$ since$\gamma \subset \alpha$ ; -
$\beta \not\to \alpha$ since$\alpha$ is a candidate key; -
$A \notin \alpha \wedge A \notin \gamma$ since we assume$A$ is non-prime;
-
- Therefore, it suffices to show that partial dependency
Question. Give an example of a relation schema
Answer. click to expand
Consider the relation inst_info (ID, child_name, phone) with no non-trivial FD. But since an instructor may have more than one phone and can have multiple children, we may assume that ID →→ phone and ID →→ child_name holds. There is no non-trivial functional dependency, and therefore the relation is in BCNF, but not in 4NF as ID is not a superkey.
But there are, of course, an infinite number of such examples.
Question. Give a lossless decomposition into BCNF of schema
Answer. click to expand
There are several possible decompositions, depending on the choice of non-trivial functional dependency. For example:
-
$\alpha = A$ ,$\beta = BC$ $\implies$ $R_1 = \alpha \cup \beta = (A, B, C)$ and$R_2 = R - (\beta - \alpha) = (A, D, E)$ . -
$\alpha = B$ ,$\beta = D$ $\implies$ $R_1 = \alpha \cup \beta = (B, D)$ and$R_2 = R - (\beta - \alpha) = (A, B, C, E)$ .$\alpha = A, \beta = BC$ $\implies$ $R_2 = \alpha \cup \beta = (A, B, C)$ and$R_3 = R - (\beta - \alpha) = (A, E)$ .
Question. Give a lossless, dependency-preserving decomposition into 3NF of schema
Answer. click to expand
Note that given
Question. Explain what is meant by repetition of information and inability to represent information. Explain why each of these properties may indicate a bad relational database design.
Answer. click to expand
- Repetition of information (also known as data redundancy)
- occurs when the same piece of data is stored in multiple places within the database.
- storing the same data multiple times increases the amount of storage required.
- also, multiple copies of the same data can become out of synchronization, leading to data integrity issues.
- Inability to represent information
- occurs when the database design prevents certain types of information from being accurately or efficiently stored, retrieved, or manipulated.
- e.g., A database that cannot store
NULLvalues in fields where information might be optional.
- e.g., A database that cannot store
- important data may be lost or not captured because the design doesn't accommodate it.
- the database becomes inflexible to changes in business requirements.
- occurs when the database design prevents certain types of information from being accurately or efficiently stored, retrieved, or manipulated.
Question. Why are certain functional dependencies called trivial functional dependencies?
Answer. click to expand
Trivial functional dependencies are called trivial because they are self-evident and do not provide any new or useful information about the structure of the database.
Question. Use the definition of functional dependency to argue that each of Armstrong's axioms (reflexivity, augmentation, and transitivity) is sound.
Answer. click to expand
Let
-
Reflexivity rule
$\beta \subseteq \alpha \implies \alpha \to \beta$
Let
-
Augmentation rule
$\alpha \to \beta \implies \forall \gamma: \gamma \alpha \to \gamma \beta$
Let
Let
-
Transitivity rule
$\alpha \to \beta \wedge \beta \to \gamma \implies \alpha \to \gamma$
Let
Question. Consider the following proposed rule for functional dependencies: If
Answer. click to expand
| 1 | 2 | 2 |
| 1 | 2 | 3 |
Question. Use Armstrong’s axioms to prove the soundness of the decomposition rule.
Answer. click to expand
Suppose that
Question. Using the functional dependencies of Exercise 7.6, compute
Answer. click to expand
Question. Show that the following decomposition of the schema
Hint: Give an example of a relation
Answer. click to expand
Consider the following instance of
| 1 | 2 | 3 | 3 | 4 |
| 2 | 3 | 3 | 4 | 6 |
Then,
| 1 | 2 | 3 |
| 2 | 3 | 3 |
and
| 3 | 3 | 4 |
| 3 | 4 | 6 |
The natural join between them yields
| 1 | 2 | 3 | 3 | 4 |
| 1 | 2 | 3 | 4 | 6 |
| 2 | 3 | 3 | 3 | 4 |
| 2 | 3 | 3 | 4 | 6 |
Question. Consider the following set F of functional dependencies on the relation schema
a. Compute
b. Prove (using Armstrong's axioms) that
c. Compute a canonical cover for this set of functional dependencies
d. Give a 3NF decomposition of the given schema based on a canonical cover.
e. Give a BCNF decomposition of the given schema using the original set
Answer. click to expand
a.
b. Note that
c.
-
$F_c = (A \to BCD, BC \to E, B \to D, D \to A)$ as$D$ in$BC \to DE$ is extraneous by$B \to D$ .
-
$F_c = (A \to BC, BC \to E, B \to D, D \to A)$ as$D$ in$A \to BCD$ is extraneous by$B \to D$ .
Thus,
Note that
d.
-
$R_1 = (A, B, C)$ ,$R_2 = (B, C, E)$ ,$R_3 = (B, D)$ ,$R_4 = (A, D)$ . - Since none of
$R_j$ ($1 \leq j \leq 4$ ) contains the candidate keys for$R$ , add$R_5 = (A, G)$ .
e.
-
$\alpha = A$ ,$\beta = BCD$ $\implies$ $R_1 = (A, B, C, D)$ and$R_2 = (A, E, G)$ ; -
$\alpha = B$ ,$\beta = D$ $\implies$ $R_1 = (B, D)$ ,$R_2 = (A, B, C)$ , and$R_3 = (A, E, G)$ ; -
$\alpha = A$ ,$\beta = E$ $\implies$ $R_1 = (B, D)$ ,$R_2 = (A, B, C)$ ,$R_3 = (A, E)$ , and$R_4 = (A, G)$ ;
Other answers are also possible. For example,
-
$\alpha = D$ ,$\beta = A$ $\implies$ $R_1 = (A, D)$ and$R_2 = (B, C, D, E, G)$ ; -
$\alpha = BC$ ,$\beta = DE$ $\implies$ $R_1 = (A, D)$ ,$R_2 = (B, C, D, E)$ , and$R_3 = (B, C, G)$ ;
Question. Consider the schema
Answer. click to expand
Then, we find BCNF decomposition of
-
$\alpha = AB$ ,$\beta = CD$ $\implies$ $R_1 = (A, B, C, D)$ , and$R_2 = (A, B, E, G)$ ; -
$\alpha = AB$ ,$\beta = E$ $\implies$ $R_1 = (A, B, C, D)$ ,$R_2 = (A, B, E)$ , and$R_3 = (A, B, G)$ ; -
$\alpha = B$ ,$\beta = D$ $\implies$ $R_1 = (B, D)$ ,$R_2 = (A, B, C)$ ,$R_3 = (A, B, E)$ , and$R_4 = (A, B, G)$ ;
Note that this decomposition is not dependency preserving, since
Question. Consider the schema
a. Find a nontrivial functional dependency containing no extraneous attributes that is logically implied by the above three dependencies and explain how you found it.
b. Use the BCNF decomposition algorithm to find a BCNF decomposition of
c. For your decomposition, state whether it is lossless and explain why.
d. For your decomposition, state whether it is dependency preserving and explain why.
Answer. click to expand
a. Note that there are no non-trivial FDs with extraneous attributes in
b. BCNF decomposition can be found as follows:
-
$\alpha = A$ ,$\beta = BC$ $\implies$ $R_1 = (A, B, C)$ and$R_2 = (A, D, E, G)$ . - Note that
$AD \to ABE$ holds.$\alpha = AD$ ,$\beta = AE$ $\implies$ $R_1 = (A, B, C)$ ,$R_2 = (A, D, E)$ , and$R_3 = (A, D, G)$ .
c. Note that
d. The decomposition does not preserve dependencies. For example, in case of result = (C, D, CD), indicating that the decomposition does not preserve dependencies.
Question. Consider the schema
Use the 3NF decomposition algorithm to generate a 3NF decomposition of
a. A list of all candidate keys
b. A canonical cover for
c. The remaining steps of the algorithm, with explanation
d. The final decomposition
Answer. click to expand
a.
b. Canoncial cover of
-
$C$ in$AB \to CD$ is extraneous;$F_c = (AB \to D, ADE \to GDE, B \to GC, G \to DE)$ ; -
$DE$ in$ADE \to GDE$ is extraneous;$F_c = (AB \to D, ADE \to G, B \to GC, G \to DE)$ ; -
$D$ in$AB \to D$ is extraneous as$B \to CDE$ holds;$F_c = (ADE \to G, B \to GC, G \to DE)$ ;
Thus,
c. 3NF decomposition of
-
$R_1 = (A, D, E, G)$ ,$R_2 = (B, C, G)$ and$R_3 = (D, E, G)$ ; - Since none of
$R_1$ ,$R_2$ ,$R_3$ contains the candidate key,$R_4 = (A, B)$ ; - Since
$R_3 \subseteq R_1$ , delete$R_3$ .
d.
Question. Consider the schema
Use the 3NF decomposition algorithm to generate a 3NF decomposition of
a. A list of all candidate keys
b. A canonical cover for
c. The remaining steps of the algorithm, with explanation
d. The final decomposition
Answer. click to expand
a.
b. Canoncial cover of
-
$C$ in$AB \to CD$ is extraneous;$F_c = (AB \to D, D \to C, DE \to B, DEH \to AB, AC \to DC)$ ; -
$C$ in the RHS of$AC \to DC$ is extraneous;$F_c = (AB \to D, D \to C, DE \to B, DEH \to AB, AC \to D)$ ; -
$B$ in$DEH \to AB$ is extraneous;$F_c = (AB \to D, D \to C, DE \to B, DEH \to A, AC \to D)$ ;
Thus,
c. 3NF decomposition of
-
$R_1 = (A, B, D)$ ,$R_2 = (C, D)$ ,$R_3 = (B, D, E)$ ,$R_4 = (A, D, E, H)$ and$R_5 = (A, C, D)$ ; - None of decomposed scehmas include candidate key;
$R_6 = (D, E, H, G)$ - Since
$R_2 \subseteq R_5$ , delete$R_2$ .
d.
Question. Although the BCNF algorithm ensures that the resulting decomposition is loss-less, it is possible to have a schema and a decomposition that was not generated by the algorithm, that is in BCNF, and is not lossless. Give an example of such a schema and its decomposition.
Answer. click to expand
Consider the schema
Take the decomposition of
Then, each decomposed schema is obviously BCNF, but we already showed that this decomposition is lossy.
Question. Show that every schema consisting of exactly two attributes must be in BCNF regardless of the given set
Answer. click to expand
Let
Question. List the three design goals for relational databases, and explain why each is desirable.
Answer. click to expand
The ideal relational databases possess the capability to:
- Store information without loss
- Store information without redundancy
- Retrieve information effortlessly
In other words, goal for a relational database design is:
- BCNF
- Lossless join
- Dependency preservation
Question. In designing a relational database, why might we choose a non-BCNF design?
Answer. click to expand
Testing functional dependency constraints each time the database is updated can be costly. Thus, it is useful to design the database in a way that constraints can be tested efficiently. When decomposing a relation, it may be no longer possible to do the testing without having to perform a Cartesian product of join operations. In particular, if testing a functional dependency can be done by considering just one relation, then the cost of testing this constraint is low. A decomposition that makes it computationally hard to enforce functional dependency is said to be not dependency preserving.
And BCNF is known to be not dependency preserving. In such scenarios, we might choose a non-BCNF design such as 3NF to obtain dependency preservation.
Question. Given the three goals of relational database design, is there any reason to design a database schema that is in 2NF, but is in no higher-order normal form? (See Exercise 7.19 for the definition of 2NF.)
Answer. click to expand
Consider the schema
While higher-order normal forms generally provide more robust solutions in terms of data integrity and anomaly prevention, there are practical reasons for designing a database schema that remains in 2NF.
For example, higher normalization often results in more joins, which can be computationally expensive. In case of
Question. Given a relational schema
Answer. click to expand
False.
$t_1 [A] = t_2 [A] = t_3[A] = t_4[A]$ $t_3 [BC] = t_1[BC]$ $t_3 [AD] = t_2[AD]$ $t_4 [BC] = t_2[BC]$ $t_4 [AD] = t_1[AD]$
To prove
Question. Explain why 4NF is a normal form more desirable than BCNF.
Answer. click to expand
First of all, 4NF is higher normal form than BCNF; every 4NF is in BCNF.
Second, BCNF may not be sufficient to avoid from multi-valued attributes; there are database schemas in BCNF that do not seem to be sufficiently normalized. For example, consider the relation inst_info (ID, child_name, phone) with no non-trivial FD. Since an instructor may have more than one phone and can have multiple children, the following example instance is possible:
ID |
child_name |
phone |
|---|---|---|
| 9999 | David | 515-01-4321 |
| 9999 | David | 515-01-1234 |
| 9999 | Alice | 515-01-4321 |
| 9999 | Alice | 515-01-1234 |
There is no non-trivial functional dependency, and therefore the relation is in BCNF. But insertion anomalies can be occurred; if we add a phone 981-992-3443 to ID 99999, we need to add two tuples
(99999, David, 981-992-3443)(99999, Alice, 981-992-3443)
In such scenarios, it is better to decompose the relation inst_info into 4NFs inst_child and inst_phone.
Question. Normalize the following schema, with given constraints, to 4NF.
Answer. click to expand
books
Since the behavior of MVD is much more complex than FD, let's start with the given MVD first.
-
α = isbnandβ = author$\implies$ R_1 = (isbn, author),R_2 = (accessionno, isbn, title, publisher) -
α = isbnandβ = title, publisher$\implies$ R_1 = (isbn, author),R_2 = (isbn, title, publisher),R_3 = (accessionno, isbn)
users
Note that userid → name, deptid holds.
-
α = deptidandβ = deptname$\implies$ R_1 = (deptid, deptname),R_2 = (userid, name, deptid)
Question. 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
Answer. click to expand
The given FD can be implemented with the constraint
SELECT B, COUNT (DISTINCT C) AS x
FROM r
GROUP BY BQuestion. Given two relations && operator to check if two intervals overlap and the * operator to compute the intersection of two intervals.
Answer. click to expand
SELECT A, r.B, C, r.validtime * s.validtime
FROM r INNER JOIN s
ON r.B = s.B AND r.validtime && s.validtime
