How do I create a table alias in MySQL

后端 未结 7 774
忘了有多久
忘了有多久 2020-12-05 23:08

I am migrating an MS Access application (which has linked tables to a MSSQL Server) to MySQL.

As a means to overcome some MSAccess table naming problems, I am seeki

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 23:34

    there is a simpler solution for MySQL via MERGE table engine:

    imagine we have table named rus_vacancies and need its English equivalent

    create table eng_vacancies select * from rus_vacancies;
    delete from eng_vacancies;
    alter table eng_vacancies ENGINE=MERGE;
    alter table eng_vacancies UNION=(rus_vacancies);
    

    now table rus_vacancies equals to table eng_vacancies for any read-write operations

    one limitation - original table must have ENGINE=MyISAM (it can be easily done by "alter table rus_vacancies ENGINE=MyISAM")

提交回复
热议问题