AI Reports

Guides › Database reference › Orders and sales

Magento 2 sales_order_grid table

A flattened copy of each order that powers Sales › Orders in the admin. It's built from sales_order and its addresses and payment.

Key columns

ColumnWhat it means
entity_idThe same ID as sales_order.entity_id.
increment_idThe order number.
statusThe order status code.
store_id / store_nameWhere the order was placed.
customer_email / customer_nameCopied from the order.
billing_name / shipping_nameNames from the order's addresses.
base_grand_total / grand_totalOrder totals.
payment_methodPayment method code.

Good to know

Example: Orders that are missing from the admin order grid

Works on Magento Open Source and Adobe Commerce.

SELECT o.entity_id, o.increment_id, o.created_at
FROM sales_order o
LEFT JOIN sales_order_grid g ON g.entity_id = o.entity_id
WHERE g.entity_id IS NULL
ORDER BY o.entity_id DESC;

Tested on Magento Open Source and Adobe Commerce 2.4.8. Read-only. If your tables have a prefix, add it to each table name.

Extra columns on Adobe Commerce

Adobe Commerce has 29 columns here instead of 28. The extra ones come from these Commerce features:

All 28 columns (Magento Open Source)

Show all columns
ColumnTypeCan be emptyMagento's description
entity_idint(10) unsignedEntity ID
statusvarchar(32)yesStatus
store_idsmallint(5) unsignedyesStore ID
store_namevarchar(255)yesStore Name
customer_idint(10) unsignedyesCustomer ID
base_grand_totaldecimal(20,4)yesBase Grand Total
base_total_paiddecimal(20,4)yesBase Total Paid
grand_totaldecimal(20,4)yesGrand Total
total_paiddecimal(20,4)yesTotal Paid
increment_idvarchar(50)yesIncrement ID
base_currency_codevarchar(3)yesBase Currency Code
order_currency_codevarchar(255)yesOrder Currency Code
shipping_namevarchar(255)yesShipping Name
billing_namevarchar(255)yesBilling Name
created_attimestampyesCreated At
updated_attimestampyesUpdated At
billing_addressvarchar(255)yesBilling Address
shipping_addressvarchar(255)yesShipping Address
shipping_informationvarchar(255)yesShipping Method Name
customer_emailvarchar(255)yesCustomer Email
customer_groupvarchar(255)yesCustomer Group
subtotaldecimal(20,4)yesSubtotal
shipping_and_handlingdecimal(20,4)yesShipping and handling amount
customer_namevarchar(255)yesCustomer Name
payment_methodvarchar(255)yesPayment Method
total_refundeddecimal(20,4)yesTotal Refunded
pickup_location_codevarchar(255)yesPickup Location Code
dispute_statusvarchar(45)yesBraintree Dispute Status

Related tables

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