Tough Sql practise questions for interviews involving SELECT queries - Part 2
Consider the following relational schema. An employee can work in more than one department; the pct_time filed of the Works relation shows the percentage of time that a given employee works in a given department. Emp( eid: integer , ename: string , age: integer , salary: real ) Works( eid: integer , did: integer , pct_time: integer ) Dept( did: integer , dname: string , budget: real , managerid: integer ) Write the following queries in SQL: Print the names and ages of each employee who works in both the Hardware department and the Software department. For each department with more than 20 full-time-equivalent employees (i.e., where the part-time and full-time employees add up to at least that many full- time employees), print the did together with the number of employees that work in that department. Print the name of each employee whose salary exceeds the budget of all of the departments that he or she works in. ...