Having

The having clause specifies a search condition for a group or cluster. HAVING is often used with the GROUP BY statement to filter groups or clusters based on a certain condition. NOTE: You cannot use column aliases in the HAVING statement because the HAVING clause is evaluated before the SELECT clause. Because column aliases specified Having

Having vs Where

The WHERE clause filters row based on a specified condition. However, the HAVING clause filters groups of rows based on a specified condition. In other words, the WHERE clause applies to rows, while the HAVING clause applies to the group of rows. The query groups according to store_id and calculates how many customer_id rows or Having vs Where

Where Filter

The SELECT statement returns all rows in one or more columns in a table or view. A WHERE clause is used to select rows that meets a given condition. The following comparison and logical operators are used to create the WHERE condition. Operator  Description =  Equals >  Greater than <  Less than >=  Greater than Where Filter

Limit

The LIMIT statement is an optional clause of the SELECT statement that limits the number of rows returned by the query. If you want to skip a few lines before returning row_num rows, use the OFFSET clause after the LIMIT clause as in the following expression. The query skips 4 lines and returns 5 lines Limit

In

The IN operator is used in the WHERE clause to check if a value matches certain values in the list of output. value IN (value1, value2,…) The list of values can be numbers, literals such as string expressions, or the result of a SELECT statement such as: value IN (SELECT column_name FROM table_name); (The query In

Between

The BETWEEN operator is used to match a value with a range of values. The expression returns true if the value is greater than or equal to the low value and less than or equal to the high value, and false otherwise. BETWEEN operator, You can also rewrite it using the ‘greater than or equal Between

Like and ilike

The LIKE and ILIKE operators are used to query data using pattern mappings. The first_name value returns results starting with Jen. After all, the part that comes after Jen is not important. It is a query that returns the first_name values with the letters ‘er’ in them and the corresponding last_name values and sorts them Like and ilike

Select

Select statements is used to query data from tables and views. Example: Column Concatenation The SQL statement returns the values of the first_name and last_name lines in one column, and the email column in the other line. SELECT first_name || ‘ ‘ || last_name, email FROM customer; Alias An alias is given to the column Select