That it “double research” often is used whenever yourself interrogating a dining table one to represents an effective recursive relationships
If you evaluate emp , so as to new employer of one’s personnel that have empno = 2 (Ned) has bossno = step 1. Then you can look-up the fresh row in the emp which have empno = 1 to locate one to Ned’s boss are Alice. Soon one can find exactly how that is addressed having SQL.
You will find that there isn’t any foreign trick meaning to have empno into the dept (the newest step one:1 department’s manager relationship). As to why? Note that deptname is a foreign type in emp . When we create empno a different key in dept , after that i’ve a deadly accept. Another service can not be put in the dept dining table up until there can be a supervisor for this institution (we.elizabeth., you will find a person in this new emp table with the empno of the manager); but not, one other limitation states you to definitely an employee can’t be put into the emp dining table unless there can be a department to which you to definitely person is tasked. When we enjoys each other overseas trick limitations, we can’t create a new agencies up to i have added a beneficial boss, therefore cannot create a supervisor up to i have added good institution regarding people. (閱讀全文…)