Database Reference
In-Depth Information
Table 6.4
Arithmetic Operators
Arithmetic Operator
Description
+
Addition
-
Subtraction
*
Multiplication
/
Division
Figure 6.26
Use arithmetic operators.
Figure 6.27
Use arithmetic operator in UPDATE statement.
classrooms are increased by 10. You can update the capacities for these classrooms with the code
shown in Figure 6.27.
he operators DISTINCT, ORDER BY, TOP, UNION, and PIVOT can be used to reorga-
nize the records selected by the SELECT-FROM-WHERE statement. You can use the operator
DISTINCT to eliminate duplicated rows, and use ORDER BY to sort the result in an ascending
or descending order. For example, to select the list of distinct student last names in a descending
order, use the code in Figure 6.28.
In the above query, with the keyword DESC, the ORDER BY clause sorts the output in a
descending order. For ORDER BY, the ascending order is the default.
he keyword TOP can be used to select the top-ranked values. For example, to select class-
rooms with two of the highest capacities, you can use the code shown in Figure 6.29.
Search WWH ::




Custom Search