Get the App
SLTechnology News&Howtos  ›  Database  › 

Grouping query method of oracle

Shulou Source: shulou.com Published: 2022-05-31 18:38:34 10月04日 Update

This article mainly explains "the grouping query method of oracle". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the grouping query method of oracle.

Group query, use of statistical functions

02. Find out how many records there are in the emp table.

03. Query the emp table for each department's department code, sum of salaries, and average salary.

04. Query the department code and number of departments whose number of departments is greater than or equal to 2 in the emp table.

05. Query the department code and average salary of the departments whose average salary is less than or equal to 2000 in the emp table, and sort the average salary from large to small.

06. Query the department code and average salary of the departments whose total salary is greater than or equal to 1000 in the emp table, and sort the average salary from large to small.

07. Query the names and salaries of the employees with the lowest and highest salaries in the emp table, and sort them by salary from largest to smallest.

08. List all kinds of jobs with a minimum salary greater than 1500 and the total number of employees engaged in this job.

09. List the names and salaries of all employees whose salary is equal to the salary of the 30 employees in the department.

10. List the number of employees working in each department, average salary, and average length of service.

11. List the minimum wage for each job and the names of the employees engaged in the job.

twelve。 List the minimum salary of MANAGER (managers) in each department.

13. List the annual salary of employees, sorted by annual salary from low to high.

14. Inquire about the maximum, minimum, average and sum of the company's employees' wages.

15. Query the maximum, minimum, average and sum of wages of employees in each job.

16. Select the number of employees for each job (hint: group job).

17. Inquire about the gap between the maximum wage and the minimum wage.

18. Query the bonus of employees in the emp table. If there is no bonus, the default is 0. Use case when.

19. Salary below 2000 'poor' 2000-3000 'medium', 3000-5000 'good', more than 5000 'excellent'

two。 Row transfer column 10 20 30

3 5 6

At this point, I believe you have a deeper understanding of the "grouping query method of oracle". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Query department salary employee salary grouping salary work method minimum number code sort maximum name minimum content bonus average sum Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Microsoft Shulou Technology Huawei