SQL-过滤式字段名称

发布于 2025-02-07 22:23:25 字数 351 浏览 1 评论 0原文

有没有办法只能从选择查询而不是字段名称获取值?

例如:

db=> select url from file where owner='abc' AND name='xyz';

                           url                           
---------------------------------------------------------
 /abc/xyz.com

(1 row)

我只需要'/abc/xyz.com'而不是URL,并且(1行)

我可以在选择命令本身中使用过滤器吗? 如果没有,您能建议我其他选择吗?

Is there a way to get only the value from the Select Query and not the field name?

Ex:

db=> select url from file where owner='abc' AND name='xyz';

                           url                           
---------------------------------------------------------
 /abc/xyz.com

(1 row)

I just need '/abc/xyz.com' and not url and (1 row)

Is there a filter I can use in the Select command itself?
if not, could you please suggest me other options?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安穩 2025-02-14 22:23:25

psql 互动模式,您可以切换到“ of-Ontally”“ tally”使用元命令\ t模式。 手册:

\ t

切换输出列名称标题和行计数的显示
页脚。此命令等于\ pset tubles_only at is
为方便提供。

与非交互模式的选项-t相同。 手册:

-t - 仅元组

关闭列名称的打印和结果行计数页脚等。
这相当于\ t\ pset tubles_only

In psql interactive mode, you can switch to "tuples-only" mode with the meta-command \t. The manual:

\t

Toggles the display of output column name headings and row count
footer. This command is equivalent to \pset tuples_only and is
provided for convenience.

The same is available as option -t for non-interactive mode. The manual:

-t --tuples-only

Turn off printing of column names and result row count footers, etc.
This is equivalent to \t or \pset tuples_only.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文