How do I create a table alias in MySQL(如何在 MySQL 中创建表别名)
问题描述
我正在将 MS Access 应用程序(已将表链接到 MSSQL 服务器)迁移到 MySQL.
I am migrating an MS Access application (which has linked tables to a MSSQL Server) to MySQL.
作为克服一些 MSAccess 表命名问题的一种方法,我正在寻找一种解决方案来添加一个 MySQL 表别名,该别名将指向 MySQL 数据库中的现有表.理想情况下,我想在 mysql 中创建别名dbo_customers",该别名也指向 mysql 中的客户表.
As a means to overcome some MSAccess table naming problems, I am seeking a solution to add a MySQL table alias that will point to an existing table in the MySQL database. Ideally I would like to create the alias 'dbo_customers' in mysql that would point to the customers table also in mysql.
明确地说,我不想在这样的查询中为表名添加别名:
To be clear I am not wanting to alias a table name inside a query like this:
SELECT * FROM customers AS dbo_customers
但我更希望能够发出以下查询:
But rather I would like to be able issue the following query:
SELECT * FROM dbo_customers
并让它从客户表中返回数据.
and have it return data from the customers table.
推荐答案
离我而去
CREATE VIEW dbo_customers AS
SELECT * FROM customers
也许不是最好的解决方案,但应该可以工作,因为视图是可更新的.肯定适用于只读
Maybe not the best solution but should work as the view is updatable. Will definitely work for Read Only
这篇关于如何在 MySQL 中创建表别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 MySQL 中创建表别名


- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- SQL 临时表问题 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01