Querying a Database. In database terms, a query is used to retrieve data from the database. Queries are one of the things that make databases so powerful. ... As with many other tasks, you can query a database either programatically or via a user interface.