How to add new field in customer_entity table magento 2 using db_schema.xml?

You can add a new column/field in customer_entity table using db_schema.xml under your module etc folder from Magento 2.3 and Upper version.

You just need your table name to add a new field or column for that table.

I have added a new field called Nickname of the customer, For add nickname field in the customer table, you need to only add one row inside the db_schema.xml file.

For Customer, Main table is customer_entity where all the customer fields are saved.

and you can add new field in customer_entity table by below way, You just add new field and don’t need to redeclare all the old field using db_schema.xml file.

<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="customer_entity" resource="default" engine="innodb">
        <column xsi:type="varchar" name="nickname" nullable="true" length="40" comment="Nickname"/>
    </table>
</schema>

Run command from Magento root instance,
php bin/magento setup:upgrade
Check the customer_entity table in Database and one new field is display.