Added proper query for self-database