Introduction
In this project, you will learn how to use MySQL's built-in functions to retrieve relevant information from the employee table (emp
) in the personnel database. You will practice writing SQL queries to access and manipulate data in a relational database.
ð Preview
MariaDB [personnel]> SOURCE /home/labex/project/multiple_line_function.sql;
+---------------+------------+------------+-------------+
| department_id | max_salary | min_salary | avg_salary |
+---------------+------------+------------+-------------+
| 20 | 3000.00 | 800.00 | 2175.000000 |
| 10 | 5000.00 | 1300.00 | 2916.666667 |
+---------------+------------+------------+-------------+
2 rows in set (0.001 sec)
ðŊ Tasks
In this project, you will learn:
- How to access MySQL using the
sudo
command without a password - How to import data from a SQL file into a MySQL database
- How to write a SQL query to retrieve the department number, maximum salary, minimum salary, and average salary for departments with an average salary of 2000 or more, and sort the results in descending order by department number
ð Achievements
After completing this project, you will be able to:
- Understand how to use MySQL's built-in functions to perform complex data analysis
- Write SQL queries to retrieve and manipulate data from a relational database
- Apply your knowledge of SQL to solve real-world data management problems