Question 2.1.1 (7 Points) Write an SQL statement that adds an advisorid attribut
ID: 3597112 • Letter: Q
Question
Question 2.1.1 (7 Points)
Write an SQL statement that adds an advisorid attribute to relation student, and sets it to be a foreign key to facultyid in relation faculty. In case a faculty’s id is changed, the change would be reflected on advisorid attribute; in case a student’s advisor left the school, advisorid would be set to NULL
17:45 cs.iit.edu Pad 78% D book bookid title Introduction of Algorithms Database System Concepts price total copies 84.66 74.99 Stochastic Calculus for Finance 1.02 Stochastic Calculus for Finance II 55.22 course title Algorithms DB Organizatio Advanced DB Organization Math Finance I Math Finance II courseid instructoridtextbookid enroll studentid courseid student faculty studentid namegpa Tom 3.3 John 3.8 Mary 3.0 Kris3.6 Alex 3.5 facultyid naime salarV James70000 Sarah 60000 Jay80000 Rachel 70000 Paul 85000 book checkout bookid studentid ate 2017-08-29 2017-09-02 2017-09-07 Hints:Explanation / Answer
The above alter table command will add the attribute advisorid to the table student. And on update cascade will cause if there are changes made to the facultyid column then the corresponding change will be happen in advisor table also.on delete set null will cause if the advisor is removed from the student table then the correspondng record in faculty would set to null.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.