AI Reports

Guides › Database reference › Customers

Magento 2 customer_entity table

One row per registered customer account. Guest shoppers aren't here; their details live only on their orders.

Key columns

ColumnWhat it means
entity_idCustomer ID. Orders link to it in sales_order.customer_id.
emailThe login email.
firstname / lastnameThe customer's name.
group_idCustomer group, linking to customer_group.customer_group_id.
website_idThe website the account belongs to (unless accounts are shared across websites).
store_idThe store view it was created in.
default_billing / default_shippingThe default addresses, linking to customer_address_entity.entity_id.
created_atWhen the account was created, in UTC.

Good to know

Example: New customer accounts per month this year, per group

Works on Magento Open Source and Adobe Commerce.

SELECT DATE_FORMAT(c.created_at, '%Y-%m') AS month, g.customer_group_code AS customer_group, COUNT(*) AS customers
FROM customer_entity c
JOIN customer_group g ON g.customer_group_id = c.group_id
WHERE c.created_at >= MAKEDATE(YEAR(NOW()), 1)
GROUP BY month, customer_group
ORDER BY month, customer_group;

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.

This table has the same 29 columns on Magento Open Source and Adobe Commerce.

Foreign keys

All 29 columns (Magento Open Source)

Show all columns
ColumnTypeCan be emptyMagento's description
entity_idint(10) unsignedEntity ID
website_idsmallint(5) unsignedyesWebsite ID
emailvarchar(255)yesEmail
group_idsmallint(5) unsignedGroup ID
increment_idvarchar(50)yesIncrement ID
store_idsmallint(5) unsignedyesStore ID
created_attimestampCreated At
updated_attimestampUpdated At
is_activesmallint(5) unsignedIs Active
disable_auto_group_changesmallint(5) unsignedDisable automatic group change based on VAT ID
created_invarchar(255)yesCreated From
prefixvarchar(40)yesName Prefix
firstnamevarchar(255)yesFirst Name
middlenamevarchar(255)yesMiddle Name/Initial
lastnamevarchar(255)yesLast Name
suffixvarchar(40)yesName Suffix
dobdateyesDate of Birth
password_hashvarchar(128)yesPassword_hash
rp_tokenvarchar(128)yesReset password token
rp_token_created_atdatetimeyesReset password token creation time
default_billingint(10) unsignedyesDefault Billing Address
default_shippingint(10) unsignedyesDefault Shipping Address
taxvatvarchar(50)yesTax/VAT Number
confirmationvarchar(64)yesIs Confirmed
gendersmallint(5) unsignedyesGender
failures_numsmallint(6)yesFailure Number
first_failuretimestampyesFirst Failure
lock_expirestimestampyesLock Expiration Date
session_cutofftimestampyesSession Cutoff Time

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