Simar_Gill
Simar_Gill

Reputation: 1

How do I drop multiple columns from a VIEW in Oracle SQL developer for good

So the script that I have used for creating the view is as follows:

create view Grantson_Samples as  
(  
  select *  
  from MEASUREMENT  
  inner join SCIENTIST using (Scientist_Num)  
  inner join SITE using (Site_ID)  
  inner join MEASUREMENT_TYPE using (Name)  
  where SCIENTIST_NUM = '31415'  
  );  

Don't worry about the stuff in caps (those are other tables). The problem however is that the view generated has all these extra columns that I don't want. How do I drop those? Essentially everything in the red box needs to go.

Thanks and apologies in advance for any mistakes made. Rookie SQL learner here.

Screenshot of the view.

This is all in Oracle SQL Developer.

Upvotes: 0

Views: 863

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269953

Decide on what columns you want to keep. Then:

create or replace view Grantson_Samples as
    select col1, col2, . . .
    from MEASUREMENT inner join
         SCIENTIST
         using (Scientist_Num) inner join
         SITE
         using (Site_ID) inner join
         MEASUREMENT_TYPE
         using (Name)
    where SCIENTIST_NUM = '31415';

Basically, this recreates the view with the columns that you want.

Upvotes: 1

Related Questions