What are the sql features of postgresql database
This article mainly introduces "what are the sql features of postgresql database". In the daily operation, I believe that many people have doubts about the sql features of postgresql database. 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 "what are the sql features of postgresql database?" Next, please follow the editor to study!
-- SQL advanced features-- with query, cte (common table expressions), with query define an auxiliary statement in a complex query. This feature is often used in complex queries or ground cabinet query application scenarios, such as with t as (select generate_series (1 from 3)) select * from t. -- in the above statement, the auxiliary statement t is defined. Then query t in the main query statement. Complex statements such as with regional_sales as (select region,sum (amount) as total_sales from orders group by region), to_regions as (select region from regional_sales where total_sales > (select sum (total_sales/10 from regional_sales)) select region,product,sum (quantity) as product_units,sum (amount) as product_sales from orders where region in (select region from top_regions) group by region,product Recursive query cte,recursive attribute can refer to its own output, such as with recursive t (x) as (select 1 union select x attribute 1 from t where x)