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
| Column | What it means |
|---|---|
entity_id | Customer ID. Orders link to it in sales_order.customer_id. |
email | The login email. |
firstname / lastname | The customer's name. |
group_id | Customer group, linking to customer_group.customer_group_id. |
website_id | The website the account belongs to (unless accounts are shared across websites). |
store_id | The store view it was created in. |
default_billing / default_shipping | The default addresses, linking to customer_address_entity.entity_id. |
created_at | When the account was created, in UTC. |
Good to know
- The table also holds password hashes and reset tokens. Never export it whole.
- Extra customer attributes are stored in
customer_entity_varchar,_intand similar tables.
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
store_id→store.store_idwebsite_id→store_website.website_id
All 29 columns (Magento Open Source)
Show all columns
| Column | Type | Can be empty | Magento's description |
|---|---|---|---|
entity_id | int(10) unsigned | Entity ID | |
website_id | smallint(5) unsigned | yes | Website ID |
email | varchar(255) | yes | |
group_id | smallint(5) unsigned | Group ID | |
increment_id | varchar(50) | yes | Increment ID |
store_id | smallint(5) unsigned | yes | Store ID |
created_at | timestamp | Created At | |
updated_at | timestamp | Updated At | |
is_active | smallint(5) unsigned | Is Active | |
disable_auto_group_change | smallint(5) unsigned | Disable automatic group change based on VAT ID | |
created_in | varchar(255) | yes | Created From |
prefix | varchar(40) | yes | Name Prefix |
firstname | varchar(255) | yes | First Name |
middlename | varchar(255) | yes | Middle Name/Initial |
lastname | varchar(255) | yes | Last Name |
suffix | varchar(40) | yes | Name Suffix |
dob | date | yes | Date of Birth |
password_hash | varchar(128) | yes | Password_hash |
rp_token | varchar(128) | yes | Reset password token |
rp_token_created_at | datetime | yes | Reset password token creation time |
default_billing | int(10) unsigned | yes | Default Billing Address |
default_shipping | int(10) unsigned | yes | Default Shipping Address |
taxvat | varchar(50) | yes | Tax/VAT Number |
confirmation | varchar(64) | yes | Is Confirmed |
gender | smallint(5) unsigned | yes | Gender |
failures_num | smallint(6) | yes | Failure Number |
first_failure | timestamp | yes | First Failure |
lock_expires | timestamp | yes | Lock Expiration Date |
session_cutoff | timestamp | yes | Session Cutoff Time |