MySQL Forums
Forum List  »  Newbie

Re: Categorize values of columns
Posted by: Nirgal Nirgal
Date: August 15, 2022 07:33PM

Thanks for the clarification. This is very helpful for my learning process.

I think the first example is quite clear to me.

In regards to the second one,


select Retailer
from stock
where Flavour in ( 11, 44 )
group by Retailer
having count( * ) = 2
order by Retailer ;

+-------------+
| Retailer |
+-------------+
| Carrefour |
+-------------+


I understand that you are using "Where in" to filter for two flavours. But I am wondering how you are eliminating other flavours. For instance. Suppose you have another flavour in which the code is 14. Would this filter not also include this flavor if there is a retailer with 11, 44 and 14?

My question is this is a filter for retailer that only have 11 and 44 or is a filter for retailers that include this 2 flavours but might also have others.

Also I find this part a bit confusing

group by Retailer
having count( * ) = 2

Having count refers to a retailer that appears twice on the column? Is this what you are using to limit the inclusion of other falvours?

Sorry for my lack of knowledge.

Warm Regards,

Options: ReplyQuote


Subject
Written By
Posted
Re: Categorize values of columns
August 15, 2022 07:33PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.