01-PostgreSQL初识

前端之家收集整理的这篇文章主要介绍了01-PostgreSQL初识前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
--查找
SELECT * from  users;
--插入
insert into users values(3,'bb','25','2016-11-29')
--更新
update users set age=24  where  id=1;
--删除
delete  from  users  where id=1;
--LIMIT
select * from  users  limit  1;
--limit偏移  offset  第一个数字表示取几个,第二个数字表示从第几个开始取,与MysqL相反
select  * from  users  limit 2 OFFSET  1;
--over 
select *,"row_number"()   OVER(order by id desc) a  from users ;
--patition,在分区之上
select avg(age) over (PARTITION by name)from users;
--group BY
select name,"count"(*) from    users  group  by  name;
--HAVING
select name,"count"(*) from users  group by  name HAVING "count"(*)>1;
--like
select * from users   where   name like '%a%';
原文链接:https://www.f2er.com/postgresql/194226.html

猜你在找的Postgre SQL相关文章