How do I create a table alias in MySQL

后端 未结 7 778
忘了有多久
忘了有多久 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:42

    Aliases would be nice, yet MySQL does NOT have such a feature.

    One option that may serve your needs, besides creating a view, is to use the FEDERATED storage engine locally.

    CREATE TABLE dbo_customers (
        id     INT(20) NOT NULL AUTO_INCREMENT,
        name   VARCHAR(32) NOT NULL DEFAULT '',
        PRIMARY KEY  (id),
    )
    ENGINE=FEDERATED
    DEFAULT CHARSET=latin1
    CONNECTION='mysql://fed_user@localhost:9306/federated/customers';
    

    There are currently some limitations with the FEDERATED storage engine. Here are a couple especially important ones:

    • FEDERATED tables do not support transactions
    • FEDERATED tables do not work with the query cache

提交回复
热议问题