4 ms·
> the logic is in how the rows and columns are updated, which takes place (and should) in the "application", not the "storage mechanism". Business logic is any
by taffer 7y ago
> the logic is in how the rows and columns are updated, which takes place (and should) in the "application", not the "storage mechanism".
Business logic is any logic that exists to encode business requirements[1], everything else is just plumbing.
If there is a requirement that each product must have a category, then you need business logic to enforce this. If there is a requirement that a price must not be negative, then that is business logic. Where to put this logic? I would put it in the database.
> What I imagine is that because SQL was not originally conceived to be a turing complete language, the possibility of having your business logic in the database was simply not there.
SQL is based on relational algebra, which is based on first order logic. So it is perfect for business logic [2] and it rarely takes a turing complete language to implement business requirements.
[1] https://en.wikipedia.org/wiki/Business_logic https://en.wikipedia.org/wiki/Business_logic
[2] https://www.vertabelo.com/blog/notes-from-the-lab/business-logic-in-the-database-yes-or-no-it-depends https://www.vertabelo.com/blog/notes-from-the-lab/business-l...