SQL Select * (all) 语句中显示RowID
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9521556/
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
Displaying RowID in Select * (all) Statement
提问by Marwan ?????
I am trying to display the RowID alongside all columns from a Select * statement.
我试图在 Select * 语句中的所有列旁边显示 RowID。
I am using Oracle with Toad to run the SQL statement.
我正在使用 Oracle 和 Toad 来运行 SQL 语句。
I have two tables that I need to compare, but I do not have any unique identifiers to use when sorting the two tables for comparison. So I thought that using the RowID to sort the two tables in order to compare them could help.
我有两个表需要比较,但是在对两个表进行排序以进行比较时,我没有任何唯一标识符可以使用。所以我认为使用 RowID 对两个表进行排序以比较它们会有所帮助。
Is there a way to add RowID to a Select * statement? I cannot add all the columns names as there are over 50 of them. I will be doing this to multiple sets of tables where the number and name of columns will vary.
有没有办法将 RowID 添加到 Select * 语句中?我无法添加所有列名称,因为其中有 50 多个。我将对多组表执行此操作,其中列的数量和名称会有所不同。
Any help or ideas around this would be greatly appreciated.
对此的任何帮助或想法将不胜感激。
Thanks in advance,
提前致谢,
Marwan
马万
回答by Justin Cave
You can do something like
你可以做类似的事情
SELECT rowid, a.*
FROM table_name a
But I'm not sure that is actually going to help you. Sorting the data on ROWID
is not going to be particularly useful since that is just a physical location on disk. It's just as arbitrary as presenting the data unsorted.
但我不确定这是否真的会帮助你。对数据进行排序ROWID
不会特别有用,因为那只是磁盘上的物理位置。它就像呈现未排序的数据一样随意。