0

I am new to SQL Developer. I have to create a view to approach the sample output list below:

enter image description here

The table structure is:

SITE(Site_ID, Region, Description, Latitude, Longitude, Altitude); 
MEASUREMENT(Site_ID, Recorded_On, Name, Value, Outlier_Indicator);

Here is my script, it is working as I followed the advices.

create view Site_Outlier_Incidents AS 
    select 
        Site_ID, Name, Outlier_Indicator,
        count (SITE.Site_ID) as Number_Of_Incidents
    from Site SITE
    left join Measurement MEASUREMENT on MEASUREMENT.site_ID = SITE.Site_ID
    where Name = 'E.Coli'
    group by
        Site_ID, Name, Outlier_Indicator;
6
  • 2
    Typo? You've missed comma: ...Outlier_Indicator, count (SITE.Site_ID).... Commented Sep 7, 2017 at 9:39
  • 1
    And there's an extra right parentheses at the end. Remove it. Commented Sep 7, 2017 at 9:41
  • Use create or replace view instead of alter view. Commented Sep 7, 2017 at 9:45
  • Thanks, I edited all of the typing mistakes but there is still an error report: ORA-00922: missing or invalid option Commented Sep 7, 2017 at 9:48
  • show the edited sql please. You might still have some erros Commented Sep 7, 2017 at 9:53

1 Answer 1

1

Use create or replace view instead of alter view

Sign up to request clarification or add additional context in comments.

2 Comments

May I be able to combine those two statements into one create view statement? How do I approach it?
the syntax is create or replace view view_name as (your query);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.