/* ------------------------------------------------------------------------ */ /* Example -----------------------------------------------------------------*/ /* ------------------------------------------------------------------------ */ /* Print all jobs (each job once). */ \echo Print all jobs (each job once). select distinct e.Job from emp e ; /* ------------------------------------------------------------------------ */ /* Write and test the following queries ----------------------------------- */ /* ------------------------------------------------------------------------ */ /* Print names and jobs of employees with salary at least 2000. */ -- \echo Print names and jobs of employees with salary at least 2000. /* Print names and jobs of employees who work in department 30. */ -- \echo Print names and jobs of employees who work in department 30. /* Print the number of department in which the president works. */ -- \echo Print the number of department in which the president works. /* Print names of employees who were hired between 1 September 1981 and 31 October 1981. */ -- \echo Print names of employees who were hired between 1 September 1981 and 31 October 1981. /* Print names and salaries of managers, sort the output in the descending order of salaries. */ -- \echo Print names and salaries of managers, sort the output in the descending order of salaries. /* Print names, brutto incomes, national insurance contributions, income taxes and netto incomes of employees (subtract 13.4% for national insurance and 19% for income tax). */ -- \echo Print names, brutto incomes, national insurance contributions, income taxes and netto incomes of employees (subtract 13.4% for national insurance and 19% for income tax). /* Print names and the number of working years (since hired) of all employees. */ -- \echo Print names and the number of working years (since hired) of all employees. /* Print names of all employees with the first letters of their department names. */ -- \echo Print names of all employees with the first letters of their department names. /* Print name and "total salary" (total salary = salary + comm) of each employee. (Warning: the column comm may contain NULL values.) */ -- \echo Print name and "total salary" (total salary = salary + comm) of each employee. (Warning: the column comm may contain NULL values.) /* Print jobs of employees who work in Chicago. */ -- \echo Print jobs of employees who work in Chicago. /* Print tuples [Name, City, Coworker] which stand for all employees, their working places and names of their co-workers (employees who work in the same department). */ -- \echo Print tuples [Name, City, Coworker] which stand for all employees, their working places and names of their co-workers (employees who work in the same department). /* Print names, department names and salaries of all employees whose salaries are greater than the lowest salary in department 20. */ -- \echo Print names, department names and salaries of all employees whose salaries are greater than the lowest salary in department 20. /* Print names of employees together with names of their managers. */ -- \echo Print names of employees together with names of their managers. /* Which departments contain all job positions? */ -- \echo Which departments contain all job positions? /* Which departments are empty (have no employees)? */ -- \echo Which departments are empty (have no employees)? /* Which employees manage only clerks? */ -- \echo Which employees manage only clerks? /* Which departments employ no salesmen? */ -- \echo Which departments employ no salesmen? /* Find names of all employees who are subsidiaries of Blake - both direct and indirect subsidiaries. (This query is a tricky one, skip it unless you understand what precisely you are doing.) */ -- \echo Find names of all employees who are subsidiaries of Blake - both direct and indirect subsidiaries. (This query is a tricky one, skip it unless you understand what precisely you are doing.)