sql select使用mysql查询浏览器
我想知道为什么当我使用 MySQL 查询浏览器并双击表名时,sql 语句看起来像这样:
SELECT * FROM database.table t;
where t = 表的第一个字母...这个字母的用途是什么?我只是好奇
I am wondering why when I use MySQL Query Browser and double click table names the sql statements look like this:
SELECT * FROM database.table t;
where t = the first letter of the table... What is the purpose of this letter? I am just curious
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
t
是表的别名。在使用以下内容编写查询时它会有所帮助:选择列表中的许多列
(许多)连接,其中写入完整的表名称将不可读
Foo f INNER JOIN Customers c on c.ID = f.CustomerID LEFT JOIN BAR b on b.ID=f.ID
如果您想要同一个表的 2 个以上副本,您可以使用不同的名称为它们别名:
Invoices i LEFT JOIN Invoices i2 on i.ID = i2.MasterInvoiceID
长表/视图名称,持续写入/读取会很麻烦。命名约定有时是罪魁祸首。想象一个数据仓库表,如下所示:
InvoicesThatAreOverdue_Temp_Holding_20101128
这不是必需的,但 MySQL 查询浏览器正在帮助推广别名的使用。希望它可以帮助开发人员编写可读的代码!
The
t
is an alias for the table. It helps when writing queries with :many columns in the select list
(many) joins where writing the full table name would be unreadable
Foo f INNER JOIN Customers c on c.ID = f.CustomerID LEFT JOIN BAR b on b.ID=f.ID
if you wanted 2+ copies of the same table, you could alias them with different names:
Invoices i LEFT JOIN Invoices i2 on i.ID = i2.MasterInvoiceID
long table/view names that would be cumbersome to keep writing/reading. Naming conventions sometimes are the culprit. Imagine a data warehouse table like:
InvoicesThatAreOverdue_Temp_Holding_20101128
It's not required, but the MySQL Query Browser is helping promote the use of aliases. Here's hoping it helps developers write readable code!
这是一个别名,可以让您缩短参考文献
例如
而不是这个
It is an alias that will allow you to shorten your references
For example
Instead of this
它被称为别名:)
It is known as alias :)
这是一个表别名。这是关于使用别名的简短教程。
It's a table alias. Here is a short tutorial on using aliases.
您实际上是在使用快捷方式(别名)为表指定新名称。
当您连接多个表时,表别名对于较大的查询非常有用。
You're actually using a shortcut (alias) to give a new name to the table.
Table aliasing is pretty useful for larger queries when you're joining multiple tables.