Consider the relation Emp-Dept with SSn as key Ename SSn EAddr Dept. No Dept. Name Dept. Manager SSn   Which of the following is (are) invalid operation(s)? a) Inserting an employee without name and address b) Inserting an employee with only SSn c) Inserting a department with no employee d) Inserting an employee without SSn

Consider the relation Emp-Dept with SSn as key Ename SSn EAddr Dept. No Dept. Name Dept. Manager SSn   Which of the following is (are) invalid operation(s)? a) Inserting an employee without name and address b) Inserting an employee with only SSn c) Inserting a department with no employee d) Inserting an employee without SSn Correct Answer d

Concept:

  • Here employee and department both table are merged into one table so right most SSn id is foreign key and second entry from left side is key of employee table.


Statement a:

 Inserting an employee without name and address, is a valid statement because only SSn which is key should not be NULL other entries can be NULL.

Statement b:

Inserting an employee with only SSn, is a valid statement because only SSn which is key should not be NULL and here SSn is not NULL so valid statement

Statement c:

Inserting a department with no employee is a valid statement because foreign key can have NULL value.

Statement d:

Inserting an employee without SSn is not a valid statement because SSn employee id cannot be NULL

So option 2 is the correct answer.

Related Questions

Consider the following relational schema: employee(empId,empName,empDept) customer(custId,custName,salesRepId,rating) salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return? SELECT empName FROM employee E WHERE NOT EXISTS (SELECT custId FROM customer C WHERE C.salesRepId = E.empId AND C.rating <> ’GOOD’);