01-PostgreSQL初识

来源:互联网 发布:snmp及编程实现 编辑:程序博客网 时间:2024/05/17 01:50
--查找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;--LIMITselect * 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 BYselect name,"count"(*) from    users  group  by  name;--HAVINGselect name ,"count"(*) from users  group by  name HAVING "count"(*)>1;--likeselect * from users   where   name like '%a%';

0 0