SELECT Statement, FROM Clause Examples
SQL statement | Description |
SELECT [Last Name], [First Name] | Selects the Last Name and First Name fields of all records in the Employees table. |
SELECT Employees.* | Selects all fields from the Employees table. |
SELECT Orders.[Order ID], | Because the Order ID field appears in both the Orders and Order Details tables, this statement specifies that Order ID be retrieved from the Orders table. Product ID and Price appear only in the Order Details table, so the name of the table doesn't have to be specified. |
SELECT Count("[Postal Code]") | Counts the number of records that have an entry in the Postal Code field and places the title Tally at the top of the column. |
SELECT [Last Name], Salary * 1.1 | Shows what the salary would be if each employee received a 10 percent raise. It does not change the original salary amounts. |
SELECT [Last Name] | Places the title Name at the top of the Last Name column. The title Salary appears at the top of the Salary column. |
SELECT Count(*), Avg(Salary), Max(Salary) | Shows the number of employees and the average and maximum salaries. |
SELECT [Last Name], 'has a salary of', Salary | For each record, shows the Last Name and Salary in the first and last fields. It displays "has a salary of" in the middle field of each record. |