在理解这个SQL语法时遇到问题

时间:2022-02-06 18:22:37

I am having a problem understanding this query syntax:

我在理解这个查询语法时遇到问题:

SELECT p.id, p.ProductName, p.Color, psl.Price, psl.Quantity, psl.Discount  

What does psl stands for? I haven't been able to find explanation elsewhere. (Sorry if the question is stupid or on the wrong forum, I've been coding for 21 hours in a row :( )

psl代表什么?我无法在其他地方找到解释。 (对不起,如果问题是愚蠢的或在错误的论坛上,我已连续21小时编码:()

2 个解决方案

#1


The psl is an alias for said table, rather than forcing your syntax to be the full name of the table.

psl是所述表的别名,而不是强制您的语法是表的全名。

#2


Those appear to be aliases for the actual table name and should be specified in your FROM and/or JOIN clauses. For instance, a complete query with that syntax might be:

这些似乎是实际表名的别名,应在FROM和/或JOIN子句中指定。例如,具有该语法的完整查询可能是:

SELECT p.id, p.ProductName, p.Color, psl.Price, psl.Quantity, psl.Discount  
FROM MyDatabase.dbo.SomeTableName AS p
JOIN MyDatabase.dbo.ARelatedTable AS psl
    ON p.id = psl.pid
WHERE p.id = 12345

#1


The psl is an alias for said table, rather than forcing your syntax to be the full name of the table.

psl是所述表的别名,而不是强制您的语法是表的全名。

#2


Those appear to be aliases for the actual table name and should be specified in your FROM and/or JOIN clauses. For instance, a complete query with that syntax might be:

这些似乎是实际表名的别名,应在FROM和/或JOIN子句中指定。例如,具有该语法的完整查询可能是:

SELECT p.id, p.ProductName, p.Color, psl.Price, psl.Quantity, psl.Discount  
FROM MyDatabase.dbo.SomeTableName AS p
JOIN MyDatabase.dbo.ARelatedTable AS psl
    ON p.id = psl.pid
WHERE p.id = 12345