Home:ALL Converter>Error when creating table using postgresql

Error when creating table using postgresql

Ask Time:2019-03-03T05:42:47         Author:Yacine Bouziane

Json Formatter

i'm new to postgresql i tried to create the following database but i keep getting this error when creating the table "HOTEL" :ERROR: syntax error at or near "position" LINE 4: positions position, and i would like also to know how to querying this table ,thanks.

create type adresse as (
                    numRue INTEGER,
                    NomRue VARCHAR(30),
                    Ville  VARCHAR(30));

create type position as(
                    latitude REAL ,
                    longitude REAL);


create type chambre as(
                   numChambre INTEGER ,
                   typeChambre VARCHAR(30),
                   prix REAL);


create table hotel (
                nom VARCHAR(30),
                Adresse adresse,
                positions position,
                Chambres chambre,
                nbPersonnel INTEGER,
                nbEtoile INTEGER,
                telephone VARCHAR(14));         

Author:Yacine Bouziane,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/54963304/error-when-creating-table-using-postgresql
yy