Suppose the student relation has an attribute named location of type point, and the classroom relation has
Question:
Suppose the student relation has an attribute named location of type point, and the classroom relation has an attribute location of type polygon. Write the following queries in SQL using the Post GIS spatial functions and predicates that we saw earlier:
a. Find the names of all students whose location is within the classroom Packard 101.
b. Find all classrooms that are within 100 meters or Packard 101; assume all distances are represented in units of meters.
c. Find the ID and name of student who is geographically nearest to the student with ID 12345.
d. Find the ID and names of all pairs of students whose locations are less than 200 meters apart.
Step by Step Answer:
Database System Concepts
ISBN: 9780078022159
7th Edition
Authors: Abraham Silberschatz, Henry F. Korth, S. Sudarshan