Professional Documents
Culture Documents
Slip16 (Employee Investment) (1 M)
Slip16 (Employee Investment) (1 M)
Consider the following entities and their relationships. Create a RDB in 3 NF with appropriate
data types and Constraints.
Employee (emp_id, emp_name, address)
Investment (inv_no, inv_name, inv_date, inv_amount)
Relation between Employee and Investment is One to Many.
Constraint: Primary key, inv_amount should be > 0.
Solution:
1.Display the details of employee who has invested amount in “Mutual Fund”.
select employee16.emp_id,emp_name,address
from employee16,investment16
where inv_name='Mutual Fund'
and employee16.emp_id=investment16.emp_id;
Output:
select employee16.emp_id,emp_name,sum(inv_amount)
from employee16,investment16
where employee16.emp_id=investment16.emp_id
group by employee16.emp_id,emp_name;
select avg(inv_amount)
from employee16,investment16
where address='Pune'
and employee16.emp_id=investment16.emp_id;