2

I know in oracle I can do something like this:

create synonym Cutomers for LongTablePrefix_Customers

Now, I can write sql statements like

select * from Customers

instead of monstrous

select * from LongTablePrefix_Customers

I realized, that mysql have same functionality there. I can create synonim for table and this is nice, but... But fields names are looks like LongTableName_ID, LongTableName_Name etc. Is it possible to create synonyms for fields?

Sharikov Vladislav
  • 7,049
  • 9
  • 50
  • 87
  • possible duplicate of [How to create a synonym in mysql](http://stackoverflow.com/questions/15777420/how-to-create-a-synonym-in-mysql) – MrTux Aug 20 '14 at 18:54

2 Answers2

5

You could create a view

create view Customers show select LongTableName_ID as ID, LongTableName_Name as Name from LongTablePrefix_Customers

Synonyms are not possible in MySQL.

MrTux
  • 32,350
  • 30
  • 109
  • 146
0

Create a Data Access Layer in front of your MySQL/MariaDB database and then you can set up multiple routes to the same underlying table or fields. Not a quick solution, and only answers your question in a roundabout way, but it is an option and it works. LoopBack works well for it.