是否可以将文字字符串添加到列名的前面并紧跟在 SELECT 关键字之后?
Is it possible to add literal character strings to the front of a column name and immediately after the SELECT keyword?
我正在尝试让 table 显示我的信息,这样它就会像下面这样一句话:火箭队有 25 名球员并获得 10% 的折扣。但是,我在尝试显示句子的 The 和 percent 部分时遇到了问题。
这是我到目前为止输入的内容:
SELECT name || ' team has '|| number_of_players || ' players and receives a discount of ' || discount AS "Team Information"
FROM teams;
这就是我得到的结果:
在 SELECT 列表中,您可以在列前后添加文字,即使是第一列和最后一列也是如此:
SELECT
'The ' || name || ' team has '|| number_of_players ||
' players and receives a discount of ' ||
discount || ' percent' AS "Team Information"
FROM teams;
我正在尝试让 table 显示我的信息,这样它就会像下面这样一句话:火箭队有 25 名球员并获得 10% 的折扣。但是,我在尝试显示句子的 The 和 percent 部分时遇到了问题。
这是我到目前为止输入的内容:
SELECT name || ' team has '|| number_of_players || ' players and receives a discount of ' || discount AS "Team Information"
FROM teams;
这就是我得到的结果:
在 SELECT 列表中,您可以在列前后添加文字,即使是第一列和最后一列也是如此:
SELECT
'The ' || name || ' team has '|| number_of_players ||
' players and receives a discount of ' ||
discount || ' percent' AS "Team Information"
FROM teams;