Question

In: Computer Science

11. A business rule says that an employee cannot earn more than his/her manager. Assume that...

11. A business rule says that an employee cannot earn more than his/her manager.
Assume that each employee row has a foreign key which refers to a manger row.
a. Can this business rule be implemented using a fixed format constraint?
b. Can this business rule be implemented using a trigger?
12. Triggers should be created sparingly. Why?
13. Should you use a trigger to check the uniqueness of a primary key?

14. What is a Distributed Database system?
15. What advantages does a Distributed Database have over a Centralized Database?
16. Why do some users require data from multiple sites in a Distributed Database?

17. What is Horizontal Fragmentation within a DDBMS?

Note: Questions are based on DBMS (Distributed database and triggers)

Solutions

Expert Solution

Ans a is - This rule cannot be implemented wih the help of fixed format constraint.

Explanation - There are 5 constraints are available Oracle. promary key, unique key, not null, check and foreign key referancial integrity. with this we canot not stop allowoing a new record while verifying the manager's salary of that employee.

Ans b is - yes we can enter record based on the condition.

Explanation:

we need to create a trigger insert before type like below.

CREATE OR REPLACE TRIGGER rules_employee_salary_lessthan_manager
BEFORE INSERT
ON employee
FOR EACH ROW

DECLARE
v_sal number;

BEGIN


SELECT sal into v_sal from FROM employees a INNER JOIN employees b
ON A.MANAGER_ID = B.EMPLOYEE_ID ORDER BY A.EMPLOYEE_ID ;

IF(:new.sal > v_sal) THEN
RAISE_APPLICATION_ERROR(-20000,'Employee sal canot be greater than manager');
END IF;
END;
/

Ans 12 -

Process of handling flag is like below:

All handlers are tested and matching handlers queued before invoking the first handler. thats why flags set by a handler will not trigger new matching handlers until after all of the current set of matching handlers are done.
This allows you to ensure some ordering of otherwise non-determined handler invocation by chaining f

But when trigger comes to picture it behave like below:

When a trigger is registered, then as soon as the flag given by when is set, the other flag is set or cleared at the same time.
Thus, there is no chance that another handler will run in between. Triggers are implicit, So trigger should be used sparingly.

Ans of 13:

Not needed to check the uniqueness of Promary key with the help of trigger. Primary key properties is not to allow duplicate and NULL values to the column where the primary key constraints assigned.

Ans of 14:

A distributed database is a collection of multiple interconnected databases, which are spread physically across various locations that communicate via a database link (db link).

Advantages of Distributed Databases
Modular Development − If the system needs to be expanded to new locations or new units, in centralized database systems, the action requires substantial efforts and disruption in the existing functioning. However, in distributed databases, the work simply requires adding new computers and local data to the new site and finally connecting them to the distributed system, with no interruption in current functions.
More Reliable − when one data base is down then only that component will fails but other functionality available in other database will work properly.
Better Response − If data is distributed in an efficient manner, then user requests can be met from local data itself, thus providing faster response.
Lower Communication Cost − In distributed database systems, if data is located locally where it is mostly used, then the communication costs for data manipulation can be minimized.

Ans of 15:

Following are the advantages of distributed databases over centralized databases.

Modular Development − If the system needs to be expanded to new locations or new units, in centralized database systems, the action requires substantial efforts and disruption in the existing functioning. However, in distributed databases, the work simply requires adding new computers and local data to the new site and finally connecting them to the distributed system, with no interruption in current functions.
More Reliable − In case of database failures, the total system of centralized databases comes to a halt. However, in distributed systems, when a component fails, the functioning of the system continues may be at a reduced performance. Hence DDBMS is more reliable.
Better Response − If data is distributed in an efficient manner, then user requests can be met from local data itself, thus providing faster response. On the other hand, in centralized systems, all queries have to pass through the central computer for processing, which increases the response time.
Lower Communication Cost − In distributed database systems, if data is located locally where it is mostly used, then the communication costs for data manipulation can be minimized. This is not feasible in centralized systems.

Ans of 16:

To generate report or to generate statistics for higher management or decession making team in the organization, report team/user need data from different site of database.

Ans of 17:

