A view in the database presents a logical view of a table that is different from the actual physical structure of the table. We have used different views in our sample schema to make subsets of rows from the CITY_FURNITURE
table look like tables. A view can also be defined on the result set of a query between two or more tables, for example, we can define a view to look at all the LAND_PARCELS
that are affected by the maintenance work done to a sidewalk
. For this, we define the view land_parcel_sidewalk
as follows:
Create View land_parcel_sidewalk As Select a.fid lp_fid, b.fid sw_fid From land_parcels a, sidewalks b Where sdo_anyinteract(a.geom, b.geom) = 'TRUE'; -- lets find the land_parcels affected by a sidewalk Select * From land_parcel_sidewalk Where sw_fid = 6882;
When the query is executed to find a land_parcel
corresponding to the sidewalk with sw_fid=6882
, a spatial query is executed using the two base tables involved in the view definition. Sometimes...