SQL Consider the following two Relational Schema describing the EMPLOYEES and DE
ID: 3866130 • Letter: S
Question
SQL
Consider the following two Relational Schema describing the EMPLOYEES and DEPARTMENTS of some organization (assume all names are unique).
EMPLOYEES (EmployeeName, Salary, DeptName)
DEPARTMENTS (DeptName, ManagerName, City)
Define at schema level, a constraint (SQL Assertion) which specifies that none of the salaries of the employees of any department located in ‘San Francisco’ is more than the salary of any employee in the ‘Management’ department.
Explanation / Answer
CREATE ASSERTION check_salary AS CHECK ( NOT EXTISTS ( SELECT * FROM employees WHERE ( SELECT MAX(salary) FROM employees WHERE "DeptName" = 'San Fransisco' ) < ( SELECT MIN(salary) FROM employees WHERE "DeptName" = 'Management' ) ) );Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.