It refers to the division of a relation into subsets (fragments) of tuples (rows). Each fragment is stored at a different node, and each fragment has unique rows.
However, the unique rows all have the same attributes (columns). In short, each fragment represents the equivalent of a SELECT statement, with the WHERE clause on a single attribute.
Types of horizontal fragmentation :
i. Primary Horizontal Fragmentation
It is the fragmentation of primary relation
e.g. Employee table is fragmented for Department No.
ii. Derived Horizontal Fragmentation


Related Solutions

An employee is complaining to you about his supervisor. He says that the supervisor expects more...
An employee is complaining to you about his supervisor. He says that the supervisor expects more from him than from other employees. He feels the supervisor picks on him and gives him the most difficult jobs to do. He is quite unhappy and is considering asking for a transfer to a different department. He is claiming that the supervisor is treating him unfairly. You ask the employee if he has discussed the situation with his supervisor. He has not. As...
question/ A mutual fund manager expects her portfolio to earn a rate of return of 11%...
question/ A mutual fund manager expects her portfolio to earn a rate of return of 11% this year. The beta of her portfolio is 0.9. If the rate of return available on risk-free assets is 4% and you expect the rate of return of the market portfolio to be 14%. #1A- What expected rate of return would you demand before you would be willing to invest in this mutual fund? #2A- Is this fund attractive? Why? #3A- How could you...
A mutual fund manager expects his portfolio to earn a rate of return of 11 percent...
A mutual fund manager expects his portfolio to earn a rate of return of 11 percent this year. The beta of the portfolio is 0.8. If the market risk premium is 10 percent and the risk-free rate is 4 percent, is it a good idea to invest? How could you use a stock index fund (S&P 500 index) and risk-free fund (invested in T-bills) to create a portfolio with the same risk as the manager, but a higher return?
The manager of a restaurant in a large city claims that waiters working in all restaurants in his city earn an average of more than $150 in tips per week
1. The manager of a restaurant in a large city claims that waiters working in all restaurants in his city earn an average of more than $150 in tips per week. A random sample of 25 waiters selected from restaurants of this city yielded a mean of $155 in tips per week with a standard deviation of $28. Assume that the weekly tips for all waiters in this city have a normal distribution. Let μ denote the mean tips earned...
A prospective employee was told she could average more than $80 a day in tips. Assume...
A prospective employee was told she could average more than $80 a day in tips. Assume the standard deviation of the population is $3.24. Over the first 35 days the employee worked the mean daily amount of her tips was $84.85. At the .01 significance level what will be the value of the critical value if we are testing to see if the true average daily amount of tips is greater than $80?
A prospective employee was told she could average more than $80 a day in tips. Assume...
A prospective employee was told she could average more than $80 a day in tips. Assume the standard deviation of the population is $3.24. Over the first 35 days the employee worked the mean daily amount of her tips was $84.85. At the .01 significance level what will be the value of the critical value if we are testing to see if the true average daily amount of tips is greater than $80?   
A prospective employee was told she could average more than $80 a day in tips. Assume...
A prospective employee was told she could average more than $80 a day in tips. Assume the standard deviation of the population is $3.24. Over the first 35 days the employee worked the mean daily amount of her tips was $84.85. At the .01 significance level what will be the value of the critical value if we are testing to see if the true average daily amount of tips is greater than $80?
A good manager will accomplish more by spending two hours at his desk than talking for...
A good manager will accomplish more by spending two hours at his desk than talking for two hours with subordinates. Do you agree? Why/Why not? When you write, make sure your writing: • addresses all parts of the task • presents a clear position of your argument • presents main ideas • arranges information and ideas coherently • uses cohesive devices effectively • use referencing clearly or appropriately • uses paragraphing logically • uses an adequate range of vocabulary for...
Suppose the government passes a law which says that milk cannot be sold for less than...
Suppose the government passes a law which says that milk cannot be sold for less than $5 per gallon. What do we call this type of policy? Draw two diagrams, one which shows the market for milk with this policy and one that shows the market without the policy. Who is hurt by this policy? Who benefits from this policy? Explain. Is this policy efficient? Explain
The system will accept the employee ID, the employee name and his/her gross salary.
The system will accept the employee ID, the employee name and his/her gross salary.Based on the gross salary provided, if it is equal to or greater than OMR 2500, the system should apply a tax rate of 6% when calculating the income tax otherwise a tax rate of 4% should be applied when calculating.calculate the income tax and the net salary,If (gross salary > = 2500)          Tax rate = 6%Else     Tax rate = 4%Income tax = Net salary = 
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT