I have two tables:
regions <id>
points <region_id, x, y>
Assuming there are exactly 4 points per region, and these points describe a rectangle -- is there an SQL query that will bring me this view:
rectangular_regions <region_id, x1, y1, x2, y2>
?