Counting products per attribute set using SQL (Magento 2)

It can be useful to count how many products belong to each attribute set. The simplest approach in Magento 2 is the following SQL query:

The result lists the number of products assigned to each attribute set.

Getting orders with items that have a certain attribute set (Magento 1)

The following MySQL query returns all Magento orders that have at least one item with attribute set id 9.

Getting the attribute set name of a product (Magento 1)

Use the following code to get a products attribute set name.