how to get product id and sku in magento with SQL

Abude picture Abude · Feb 8, 2013 · Viewed 24.7k times · Source

i'm trying to get the product id and the SKU of each product in magento with SQL, i fount that the table catalog_product_entity has all the SKUs but no product id.

Answer

Domen Vrankar picture Domen Vrankar · Feb 8, 2013

entity_id is product's unique id so if you call $product->getId(); you actually get entity_id

The reason for that column name is that product is an EAV (Entity Attribute Value) model so product is an entity - standardized EAV entity identification column name but it can bring confusion...

And the query:

SELECT entity_id as product_id, sku FROM catalog_product_entity