How can I create a temporary row / row in MySQL

1

Hi, I'm trying to make a temporary row in mysql but I can not do it, if you can achieve how to create a column but I do not know how to make a row. Can somebody help me?

This is the original column

 _________________                 ______________      
|   Salario       |               |    AVERAGE   |
 _________________                |____________  |
|   200.000       |               |85585.714286  |
| ________________|               |______________|

^ ------- This is the original result

What I try

This is the desired result -------------------------- ^

What I tried was: select "Average Salary", avg(salary) from EMP_DATA;

And create this

+----------------+--------------+
| Average Salary | avg(salary)  |
+----------------+--------------+
| Average Salary | 85585.714286 |
+----------------+--------------+

I was able to do the column but that is not what I want to do. I want the value of avg(salary) to be below Average Salary like this:

+----------------+
| Average Salary | 
+----------------+
| 85585.714286   | 
+----------------+
    
asked by Katz 27.09.2016 в 20:17
source

2 answers

3

Are you apparently trying to assign an alias to the column?:

SELECT avg(salary) AS 'Average Salary'
FROM EMP_DATA;
    
answered by 27.09.2016 / 20:20
source
1

That is not a temporary row, it is a field that you include in your query, you can make temporary tables, but that is transact sql, the alias what you do is give a more understandable name to the column.

    
answered by 28.09.2016 в 01:55