14 Working with
Now, the title of the column is not very useful. When using concat or other functions, it is
often useful to specify a title for a column when it is displayed.
select concat(album, " by ", artist) as Attribution from albums order by
album
The column will now be titled Attribution . This will make it easier to use that data in a
program like Dreamweaver or a programming language such as PHP.
Formatted dates and times
The dates that MySQL gives you are formatted to be easy to enter and easy to store. They are
not, however, the best format for displaying them to humans. We can format dates with the
date_format() function, and times with the time_format() function. While we do not have
any times in this table, the time_format() function works exactly like the date_format()
function.
select album, artist, date_format(purchasedate, "%W, %M %D, %Y") as date from
albums order by artist, album, purchasedate