How to change the name of a column in a select in the database?

2

I'm doing a database for a college activity and was asked to show the table by changing the name of the attributes (columns) to " Nome do Cliente " and " Endereco do Cliente ". How can I do this?

Example:

Tabela: nome         >       Saída: Nome do Cliente
Tabela: endereço     >       Saída: Endereço do Cliente
    
asked by anonymous 03.09.2017 / 20:52

2 answers

7

Although your question is not clear enough, I believe this is what you want:

SELECT nome AS 'Nome do Cliente', endereço AS 'Endereco do Cliente' FROM clientes

The AS causes you to rename the column displayed in SELECT , but do not confuse it, it only changes the name in the select view, it does not change the table.

See working in SQLFiddle .

    
03.09.2017 / 22:43
2

It is possible, but when doing query the column names must be wrapped with '(sign of crass)

See the following examples:

The correct:

Theincorrect:

    
03.09.2017 / 21:42