I have a table with GEOMETRY POINT type column. I would like to add two more columns as lat DECIMAL and lng DECIMAL.
How can this be done?
I have this table with column loc POINT NOT NULL.
I want sql script to update corresponding lattitude and longitude values in new added lat and lng columns.
old table
id loc
1 point(18.545000, 81.782800)
2 point(20.545000, 81.782800)
updated table
id loc lat lng
1 point(18.545000, 81.782800) 18.545000 81.782800
2 point(20.545000, 81.782800) 20.545000 81.782800
This doesn't work
update table
set lat = ST_X(loc);
update table
set lng = ST_Y(loc);