Professional Documents
Culture Documents
The HAVING Condition Is Just Another WHERE Condition That Acts As A
The HAVING Condition Is Just Another WHERE Condition That Acts As A
The HAVING condition works best when you are trying to apply a restrictive condition after a groupi place.
The HAVING condition is just another WHERE condition that acts 'secondary constraint' on the result set
The HAVING condition works best when you are trying to apply a restrictive condition after a groupi place.
mysql> SELECT * FROM employee -> GROUP BY first_name -> HAVING first_name LIKE '%a%';
mysql> CREATE TABLE Employee( -> id int, -> first_name VARCHAR(15), -> last_name VARCHAR(15), -> start_date DATE, -> end_date DATE, -> salary FLOAT(8,2), -> city VARCHAR(10), -> description VARCHAR(15) -> ); Query OK, 0 rows affected (0.02 sec) mysql> mysql> create table job ( -> id int,
VARCHAR(20)
mysql> SELECT employee.id,COUNT(*) -> FROM employee JOIN job -> GROUP BY employee.id -> HAVING COUNT(*) > 0 -> ORDER BY COUNT(*) desc;