I will have the following table (say a user table) that will contain this data:
id -- (auto increment)
username -- (unique)
password -- (not relevant to question)
IP address -- (only allowed 10 user creations per day)
request_number -- (number of times a single ip address has inserted into the database)
Is there any way to constrain a database to raise an error upon insert if those factors are not met?
I will be coding in PHP and I would HIGHLY prefer that I did not have to perform two queries, or test events in PHP to meet my goals.
I would like to find a way to meet these goals purely in database schema. Is there a way?
(Please no, "why don't you check with php?" That would be slower than a single transaction and I would like to find a way to do it with mysql table schema and raise an exception if my conditions are not met)
Thanks in advance everyone!