O'Reilly logo

PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition by Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Functions

To wrap up this chapter, you’ll learn about a number of functions that you can use in your MySQL queries. You have already seen two—NOW() and SHA()—but those are just the tip of the iceberg. Most of the functions you’ll see here are used with SELECT queries to format and alter the returned data, but you may use MySQL functions in any number of different queries.

To use any function, you need to modify your query so that you specify to which column or columns the function should be applied.

SELECT FUNCTION(column) FROM tablename
				

To specify multiple columns, you can write a query like either of these:

  • SELECT *, FUNCTION(column) FROMtablename

  • SELECT column1, FUNCTION(column2), → column3 FROM tablename

While the function names ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required