The questions can come in any order, so make sure you are selecting right option for all questions.
1. Write a query to perform the below Selection Operation.Note: Order the result by employee id
σage≥ 25(employee)
select * from employee where age >=25 order by id
πename,salary(employee)
select ename,salary from employee order by ename
πid(employee) ∪ πemployeeid(leavedetails)
select id from employee union select employee_id from leave_details
πid(employee) ∩ πemployeeid(leavedetails)
select id from employee intersect select employee_id from leave_details
Note: Order the result by employee id
employee χ department
select * from employee cross join department order by employee.id
Note: Select all columns of employee, works and department table. Order the result by employee id.
employee ⋈ works ⋈ department
select * from employee e join works w on e.id=w.employee_id join department d on d.id = w.department_id order by e.id
employee – leave_details
8. Write a query to perform the below Aggregation Operation.
select id from employee minus select employee_id from leave_details
select avg(salary) as average_salary from employee