I am stuck at what seemed to be a very simple task in MySQL.
I have a table A
with fields A_Id
and A_Name
.
MySQL query - SELECT * FROM A;
Obviously, in the output, the column names are A_Id
and A_Name
. But I want them to be aid
and aname
, that is, eliminating all underscores and converting to lowercase only the column names.
I think this should be possible. Any help/suggestion is appreciated.
EDIT: Why do I need to do this?
I have indexed all these fields in ElasticSearch, and then querying using Spring Data Elastic, using named queries becomes difficult when there are underscores in the field names
I did look around for some answers, but all of them are either ALTER
statements or manipulating the field values using REPLACE
, none of which suit my usecase.
Thanks :)