Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i select all columns except a specific column? [duplicate]

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

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.

like image 850
Moudiz Avatar asked Dec 03 '25 10:12

Moudiz


1 Answers

You can't.

The only thing that comes into my mind is to create a VIEW for your SELECT statement.

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,

SELECT * FROM employeeList
like image 179
John Woo Avatar answered Dec 05 '25 00:12

John Woo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!