Spatial Query Tutorial

  SELECT id FROM postgis_your_netid  
  WHERE ST_DWithin(geometry, GeomFromText('POINT(-128 49.948)',4326), 5.0);
  SELECT state_name FROM postgis_states_your_netid  
  WHERE ST_DWithin(the_geom, GeomFromText('POINT(-128 49.948)',4326), 5.0);
  select state_name, ST_Area(the_geom) as area from postgis_states_your_netid ORDER BY area desc;
  select state_name, ST_AsText(ST_Centroid(the_geom)) from postgis_states_your_netid;
  SELECT states.state_name FROM 
  postgis_states_your_netid AS states, postgis_states_your_netid AS il 
  WHERE il.state_name like 'Illinois' AND ST_Touches(il.the_geom,states.the_geom);

References