在PostgreSQL中创建表 [英] create table in postgreSQL
本文介绍了在PostgreSQL中创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不明白此查询出了什么问题?查询工具不想在PostgreSQL中创建表。
I do not understand what is wrong with this query? Query tool does not want to create a table in PostgreSQL.
CREATE TABLE article (
article_id bigint(20) NOT NULL auto_increment,
article_name varchar(20) NOT NULL,
article_desc text NOT NULL,
date_added datetime default NULL,
PRIMARY KEY (article_id)
);
推荐答案
首先是 bigint(20 )不是null auto_increment
将不起作用,只需使用 bigserial主键
。然后 datetime
是PostgreSQL中的 timestamp
。总而言之:
First the bigint(20) not null auto_increment
will not work, simply use bigserial primary key
. Then datetime
is timestamp
in PostgreSQL. All in all:
CREATE TABLE article (
article_id bigserial primary key,
article_name varchar(20) NOT NULL,
article_desc text NOT NULL,
date_added timestamp default NULL
);
这篇关于在PostgreSQL中创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文