MySQL 这个 SQL 查询中的点是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11484033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What do the dots mean in this SQL query?
提问by Reza M.A
I'm new to MySQL. Can anyone describe lines below which I get theme from the demo of the jqgrid, what is the meaning of a.id? What is the meaning of these dots?
我是 MySQL 的新手。任何人都可以描述我从jqgrid的演示中获得主题的下面几行,a.id的含义是什么?这些点的含义是什么?
$SQL = "SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start , $limit";
You can find the example here: http://trirand.com/blog/jqgrid/jqgrid.htmlin the advanced>Multi select
您可以在此处找到示例:http: //trirand.com/blog/jqgrid/jqgrid.html在高级>多选中
采纳答案by Sir Crispalot
You've asked several questions here. To address the dots:
你在这里问了几个问题。要解决这些点:
In the FROM
clause, a
is used as an alias for the invheader
table. This means you can reference that table by the short alias a
instead of the full table name.
在FROM
子句中,a
用作invheader
表的别名。这意味着您可以通过短别名a
而不是完整的表名来引用该表。
Therefore, a.id
refers the the id
column of the invheader
table.
因此,a.id
指的id
是invheader
表的列。
It is generally considered bad practice to simply give your tables the aliases a
, b
, c
, etc. and I would recommend you use something more useful.
它通常被认为是不好的做法,简单地给你的表的别名a
,b
,c
等,我会建议你使用更有用的东西。
I suggest you read some basic MySQL tutorials as this is a fundamental principal.
我建议你阅读一些基本的 MySQL 教程,因为这是一个基本原则。
回答by sudo55
The dot(.) is used to separate the board scope.So Songs.songId mean that first find the table named Songs and then in the Songs table find the field named songId.
点(.)用于分隔板范围。因此 Songs.songId 表示首先找到名为 Songs 的表,然后在 Songs 表中找到名为 SongId 的字段。