Database Reference
In-Depth Information
The query results appear in Figure 3-24. The column heading for the computed field is the name that
you specified in the SELECT clause.
87
Computed
ield name
Available credit
amounts
FIGURE 3-24
Query results
Computations are not limited to values in number fields. You can combine values in character fields as
well. For example, in Access you can combine the values in the FirstName and LastName fields into a single
computed field by using the & operator. The expression would be FirstName&
&LastName, which places a
space between the first name and the last name. The formal term is that you are concatenating the
FirstName and LastName fields.
In MySQL, you use the CONCAT function to concatenate fields. To concatenate FirstName and
LastName, for example, the expression would be CONCAT(FirstName, LastName).
''
EXAMPLE 13
List the number, name, and available credit for all customers with credit limits that exceed their balances.
The only difference between Examples 12 and 13 is that Example 13 includes a condition, as shown in
Figure 3-25.
Condition
FIGURE 3-25
SQL query with a computed field and a condition
Search WWH ::




Custom Search