1、從表中查詢某一區(qū)間的記錄
SELECT id from house LIMIT 100 OFFSET 20
100是要查詢的條數(shù),20為從開始的偏移量
2、從表中查詢以某個(gè)字符開頭的記錄
SELECT * from house WHERE name LIKE '北%'
3、 刪除重復(fù)數(shù)據(jù)
3.1、統(tǒng)計(jì)重復(fù)數(shù)據(jù)條數(shù)
select distinct houseid , count(*) from hous group by houseid having count(*) > 1
3.2、 刪除重復(fù)數(shù)據(jù)
delete from house where ctid not in (select min(ctid) from house group by houseid)
4 生成時(shí)間序列
SELECT * FROM generate_series('2008-03-01 00:00'::date, '2008-03-04 12:00', '1 days')
參考:
https://blog.csdn.net/zhangzeyuaaa/article/details/50675058