
Hi Rishabh,
Good question — I see where the confusion is coming from.
Your query is counting how many distinct brands exist in the filtered data. Since you're filtering for ByteCore and ZapTech, there are clearly two distinct brands. So COUNT(DISTINCT brand) should return 2 — and it does.
But if you're getting 3 as the result, then the issue might be that you’re actually counting distinct product names, not brands.
If your intention is to count unique products under those brands, you should change the query to this:
SELECT COUNT(DISTINCT name) AS distinct_product
FROM Products
WHERE brand = 'ByteCore' OR brand = 'ZapTech';
This will count the number of different product names from those two brands — for example: keyboard, mouse, and headphone — which would give you 3.
So check what exactly you’re trying to count: brands or product names. That makes all the difference.
If you have more questions, I’m here to help.








