Using point data type in insert statement : Point « Data Type « PostgreSQL






Using point data type in insert statement


postgres=# CREATE TABLE emp (
postgres(#    name        text,
postgres(#    salary      numeric,
postgres(#    age         integer,
postgres(#    cubicle     point
postgres(# );
CREATE TABLE
postgres=#
postgres=# insert into emp (cubicle) values (point(0,0));
INSERT 0 1
postgres=# insert into emp (cubicle) values (point(2,1));
INSERT 0 1
postgres=#
postgres=#
postgres=# SELECT *
postgres-#    FROM emp
postgres-#    WHERE emp.cubicle ~= point '(2,1)';
 name | salary | age | cubicle
------+--------+-----+---------
      |        |     | (2,1)
(1 row)

postgres=#
postgres=#
postgres=# drop table emp;
DROP TABLE
postgres=#
           
       








Related examples in the same category

1.Create table with point data type
2.Use Point data type in insert statement
3.Using Point data type in a function