The invention discloses a data query method and device, and belongs to the technical field of information. The method comprises the following steps that: receiving a data query request, wherein the data query request at least carries ENUM (enumeration) data to be queried; from a pre-established database, inquiring the ENUM data matched with each hierarchy of data of the ENUM data to be queried by hierarchy; in a hierarchy to hierarchy query process, if any one piece of ENUM data in the database is not matched with the data, on an appointed hierarchy, of the ENUM data to be queried, returning a failure message; and if any one piece of ENUM data in the database is matched with each hierarchy of data of the ENUM data to be queried, returning a successful message. By use of the method, all data in the database does not need to be traversed, after the data query request is received, query is carried out in multiple hierarchies of the database to return a query result, query efficiency is improved, resource consumption caused by querying useless resources is avoided, and query cost is greatly saved.