gpt4 book ai didi

sql - 搜索 SQL 短语的精确术语

转载 作者:行者123 更新时间:2023-12-04 22:25:18 26 4
gpt4 key购买 nike

我正在尝试记录一些 SQL 并希望获得正确的术语。如果你这样写 SQL;

select child.ID, parent.ID
from hierarchy child
inner join hierarchy parent
on child.parentId = parent.ID

然后你有一个实际的表('层次'),你给了两个名字('父'和'子')我的问题是关于你如何引用带有名称的表的逻辑实体。

你会在这个名字的空白处写什么?

“此查询使用一个表(层次结构),但使用两个 _ (子级和父级)”

[编辑] 在问题中留下了以前的草稿。现在更正了。

最佳答案

在 SQL Server 文档中,该术语是 table_source :

Specifies a table, view, or derived table source, with or without an alias, to use in the Transact-SQL statement



在 BNF 语法中,它是:
<table_source> ::= 
{
table_or_view_name [ [ AS ] table_alias ] [ <tablesample_clause> ]
[ WITH ( < table_hint > [ [ , ]...n ] ) ]
| rowset_function [ [ AS ] table_alias ]
[ ( bulk_column_alias [ ,...n ] ) ]
| user_defined_function [ [ AS ] table_alias ] [ (column_alias [ ,...n ] ) ]
| OPENXML <openxml_clause>
| derived_table [ AS ] table_alias [ ( column_alias [ ,...n ] ) ]
| <joined_table>
| <pivoted_table>
| <unpivoted_table>
| @variable [ [ AS ] table_alias ]
| @variable.function_call ( expression [ ,...n ] ) [ [ AS ] table_alias ] [ (column_alias [ ,...n ] ) ]

关于sql - 搜索 SQL 短语的精确术语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3881961/

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