Manager and inspector query SQL