AI Reports

Magento 2 SQL queries › Products and catalogue

Which products have no description?

Short answer: Descriptions are in catalog_product_entity_text. Find enabled, visible products with no value or only spaces there.

In the Magento admin

  1. Export products in System › Data Transfer › Export and filter the description column for blanks.

With one query

These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.

Magento Open Source

SELECT e.sku, nm.value AS name
FROM catalog_product_entity e
JOIN eav_entity_type t ON t.entity_type_code = 'catalog_product'
JOIN eav_attribute a_status      ON a_status.entity_type_id      = t.entity_type_id AND a_status.attribute_code      = 'status'
JOIN eav_attribute a_visibility  ON a_visibility.entity_type_id  = t.entity_type_id AND a_visibility.attribute_code  = 'visibility'
JOIN eav_attribute a_name        ON a_name.entity_type_id        = t.entity_type_id AND a_name.attribute_code        = 'name'
JOIN eav_attribute a_description ON a_description.entity_type_id = t.entity_type_id AND a_description.attribute_code = 'description'
JOIN catalog_product_entity_int st  ON st.entity_id  = e.entity_id AND st.attribute_id  = a_status.attribute_id     AND st.store_id  = 0 AND st.value = 1
JOIN catalog_product_entity_int vis ON vis.entity_id = e.entity_id AND vis.attribute_id = a_visibility.attribute_id AND vis.store_id = 0 AND vis.value IN (2, 3, 4)
LEFT JOIN catalog_product_entity_varchar nm ON nm.entity_id = e.entity_id AND nm.attribute_id = a_name.attribute_id        AND nm.store_id = 0
LEFT JOIN catalog_product_entity_text    ds ON ds.entity_id = e.entity_id AND ds.attribute_id = a_description.attribute_id AND ds.store_id = 0
WHERE (ds.value IS NULL OR TRIM(ds.value) = '')
ORDER BY e.sku;

Adobe Commerce

Product, category, rule and CMS values are stored per version and joined on row_id (why):

SELECT e.sku, nm.value AS name
FROM catalog_product_entity e
JOIN eav_entity_type t ON t.entity_type_code = 'catalog_product'
JOIN eav_attribute a_status      ON a_status.entity_type_id      = t.entity_type_id AND a_status.attribute_code      = 'status'
JOIN eav_attribute a_visibility  ON a_visibility.entity_type_id  = t.entity_type_id AND a_visibility.attribute_code  = 'visibility'
JOIN eav_attribute a_name        ON a_name.entity_type_id        = t.entity_type_id AND a_name.attribute_code        = 'name'
JOIN eav_attribute a_description ON a_description.entity_type_id = t.entity_type_id AND a_description.attribute_code = 'description'
JOIN catalog_product_entity_int st  ON st.row_id  = e.row_id AND st.attribute_id  = a_status.attribute_id     AND st.store_id  = 0 AND st.value = 1
JOIN catalog_product_entity_int vis ON vis.row_id = e.row_id AND vis.attribute_id = a_visibility.attribute_id AND vis.store_id = 0 AND vis.value IN (2, 3, 4)
LEFT JOIN catalog_product_entity_varchar nm ON nm.row_id = e.row_id AND nm.attribute_id = a_name.attribute_id        AND nm.store_id = 0
LEFT JOIN catalog_product_entity_text    ds ON ds.row_id = e.row_id AND ds.attribute_id = a_description.attribute_id AND ds.store_id = 0
WHERE (ds.value IS NULL OR TRIM(ds.value) = '')
  AND e.created_in <= UNIX_TIMESTAMP() AND e.updated_in > UNIX_TIMESTAMP()
ORDER BY e.sku;

Good to know

Related

Gaurav Harsh

Gaurav Harsh is a Magento developer who works on large Adobe Commerce stores and builds AI Reports, a Magento extension for asking your store's data questions in plain English. LinkedIn