Skip to content

Instantly share code, notes, and snippets.

@antoinekociuba
antoinekociuba / m2_get_products_data.sql
Last active November 9, 2022 21:52
Magento 2 - Retrieve some products data (name, price, stock qty, images, categories...) from SQL query. On Magento Commerce versions, you will have to replace `entity_id` by `row_id`.
SELECT e.entity_id AS 'id',
v1.value AS 'name',
e.sku,
d1.value AS 'price',
si.qty AS 'qty',
t1.value AS 'short_description',
t2.value AS 'description',
v2.value AS 'image',
v3.value AS 'thumbnail',
mg.value AS 'media_gallery',
@dfelton
dfelton / 000 - Magento SQL Snippets.md
Last active November 22, 2021 15:15
Useful SQL snippets for a Magento store.

Numerous SQL snippets to reference for pulling data straight from Magento's database.

All SQL snippets assume there is no database table name prefix configured. In the event that your database does have a table nameprefix, you should be able to simply update the original table names found in the "FROM" and "LEFT JOIN" declarations. All table names are aliased therefore a full revision of the SQL snippets would not be necessary.