There's also an optional "AS" keyword. Perhaps this example that uses it will make things clearer to Phillip:
mysql> SELECT * FROM test;
+----+------+---------------------+
| id | data | ts |
+----+------+---------------------+
| 1 | New | 2014-08-20 18:47:42 |
+----+------+---------------------+
1 row in set (0.00 sec)
mysql> SELECT id, data AS Words, ts AS 'Time Created' FROM test;
+----+-------+---------------------+
| id | Words | Time Created |
+----+-------+---------------------+
| 1 | New | 2014-08-20 18:47:42 |
+----+-------+---------------------+
1 row in set (0.00 sec)
The AS keyword is not required (e.g. "SELECT id, data Words, ts 'Time Created' FROM test;" works exactly the same as the version of the statement that uses AS), but I always include it because I think it makes the aliasing stand out better when trying to read long SQL statements.
As the Manual states, NAME_CONST() is for internal use only: It is not intended for, not needed by, and not supported for end users. Its behaviour and semantics are subject to change without prior warning, which is why you should not rely on it in your applications. Generally, the only place you'll ever see it actually used is in the output of mysqlbinlog.
Here's the example for NAME_CONST() from the Manual:
mysql> SELECT NAME_CONST('myname', 14);
+--------+
| myname |
+--------+
| 14 |
+--------+
You can obtain exactly the same result like this:
mysql> SELECT 14 AS myname;
+--------+
| myname |
+--------+
| 14 |
+--------+
1 row in set (0.00 sec)
Use this. Don't use NAME_CONST().
cheers,
Jon Stephens
MySQL Documentation Team @ Oracle
MySQL Dev Zone
MySQL Server Documentation
Oracle