Use the SELECT keyword to query one or more tables and return a result consisting of selected columns and expressions.
The following example select the FirstName and LastName for the Person table.
SELECT Keyword with Expression
Keep in mind you can use columns in formulas to create your own expressions. Here is a query showing a person’s full name. We do this by concatenating the FirstName to LastName.
Processing Order
The select keyword is used with other keyword to form complex SQL statement. When you do this, such as combining SELECT with WHERE and GROUP BY, consider that the database processes the SELECT statement in the following order:
- FROM
- ON
- JOIN
- WHERE
- GROUP BY
- WITH CUBE or WITH ROLLUP
- HAVING
- SELECT
- DISTINCT
- ORDER BY
- TOP
In summary, use the Select keyword to query a table. When doing so, you can combine columns into expressions. As you’re SQL skill’s development, keep in mind SELECT’s processing order, so you understand how the various clauses influence the result.
Additional Resources
To learn more about the IN Operator, check out these useful resources:
- Simple Select Queries
- Looking for a super SQL book? Check out SQL Queries for Mere Mortals.