Some more queries, due MONDAY, APRIL 16 (was April 13). These involve the NamanNavan database. Each question is to be answered with a single (though possibly nested) SQL query. (Helper functions defined in PL/SQL are allowed for convenience.) 1. For each department, list the employee with the most seniority (earliest hire date). 2. Give a table of departments and the number of employees in each EMPLEVEL, eg DEPT Level 1 Level 2 Level 3 Level4 10 0 1 1 1 20 0 0 2 0 ... 3. For each department, list the employee (by name) with the highest qualification, and also list the dept name and that qualification. (Ties, if any, can be resolved by any method.) 4. List all employees whose supervisor is NOT the same as their dept manager. Also list the name of the supervisor, the name of the dept manager, and a column indicating (eg TRUE/FALSE) whether the employee *is* the dept manager. 5. List departments that have employees at every QUALIFICATION level. (I will provide additional records so that this can be a non-NULL answer.) 6. List departments that have employees at every EMPLEVEL. (I will provide additional records so that this can be a non-NULL answer.) 7. List, for each employee, whether they are married (YES if so, blank if not), and the number of children (blank if 0). Use the DEPENDENT table. ------------------------------------------------------------------- For problems 5 and 6 I agreed to provide additional records to ensure non-null results. Here are records to add employees to FINANCE (10) at levels 4,5 and to infosys (20) at levels 2,3,5 insert into employee values (601, 'Page', 'Larry', 3, 111, '12-mar-2007', 26000, null, 20, 2); insert into employee values (602, 'Brin', 'Sergey', 3, 111, '12-mar-2007', 24000, null, 20, 3); insert into employee values (603, 'Ballmer', 'Steve', 3, 111, '27-mar-2007', 190000, null, 20, 5); insert into employee values (604, 'Price', 'Robert', 4, 111, '10-mar-2006', 50000, null, 10, 4); insert into employee values (605, 'Lloyd', 'Sam', 4, 111, '10-mar-2006', 20000, null, 10, 5); To undo, delete from employee where employeeid >= 600; -- The following gives a list of departments and their qualifications. select unique d.deptname, d.deptid, q.qualdesc, q.qualid from dept d, qualification q, employee e where e.deptid = d.deptid and e.qualid = q.qualid order by d.deptid, q.qualid;