How to store a custom checkout field in the database?

A post was split to a new topic: What xml file should I add to layout folder and what is the reference container to add a custom field to the checkout page?