I am creating a table in pgweb Heroku, and get this error "ERROR: pq: syntax error at or near "(""

I am creating a table in pgweb Heroku, and get this error "ERROR: pq: syntax error at or near "(""

这是我的确切查询

CREATE Table Publisher 
(Publisher_Id     Int primary key not null,
Name          varchar(20) not null,  
Address       varchar(50) not null,
Phone         Int(10),
Isbn          varchar(13) references books (Isbn) not null
)

如有任何帮助,我们将不胜感激。

数据类型int不取长度。所以:

create table publisher (
    publisher_id  int primary key,
    name          varchar(20) not null,  
    address       varchar(50) not null,
    phone         int,
    isbn          varchar(13) references books (isbn) not null
);

备注:

  • not null 在主键列上重写

  • int 似乎不是 phone 号码的好选择;您通常需要存储前导 0,或允许特殊字符,例如 +() - int 无法做到这一点。字符串数据类型可能是更好的选择