Правильно я понимаю, что в случае 1 вы просто хотите получить количество разных цветов для устройств с одинаковым набором параметров?
SELECT `d`.`generation_id`, `d`.`Name`, `d`.`volume`, `d`.`capacity`,
`d`.`type_of_connector`, COUNT(DISTINCT `c`.`color_id`) AS `color_count`
FROM `device` AS `d`
JOIN `device2color_body` AS `c` ON `c`.`device_id` = `d`.`id`
GROUP BY `d`.`generation_id`, `d`.`Name`, `d`.`volume`, `d`.`capacity`,
`d`.`type_of_connector`
2.
SELECT `generation_id`, `Name`, COUNT(*) AS `count`
FROM (
SELECT DISTINCT `d`.`generation_id`, `d`.`Name`, `d`.`volume`, `d`.`capacity`,
`d`.`type_of_connector`, `c`.`color_id`
FROM `device` AS `d`
JOIN `device2color_body` AS `c` ON `c`.`device_id` = `d`.`id`
) AS `t`
GROUP BY `generation_id`, `Name`