I've tried my best to do my due diligence and search for a solution to this problem, but I couldn't find a suitable answer for this specific use-case.
I have two columns in a table for an order: Packaged_By and Packaged_Time. Both are initialized as NULL fields.
What I want: I want both fields to either 1) have a value that isn't NULL, or 2) leave both fields as NULL.
What I don't want: I do not ever want for there to be a case where one column has a value but where the other column remains NULL. This royally screws up my database integrity.
Unfortunately, I have not been able to figure out how to do this with unique constraints.
My question: Can I use constraints to force both fields as having either data or NULL values simultaneously? Is it possible to use triggers to accomplish this? What am I missing?
Any guidance or direction would be appreciated. Thank you.
Edit: I am using MySQL.