oracle 我可以选择除特定列之外的所有列吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16232617/
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
Can i select all columns except a specific column?
提问by Moudiz
test_table:
测试表:
id f_name l_name age
-- --------- -------- ------
I am new to oracle, but if I want to select all the columns I should use
我是 oracle 的新手,但如果我想选择我应该使用的所有列
select * from test_table
however if I want to select all the columns except age I should write
但是,如果我想选择除年龄之外的所有列,我应该写
select id, f_name, l_name from test_table
Is there a way I can select all the columns but disgarding a column or two?
有没有办法可以选择所有列但忽略一两列?
Because in my work busninse there alot of columns and sometimes I don't need to select them all.
因为在我的工作中,有很多列,有时我不需要全部选择它们。
回答by John Woo
You can't.
你不能。
The only thing that comes into my mind is to create a VIEW
for your SELECT
statement.
我唯一想到的是VIEW
为您的SELECT
陈述创建一个。
CREATE VIEW employeeList
AS
SELECT id, f_name, l_name -- <<== select only the column you want to project
FROM test_table;
once your VIEW
is created, you can now use *
against the view,
一旦你VIEW
创建,你现在可以使用*
了这个视图,
SELECT * FROM employeeList