STARTING

STARTING is an SQL clause used in the WHERE condition to filter the result set. It essentially facilitates pattern matching for strings by comparing the character sequences. Mostly used in databases like Oracle, it is useful when the starting sequence of characters in a column's data is known. This clause is not universally supported across different SQL systems.

Example

STARTING WITH
emp.employee_id = 100
CONNECT BY PRIOR
emp.employee_id = emp.manager_id;

Output

100 | Steven | King | NULL
101 | Neena | Kochhar| 100
108 | Nancy | Greenberg | 101
109 | Daniel | Faviet | 108

Explanation

The STARTING WITH clause in Oracle SQL is used for hierarchal querying. In this example, the query identifies a hierarchy of employees where employee relation starts ‘FROM’ employee_id 100 and moves ‘TO’ the corresponding manager_id. Result set is generated in a tree structure with ‘Starting’ being the root.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.