Use X(), Y() functions with point type : X « Geometric « SQL / MySQL






Use X(), Y() functions with point type

    
mysql>
mysql> CREATE TABLE cities (
    ->   id int(11) ,
    ->   pt point NOT NULL default '',
    ->   zip int(11) default NULL,
    ->   country varchar(10) default NULL,
    ->   state char(2) default NULL,
    ->   city varchar(100) default NULL,
    ->   district varchar(100) default NULL
    -> );
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql>
mysql>
mysql> SELECT X(pt), Y(pt) FROM cities
    -> WHERE city='Innsbruck' LIMIT 1 INTO @x0, @y0;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>
mysql> SELECT @x0, @y0;
+------+------+
| @x0  | @y0  |
+------+------+
| NULL | NULL |
+------+------+
1 row in set (0.00 sec)

mysql>
mysql>
mysql> drop table cities;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
  








Related examples in the same category