Mysql function

Hi

I have gone through MySQL functions .

What I don’t understand is where to use function . Can I call a function in SELECT query ?

something like this …

SELECT COLUMN1 , COLUMN2 , myfunc(COLUMN3) from mytable

Can you please tell if this is a valid syntax ? if not how to invoke a function in select query ?

Yes this is the correct syntax. If you look at some of the string functions e.g. substring:


mysql> select substring('abc',1,2);
+----------------------+
| substring('abc',1,2) |
+----------------------+
| ab                   | 
+----------------------+
1 row in set (0.00 sec)

This could easily take a field from a table as a parameter.

Thanks. This is helpful