title: Is putting logic in SQLprocedures/functions (as opposed to PHP/Perl) acceptable?
body: <p>I'm doing a <strong>university-related</strong> database project in which I am asked to design a database (the specifications <strong>explicitly</strong> ask me to throw in at least a few SQL procedures and triggers in it) and stick a little web interface on top of it.</p>
  
  <p>If it matters, I'm modeling a car rental and I'm using MySQL and PHP.</p>
  
  <p>It is very important to note that the whole point of the project is most definitely the database.
  <strong>It's a database project</strong>, period.</p>
  
  <p>Now, I am wondering: should I put as much logic as possible in SQL procedures/functions or not?
  Since it's very much a <em>database</em> project and I'm already putting some logic in it because of the requirements, my answer would tend to be "yes", also because it would be very good for <strong>decoupling</strong> (very hypotetically, if some guy decides to write e.g. a desktop or Android frontend to it, there would be much less chance of having different behaviours between client applications, so it sounds like good design to me).</p>
  
  <p>But what's holding me is that I've <strong>never seen anybody doing that IRL</strong>, I've always seen people writing the logic in C/PHP, so I wonder: <strong>is using SQL procedures for business logic acceptable</strong>?
  Is it good practice?</p>
  
  <p><em>As an example: should I have a SQL procedure called RENT_OUT_CAR or a PHP function called rentOutCar(...) for the purpouse of, well, renting out a car, aka marking its status as "rented", adding a timestamp, removing its association with the garage it was parked in, etc?
  Or consider COMPUTE_TOTAL_COST vs computeTotalCost(), which computes the final price charged to the customer.</em></p>
  
  <p>Thank you all!</p>
  
  <p>P.S.: <strong>ORMs and fancy stuff is explicitly not allowed</strong>, I <em>have</em> to stick to <strong>plain PHP.</strong></p>
  
  <p>P.P.S.: This question looks suspiciously similar, but I think I am operating under very different constraints: <a href="https://stackoverflow.com/questions/3309683/pros-and-cons-of-putting-logic-in-sql">Pros and cons of putting logic in SQL?</a></p>