共計 1075 個字符,預計需要花費 3 分鐘才能閱讀完成。
這篇文章主要介紹“postgresql 常用的 sql 語句分享”,在日常操作中,相信很多人在 postgresql 常用的 sql 語句分享問題上存在疑惑,丸趣 TV 小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”postgresql 常用的 sql 語句分享”的疑惑有所幫助!接下來,請跟著丸趣 TV 小編一起來學習吧!
sql 語句
15 個常用的語句:
1.select relname,relpages from pg_class order by relpages desc
2.selecr pg_database_size(數(shù)據(jù)庫名)
3.select pg_size_pretty(pg_total_relation_size( 表名‘))
4.\d 表名
5.create index name on table using index_type(colum)
6.rollback,commit
7.explain query
8.explain analyze query
9.insert into number(num) values (generate_series(1,1000))
10.select count(*) from table ,select count(col_name) from table,
select count(distinct 列名) from table
11.slect MAX(num) from number_table where num (select MAX(num) from number_table)
12.select MIN(col_name) from number_table where num (select MIN(num) from number_table)
13.select typname,typlen from pg_type where typtype = b
14.\g output_file,select * from table_name,\g
15. 加密:select crypt(sathiys ,gen_salt(md5
16.insert into WU(a1,b1) select generate_series(1,1000000), aa
17.select name,setting,short_desc from pg_settings where name like %scan
到此,關(guān)于“postgresql 常用的 sql 語句分享”的學習就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關(guān)知識,請繼續(xù)關(guān)注丸趣 TV 網(wǎng)站,丸趣 TV 小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>