Database, Relational Algebra, Relational Calculus, SQL Assertions Please show th
ID: 3708746 • Letter: D
Question
Database, Relational Algebra, Relational Calculus, SQL Assertions
Please show the derivation of each of the answers if possible. Thanks in advance.
Problenm In this problem you will express a referential integrity constraint using a general SQL assertion. Assume that there are two tables R (A) and S (A). Using a general SQL assertion, express that s . A s a foreign key referencing R . A. That is, there should not be any S.A value that does not appear in R.A. Note that a general SQL assertion is not attached to a particular table. Therefore, whenever a SQL modification statement is executed that may potentially violate the assertion, the DBMS checks the result of the statement and rejects the statement if it causes violation. This behavior is the same as the default semantics of a foreign-key constraint Complete what I started here: CREATE ASSERTION FKey (NOT (SELECT* FROM S WHERE A (SELECT A FROM R))) Problenm Consider the table R (A, B), which currently has only one tuple (1,0). Assume that the following trigger has already been created for the database CREATE TRIGGER Times2 AFTER UPDATE ON R REFERENCING NEW ROW AS n FOR EACH ROW WHEN (n.BExplanation / Answer
If you have any doubts, please give me comment... I will help you...
1)
CREATE ASSERTION FKey CHECK (NOT EXISTS(
SELECT *
FROM S
WHERE A NOT IN (SELECT A
FROM R)));
2)
SELECT * FROM R;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.