Filter Data Using the Having Clause
The reason for having a database is to have vast amounts of data organized and readily available. SQL is the means by which we can communicate with the database and tell it to find exactly what we need. From thousands of records, we can filter it down to precisely what we are searching for, granted if the database schema was created efficiently.
Let’s look at an example, using the HAVING clause. Let’s say we wanted to search for all employees who have an average salary of $50,000.
*Note, when using HAVING you always have to incorporate GROUP BY filtering.
Here’s how we would do it.
SELECT employee, AVG(salary)
FROM employee_data
GROUP BY employee
HAVING AVG(salary) > 50000;
See how used the AVG aggragate function to get the average salaray?
You can also find this information using the WHERE clause.
Update,Change, Delete Data QueryInserting Data into SQL TablesHow to Concantenate Strings















