@jefrii ,
Schema requires an unique attribute for each data row (records), which is primary key.
If you feel you don't have a dedicated attribute as a primary key in your schema, and to insert a record define autopk="true" . This will create a attribute "id" and auto-sequence for it. So whenever a new record gets inserted, the Primary key (@id) will keeps on incrementing which will be unique.
If your schema have dedicated attribute as primary key, you don't have to use autopk and can use the primary key definition syntax as you mentioned in question part.
<key name="PrimaryKey" internal="true">
<keyfield xpath="@name"/>
</key>
In this case, if you try to insert 2 records with same "name" it will throw an error stating 'duplicate in primary key'
~ ParthaSarathy S~ Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups