Write a query to display the Manufacturer and number of models as MOBILE_MODEL_COUNT for each manufacturer if and only if the number of models is equal to 3. Sort the result based on the manufacturer in descending order.
Write a query to display the Manufacturer and number of models as MOBILE_MODEL_COUNT for each manufacturer if and only if the number of models is equal to 3. Sort the result based on the manufacturer in descending order.
Without providing data it's really hard to answer that question. Maybe try something like
SELECT
manufacturer,
count(*)
FROM
your_table
GROUP BY
manufacturer
HAVING
count(*) = 3
ORDER BY
manufacturer DESC
Try this as per your explanation.
SELECT manufacturer,count(1) As 'MOBILE_MODEL_COUNT'
FROM TableData GROUP BY manufacturer
HAVING count(1) = 3 ORDER BY manufacturer DESC