Collections:
Assign Names to Query Output Columns in MySQL
How To Name Query Output Columns in MySQL?
✍: FYIcenter.com
Each column in the query output has a default name. If you don't like the default name, you can specify a new name for any column in the query output by using the AS clause. The following statement shows you a good example:
mysql> SELECT tag AS Category, YEAR(created) AS Year, COUNT(*) AS Counts FROM fyi_links GROUP BY tag, YEAR(created) ORDER BY COUNT(*) DESC; +----------+------+--------+ | Category | Year | Counts | +----------+------+--------+ | DBA | 2006 | 2 | | DEV | 2006 | 1 | | SQA | 2006 | 1 | | DBA | 2005 | 1 | | DEV | 2004 | 1 | | SQA | 2003 | 1 | +----------+------+--------+ 6 rows in set (0.00 sec)
⇐ Inner Join with the WHERE Clause in MySQL
2017-09-28, 2642🔥, 0💬
Popular Posts:
How Run SQL*Plus Commands That Are Stored in a Local File in Oracle? If you have a group of commands...
How To Connect to a MySQL Server with a Port Number in MySQL? If you want to connect a MySQL server ...
How Many Groups of Data Types in MySQL? MySQL support 3 groups of data types as listed below: String...
How to obtain the number of rows found by the last SELECT statement using the FOUND_ROWS() function?...
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...