Why Create a New Function?

As you will see from Appendix C, “Function and Operator Reference,” MySQL has an extensive library of functions. However, there may be times when the precise function that your application requires is not present.

What are your options for implementing this function? You have several options:

  • Implement the function in your application code (such as PHP or Perl)

  • Ask the company behind MySQL, MySQL AB, to implement the function as a new native function for MySQL itself

  • Create a new native function for MySQL yourself

  • Write a UDF (user-definable function) for MySQL

The first option—implementing the required function in your application code—is almost certainly the option you will choose most of the time. MySQL applications ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.