SQL 如何在 Oracle 中选择列,* FROM TABLE?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27965130/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to SELECT Column, * FROM TABLE in Oracle?
提问by Dzyann
I am creating a lot of scripts, and sometimes to check that the tables are being updated as I need, I write on the fly several SELECT statements.
我正在创建很多脚本,有时为了检查表是否根据需要更新,我即时编写了几个 SELECT 语句。
In SQL SERVER you can write something like:
在 SQL SERVER 中,您可以编写如下内容:
SELECT Column1, *
FROM MY_TABLE
This is useful for visibility reasons, however that doesn't seem to work in ORACLE and I don't know how to achieve it, other than writing down all the Column Names manually.
这对于可见性原因很有用,但是这在 ORACLE 中似乎不起作用,我不知道如何实现它,除了手动写下所有列名。
How can you do this in oracle?
你怎么能在oracle中做到这一点?
I know we shouldn't include a query like this in our production scripts, etc. I am just trying to use it on the fly while I am running my scripts in development. At different points I'm more interested to see the information of certain columns, in relation to the other ones, but I still want to see all the columns.
我知道我们不应该在我们的生产脚本等中包含这样的查询。我只是想在开发中运行我的脚本时即时使用它。在不同的点上,我更感兴趣的是查看某些列的信息,以及与其他列相关的信息,但我仍然想查看所有列。
回答by Kim Berg Hansen
SELECT Column1, MY_TABLE.*
FROM MY_TABLE
Or if you give the table an alias:
或者,如果您为该表指定一个别名:
SELECT Column1, T.*
FROM MY_TABLE T
回答by Gordon Linoff
Use an alias:
使用别名:
SELECT Column1, t.*
FROM MY_TABLE t;