Townname for PointOfInterest locations in SQL

Question:

Townname for PointOfInterest locations

Write a query to display the point id, description, town name and state where the pointofinterest is located. Sort the result in the ascending order of point id.

Townname for PointOfInterest locations

Code:

Main.sql

select p.pointID, p.describe,
                          (select townname from town t where p.townid=t.townid ) as townname,
                         (select state from town t where p.townid=t.townid) as state
from PointofInterest p 
order by 1;

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *