Skip to content

Instantly share code, notes, and snippets.

@clivewalkden
Last active August 2, 2019 16:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clivewalkden/a88aa1fd68513f35b3d598e9c439e1fd to your computer and use it in GitHub Desktop.
Save clivewalkden/a88aa1fd68513f35b3d598e9c439e1fd to your computer and use it in GitHub Desktop.
Useful Magento 2 Database queries
# Display the number of SKUs in a attribute set
SELECT eas.attribute_set_name, COUNT(cpe.sku)
FROM eav_attribute_set AS eas
LEFT JOIN catalog_product_entity AS cpe ON cpe.attribute_set_id = eas.attribute_set_id
WHERE entity_type_id = 4
GROUP BY eas.attribute_set_name
# To see if an email to a user has been successfulyy sent in the sales_order table and sales_shipment table
SELECT s.email_sent AS "Shipment Email Sent", o.email_sent AS "Order Email Sent", s.order_id
FROM sales_shipment AS s
LEFT JOIN sales_order AS o
ON (o.entity_id = s.order_id)
WHERE o.customer_email = 'email@address.com';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment