Extended Functionality

Both MySQL and mSQL have a few quirky extensions that do not really have counterparts in the other database engine. Most of MySQL’s extensions are generally in line with the ANSI SQL standard. mSQL’s extensions are simply related to special variables you can access while working with an mSQL database.

MySQL Features

MySQL goes well beyond mSQL’s support for SQL by supporting functions and a limited concept of outer joins. Functions in SQL are similar to functions in other programming languages like C and Perl. The function takes zero or more arguments and returns some value. For example, the function SQRT(16) returns 4. Within a MySQL SELECT statement, functions may be used in either of two places:

As a value to be retrieved

This form involves a function in the place of a column in the list of columns to be retrieved. The return value of the function, evaluated for each selected row, is part of the returned result set as if it were a column in the database. For example:

# Select the name of each event as well as the date of the event # formatted in a human-readable form for all events more # recent than the given time. The FROM_UnixTIME() function # transforms a standard Unix time value into a human # readable form. SELECT name, FROM_UnixTIME(date) FROM events WHERE time > 90534323 # Select the title of a paper, the full text of the paper, # and the length (in bytes) of the full text for all # papers authored by Stacie Sheldon. # The LENGTH() function returns ...

Get MySQL and mSQL 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.