Create Unique Key Column in db_schema.xml file Magento 2.

Unique Key column in the database table used to avoid the duplication of data in the same column.

Using a unique column key, Table gives guarantees to unique value for the column from the set of records in a table.

First, we create a simple db_schema.xml file to create a table,

You can add a unique key for the column using constraint xsi:type=“unique” in an XML file.

In Customer_records table, We have defined two columns as unique,
1. coupon_code
2. store_id

You need to pass the below syntax,

Add your unique column under <column /> node to create unique column.

You can add one or multiple unique key columns inside the table.