How to add column in sales_order table using db_schema.xml Magento 2?

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

We try to add a new column called order_country in sales_order table.

To add order_country field in sales_order table, you need to only add one row inside the db_schema.xml file structure.

Here, the Main table for Sales Operation is sales_order and you can add a new field in sales_order table by the below way,

<?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="sales_order" resource="sales" engine="innodb" comment="Sales Order">
        <column xsi:type="varchar" name="order_country" nullable="true" length="32" comment="Order Country Fullname"/>
    </table>
</schema>

Here New Column type is varchar. We have to store the country name and its text field so we have added varchar as type.

Run command from Magento root instance,
php bin/magento setup:upgrade

Check the sales_order table in Database and one new column is added to the table and you can see new column.