Question: Spatials DB: Consider a database equipped with a Spatial Extender, for which you are given the following DB schema: Employee(eID, e-address, e-city, e-zip, e-age, e-salary)
Spatials DB: Consider a database equipped with a Spatial Extender, for which you are given
the following DB schema:
Employee(eID, e-address, e-city, e-zip, e-age, e-salary)
Company(cID, c-address, c-city, c-zip, founding-year)
Works-for(eID, cID, salary)
Building(bID, useType, b-address, b-city, b-zip, floorPlan)
Located-At(cID, bID)
Lives-In(eID, bID)
Cities(cityName, cityBoundary, population)
You can assume that: (1) the corresponding types for the spatial attributes are as-usual (e.g., floorPlan:
Polygon; cityBoundary: Polygon; segments: LineString) i.e., the types that are available in any
SQL/MM Spatial Extender. (2) the corresponding operators (e.g., intersects) and functions (e.g., area,
perimeter, distance) to be available.
Write the SQL statement for the following queries:
Q1: Retrieve all the employees who reside in the same city as the company that they work for, live in a
building with area (floor plan) < 90m2
, and for whom the distance from the building that they live in to the
work-place building is less than 10km
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
