How To Software What Is the Definition of a Database Query? Use an SQL SELECT statement to find the information you're looking for Share Pin Email Print alexsl / Getty Images Software Databases Documents Spreadsheets Presentations Desktop Publishing Graphic Design Animation & Video by Mike Chapple An IT professional with more than 10 years of experience in the fields of databases and cybersecurity. Updated May 23, 2019 73 73 people found this article helpful A database query extracts data from a database and formats it in a readable form. A query must be written in the language the database requires; usually, that language is Structured Query Language (SQL). For example, when you want data from a database, you use a query to request that specific information. Perhaps you have an employee table, and you want to track sales performance numbers. You might query your database for the employee who recorded the highest sales in a given period. The SQL SELECT statement A database query must follow the query format that the database requires. The most common format is the Structured Query Language (SQL) standard query format that many database management systems use. SQL is a powerful language capable of advanced queries. SQL uses a SELECT statement to select specific data. Consider an example based on the Northwind database that frequently ships with database products as a tutorial. Here's an excerpt from the database's employees table: EmployeeID LastName FirstName Title Address City Region 1 Davolio Nancy Sales Representative 507 20th Ave. E. Seattle WA 2 Fuller Andrew Vice President, Sales 908 W. Capital Way Tacoma WA 3 Leverling Janet Sales Representative 722 Moss Bay Blvd. Kirkland WA To return an employee's name and title from the database, the SELECT statement would look something like this: SELECT FirstName,LastName,Title FROM Employees; It would return: FirstName LastName Title Nancy Davolio Sales Representative Andrew Fuller Vice President, Sales Janet Leverling Sales Representative To refine the results further, you might add a WHERE clause: SELECT FirstName,LastName FROM EmployeesWHERE City='Tacoma'; It returns the FirstName and LastName of any employee who is from Tacoma: FirstName LastName Andrew Fuller Note that SQL returns data in a row/column form that is similar to Microsoft Excel, making it easy to view and work with. Other query languages might return data as a graph or chart. The Power of Queries A database has the potential to reveal complex trends and activities, but this power is only harnessed through the use of the query. A complex database consists of multiple tables storing a myriad of data. A query allows you to filter the data into a single table so that you can analyze it more easily. Queries also can perform calculations on your data or automate data management tasks. You can also review updates to your data before committing them to the database. Continue Reading How to Retrieve Data with SQL Queries: SELECT Statement SQL FAQ: Get Answers to Common Structured Query Language Questions Learn How Structured Query Language (SQL) Helps Talk to a Database An Easy Guide to Creating Databases and Tables in SQL Almost Every Web Page You Visit Has SQL Behind It An Intro to Databases That's Suitable for the Brand New Beginner Database Terms You Need to Know How to Select Data Within Ranges in SQL Control Access Permission to Your Database Using DCL The SQL COUNT Function Does Exactly What You Think: It Counts How Do you Join Multiple Tables With SQL Inner Join Statements? Here's How to Create Foreign Keys in Microsoft SQL Server The Fundamental Guide to SQL How Do you Retrieve Data From Multiple Tables With SQL Joins? The 8 Best SQL Books of 2019 How Do You Use TRY...CATCH to Fix SQL Server Errors?