For the following table, Would you please assist witht the following questions.
ID: 3853650 • Letter: F
Question
For the following table, Would you please assist witht the following questions. View of this table is vstu. Thank you.
1. Modify a tuple in your view of your table so that a student changes his or her major.
2. Re-execute the display of the view. Did modifying your vstu view also change the parent- able, Stutab?
3. Try to modify the view again, but this time change the major to ‘COMPSC’—an obviously invalid field in the Stutab table because the attribute was defined as four characters. Can you do it? What happens?
SNAME MAJOR Zelda Mary Lujack Jerry Jake Hillaryl COSC Elainie Brenda Brad Alan CoSC CoSC CoSC CoSC CoSC CoSC CoSC CoSC CoSC 10 rows selected.Explanation / Answer
Hi,
Please find below the answer-
Ans 1 - update vstu_view set MAJOR='PHY' WHERE SNAME='Mary'
Ans 2 - Yes, modifying the view actually impacts the actual table Stutab. This is because SELECT opens an implicit cursor which points to the records from the base table. When ever you update the records it updates the original data since they are pointers to the original.
Ans 3 - update vstu_view set MAJOR='COMPSC' WHERE SNAME='Mary'
This statement will give an error because the maximum length defined for this column in the stutab table is 4 chars and we are trying to store the 5 char value in the view of this table which will result in an error.
Regards,
Vinay
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.