The paper extends on previously proposed database concepts and their use as mapping point to a database in a domain ontology. It describes the process of constructing SQL queries from them. The proposed database concepts allow for the mapping of domain concept to the sources of data from a database. The paper describes the process of traversing the class hierarchy in an ontology. This is done to gather database concepts and to construct a SQL query. The purpose of the constructed SQL query is to obtain data from a database and to populate the ontology. It is populated with instances related to the selected ontology concept. The described process begins with the selection of one ontology concept, continues with obtaining all directly related concepts from the ontology, filtering and collecting database concepts, and y finishes with constructing the SQL query.