PostgreSQL: Clauses and filters

Share via:

Clauses and filters:

Like clause:

LIMIT Clause:
The LIMIT clause is used to restrict the number of rows returned in the result set. It is useful when you want to retrieve only a certain number of rows.

OFFSET Clause:
It is used in conjunction with the LIMIT clause to skip a specified number of rows before starting to return the result set. It is useful for Implementing pagination.

BETWEEN Clause:
The BETWEEN clause is used to filter rows based on a range of values. It allows you to specify a range by providing a lower and upper boundary, and rows within that range are Included in the result set.

DISTINCT clause:
The DISTINCT clause is used to retrieve unique values from a column or a combination of columns. It eliminates duplicate values and returns only distinct values in the result set.

ORDER BY Clause:
The ORDER BY clause is used to sort the result set based on one or more columns in ascending (default) or descending order.

GROUP BY Clause:
The GROUP BY clause is used to group rows based on one or more columns. It is often used in conjunction with aggregate functions (e.g., SUM, COUNT) to perform calculations on groups of data.

Having Clause:
The HAVING clause is used to filter groups in the result set based on a condition. It is similar to the WHERE clause but is applied after the GROUP BY clause.

UNION Clause:
The UNION clause is used to combine the result sets of two or more SELECT statements into a single result set. It merges rows from different SELECT queries, eliminating duplicates.

UNION ALL Clause:
It is similar to the UNION clause, but unlike UNION, it does not eliminate duplicate rows from the result set.

 

Author    : Prudhvi Teja
LinkedIn  : http://linkedin.com/in/prudhvi-teja-nagabhyru-715052224
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTExperts is always active on social media platforms.
Facebook  : https://www.facebook.com/ktexperts/
LinkedIn    : https://www.linkedin.com/company/ktexperts/
Twitter       : https://twitter.com/ktexpertsadmin
YouTube   :  https://www.youtube.com/c/ktexperts
Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Add Comment