The JOIN is used to combine the records from two or more tables. Types of SQL JOIN: SQL INNER JOIN. SQL LEFT OUTER JOIN. SQL RIGHT OUTER JOIN. SQL FULL OUTER JOIN. SQL SELF JOIN. SQL CARTESIAN JOIN or CROSS JOIN.
The HAVING clause is used with the GROUP BY clause and filter the groups created by the GROUP BY clause. Syntax: Example: Output: Position of different clauses in a SQL statement: 1. SELECT 2. FROM 3. WHERE 4. GROUP BY 5. HAVING 6. ORDER BY
The ORDER BY Clause is used to sort the results either in ascending or descending order based on one or more columns. Oracle and some other database sorts query results in ascending order by default. Syntax: Where ASC keyword is used for ascending order and DESC keyword is used for descending order. Example: Output:
The LIKE operator is used in a WHERE clause to retrieve all records of a table whose specified column values match a specified pattern. The percent sign (%) and underscore (_) are two wildcards used in the LIKE operator pattern. The underscore represents a single character and percent sign represents the multiple characters. Syntax: Example: […]
SQL UNION Operator. The UNION operator is used to combine the result sets of two or more SELECT statements. For UNION, every SELECT statement must have the same number of columns with the same data type and must be in the same order. It will return the distinct values by removing the duplicate rows. Syntax: […]
The OR clause is also known as the conjunctive operator and is used to combine multiple conditions in SQL statement. Syntax: In the case of the OR clause any one of the conditions separated by OR should be true. Example: Output:
The AND clause is also known as the conjunctive operator and is used to combine multiple conditions in SQL statement. Syntax: In case of AND clause all conditions should be true. Example: Output: