Isol. L
Isol. L

Reputation: 1

SQL create view statement

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;

Upvotes: 0

Views: 174

Answers (1)

Manarjan Singh Ghai
Manarjan Singh Ghai

Reputation: 123

Use create or replace view instead of alter view

Upvotes: 1

Related Questions