gpt4 book ai didi

mysql - 英文术语 MySQL 查询

转载 作者:IT老高 更新时间:2023-10-28 23:56:07 25 4
gpt4 key购买 nike

我需要有关查询部分的一些“术语”方面的帮助。但不仅查询PARTS,任何“查询相关修辞格”也会很有帮助,我对它们很感兴趣。不仅关于 SELECT s(如下例所示),INSERT小号,UPDATE s 和其他查询。

例如:

SELECT t1.f1, t1.f2, t2.f1 AS f1a, (t2.f2 * 10) AS f2a
FROM talbe1 AS t1
INNER JOIN table2 AS t2 ON (t1.f4 <> t2.f4)
WHERE t1.f3 > t2.f3
LIMIT 100, 9999

我知道:

1) t1, t2 - “表别名”,这里没有错误吗?

2) f1a - “字段别名”,f2a - idk ...也许是“表达式别名”?它们之间有区别吗?有集体命名吗?

3) 100 - “偏移量”

我不确定如何调用:

1) 所有在 SELECT 之间和 FROM : t1.f1, t1.f2, t2.f1 AS f1a, (t2.f2 * 10) AS f2a

2) t1.f3 > t2.f3 “哪里条款”? “健康)状况”?哪个更好?其他变体?

3) (t1.f4 <> t2.f4) “加入条件”?

如果有超过 1 个连接,我也很感兴趣,我可以通过“顺序”或“深度”以某种方式调用它们吗?如果我可以通过“深度”做到这一点,那么 RIGHT JOIN 会怎样? ?

任何其他有趣的“事物命名”以及您的示例都会非常有帮助。像 SELF-JOIN 一样,可能是其他一些有特殊调用的连接,任何你能记住的有趣的东西。

最佳答案

您可能对 the official MySQL syntax 感兴趣不得不说这件事。在我看来,当你试图描述像编程语言术语这样数学的东西时,你永远不能过于正式。

1.

t1.f1被称为 select_expr,在英语中 fudge 发音为“选择表达式”。请注意:

Each select_expr indicates a column that you want to retrieve.

所以另一种不太正式的英文称呼方式可能是“column”。

2.

语法似乎区分了子句条件,其中子句包含关键字WHERE本身,但条件只是里面的普通 SQL 表达式。

The WHERE clause, if given, indicates the condition or conditions that rows must satisfy to be selected. where_condition is an expression that evaluates to true for each row to be selected.

还有

In the WHERE expression, you can use any of the functions and operators that MySQL supports, except for aggregate (summary) functions. See Section 9.5, “Expression Syntax”

3.

来自不同的syntax documentation page

MySQL supports the following JOIN syntaxes for the table_references part of SELECT statements

所以关于哪些表的整个部分 SELECT from 被称为“表引用”。从这里我们可以深入研究与您上面的示例匹配的生产的语法:

join_table: table_reference [INNER | CROSS] JOIN table_factor [join_condition]

这意味着您所指的部分包含在“连接条件”中。然而,与 WHERE 一样上面的子句,连接条件还包含 ON关键词。实际表达式(t1.f4 <> t2.f4)又是一个普通的 conditional_expr或“条件表达式”,就像 WHERE 中的那个上面的条款。

此文档页面中的一些更多详细信息产生了宝贵的见解:

The conditional_expr used with ON is any conditional expression of the form that can be used in a WHERE clause. Generally, you should use the ON clause for conditions that specify how to join tables, and the WHERE clause to restrict which rows you want in the result set.

因此,您可以通过调用您的 WHERE 以一种有用且有意义的方式非正式地区分它们。条件“行限制表达式”和 JOIN condition 一个“连接条件表达式”。

关于mysql - 英文术语 MySQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31699426/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com