create view for detecting table with id and related elements