Get the App
SLTechnology News&Howtos  ›  Database  › 

Sharing of sql statements commonly used in postgresql

Shulou Source: shulou.com Published: 2022-05-31 18:28:08 10月01日 Update

This article mainly introduces "sharing sql sentences commonly used in postgresql". In daily operation, I believe many people have doubts about sharing sql sentences commonly used in postgresql. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "sharing sql sentences commonly used in postgresql". Next, please follow the editor to study!

Sql statement

15 commonly used statements:

1.select relname,relpages from pg_class order by relpages desc

2.selecr pg_database_size ('database name')

3.select pg_size_pretty (pg_total_relation_size ('table name'))

4.\ d Table name

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 (11991000))

10.select count (*) from table, select count (col_name) from table

Select count (distinct column name) 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. Encryption: 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'

At this point, the study of "sharing sql sentences commonly used in postgresql" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Sentences commonly used learning more help practical next data databases articles methods theories knowledge articles websites materials follow questions ease of use encryption Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Apple Redmi NVidia OPPO Reno