请帮我解决这个问题:给你一个表,包含两列:列是以下之一:
Doctor
Professor
Singer
Actor
Run Code Online (Sandbox Code Playgroud)
编写查询以输出相应occ下面的名称.采用以下格式:
+--------+-----------+--------+------+
| Doctor | Professor | Singer | Actor|
+--------+-----------+--------+------+
Run Code Online (Sandbox Code Playgroud)
名称必须按字母顺序排列.
样本输入
Name Occupation
Meera Singer
Ashely Professor
Ketty Professor
Christeen Professor
Jane Actor
Jenny Doctor
Priya Singer
Run Code Online (Sandbox Code Playgroud)
样本输出
Jenny Ashley Meera Jane
Samantha Christeen Priya Julia
NULL Ketty NULL Maria
Run Code Online (Sandbox Code Playgroud)
注意
当没有更多名称对应于职业时,打印"NULL".
我试过用:
SELECT *
FROM
(
SELECT [Name], [Occupation]
FROM occupations
) AS source
PIVOT
(
max([Name])
FOR [occupation] IN ([Doctor], [Professor], [Singer], [Actor])
) as pvt;
Run Code Online (Sandbox Code Playgroud)
它给出了以下输出:
Priya Priyanka Kristeen Samantha …Run Code Online (Sandbox Code Playgroud) a?: string和a: ?stringFlow 之间有什么区别?
function concat(a: ?string, b: ?string): string {
}
Run Code Online (Sandbox Code Playgroud)
与
function concat(a?: string, b?: string): string {
}
Run Code Online (Sandbox Code Playgroud)