diptiranjan pradhan
diptiranjan pradhan

Reputation: 81

Exclude column in redshift spectrum sql queries

In my table having columns col1,col2.....coln

I want to

select all columns except col1

instead of writing select col2,col3.... coln from I can specify

select * from <table name> except col1

Select all column excluding one column

Upvotes: 0

Views: 2941

Answers (1)

kev
kev

Reputation: 2881

You can do something like this-

-- create a temporary copy of your table
SELECT * INTO temp_table FROM original_table;

-- drop the column you don't need
ALTER TABLE temp_table DROP COLUMN col1;

-- select all columns
SELECT * FROM temp_table;

-- drop the temporary table
DROP TABLE temp_table;

Upvotes: 1

Related Questions