Well, one way to approach this would be to have a "Total Licenses" field (number) for each product in a Product table. Then, use the related Licenses (Users) table to assign the keys. Your available licenses becomes:
TotalLicenses - Count ( Licenses::LicenseKey )
Another approach would be to script it, such that when you assign a new license, you decrement the available total by one. But then, you have to do a few things to lock it down:
1) You have to make sure the fields can't be updated except through the script.
2) You have to put in a method for cancelling / pulling back a license - again through a script - that increments the available total.
3) You have to put in a method for manually assigning the total number of available licenses - again through a script - because you can't allow it to be manually edited.
Sounds like a lot of work? Yeah, it is. Better to use the relational nature of the database and just let it work itself.
Thanks Mike! That really helps. Yeah, I was going nowhere fast with the scripting.