Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
WITH RECURSIVE po (DEPT_NO, DEPARTMENT) AS ( -- Находим отдел, которым напрямую руководит Роберт Нельсон SELECT D.DEPT_NO, D.DEPARTMENT FROM DEPARTMENT D INNER JOIN EMPLOYEE E ON D.MNGR_NO = E.EMP_NO WHERE E.FIRST_NAME = 'Robert' AND E.LAST_NAME = 'Nelson' UNION ALL -- Рекурсивно находим подчиненные отделы SELECT D.DEPT_NO, D.DEPARTMENT FROM DEPARTMENT D INNER JOIN po ON D.HEAD_DEPT = po.DEPT_NO ) SELECT DEPARTMENT FROM po

Stuck with a problem? Got Error? Ask AI support!

Copy Clear