Introduction
In this project, you will learn how to retrieve the maximum and minimum salary for each department in a MySQL database using built-in functions and SQL queries.
ð Preview
MySQL [edusys]> SOURCE ~/project/functionQuery.sql;
+------------+------------+------------+
| dept_name | max_salary | min_salary |
+------------+------------+------------+
| Biology | 72000.00 | 72000.00 |
| Comp. Sci. | 92000.00 | 65000.00 |
| Elec. Eng. | 80000.00 | 80000.00 |
| Finance | 90000.00 | 80000.00 |
| History | 62000.00 | 60000.00 |
| Music | 40000.00 | 40000.00 |
| Physics | 95000.00 | 87000.00 |
+------------+------------+------------+
7 rows in set (0.001 sec)
ðŊ Tasks
In this project, you will learn:
- How to start the MySQL server and import data into the database
- How to write a SQL query to retrieve the maximum and minimum salary for each department
- How to execute the SQL query script in the MySQL command line client
ð Achievements
After completing this project, you will be able to:
- Understand how to use MySQL built-in functions like
MAX()
andMIN()
to retrieve data - Write SQL queries to group and aggregate data based on specific criteria
- Execute SQL scripts in the MySQL command line client
- Apply your knowledge to solve real-world data analysis problems