美文网首页
postgresql简单实战

postgresql简单实战

作者: 舒小贱 | 来源:发表于2017-11-09 13:11 被阅读0次

一:创建表

语法

CREATE TABLE table_name(  
   column1 datatype,  
   column2 datatype,  
   column3 datatype,  
   .....  
   columnN datatype,  
   PRIMARY KEY( one or more columns )  
);

例子:

create table if not exists user_role(
id serial not null,
name character varying(255) not null default ''::character varying,
description text,
rights json,
create_time timestamp(6) without time zone,
primary key(id)
);

二:group by
group by子句通过多个记录收集数据,并将结果分组到一个或多个列。它也用于减少输出中的冗余。

待续。。。

相关文章

网友评论

      本文标题:postgresql简单实战

      本文链接:https://www.haomeiwen.com/subject/ljrpmxtx.html