Display labels
You can assign a display label to a computed
or derived data column to replace the default column header expression.
In Figure 1, Figure 3, and Figure 1, the derived data appears
in the expression column. The following query also presents
derived values, but the column that displays the derived values has
the descriptive header taxed.
Figure 1. Query
SELECT stock_num, description, unit_price,
unit_price * 1.07 taxed
FROM stock
WHERE unit_price >= 400;
The result shows that the label taxed is assigned
to the expression in the projection list that displays the results
of the operation unit_price * 1.07.
Figure 2. Query result
stock_num description unit_price taxed
1 baseball gloves $800.00 $856.00
1 baseball gloves $450.00 $481.50
4 football $960.00 $1027.20
4 football $480.00 $513.60
7 basketball $600.00 $642.00
8 volleyball $840.00 $898.80
102 bicycle brakes $480.00 $513.60
111 10-spd, assmbld $499.99 $534.99
112 12-spd, assmbld $549.00 $587.43
113 18-spd, assmbld $685.90 $733.91
203 irons/wedge $670.00 $716.90
In the following query, the label surcharge is
defined for the column that displays the results of the operation total_price
+ 6.50.
Figure 3. Query
SELECT item_num, order_num, quantity,
total_price, total_price + 6.50 surcharge
FROM items
WHERE quantity < 5;
The surcharge column is labeled in the output.
Figure 4. Query result
item_num order_num quantity total_price surcharge
1 1001 1 $250.00 $256.50
1 1002 1 $960.00 $966.50
2 1002 1 $240.00 $246.50
1 1003 1 $20.00 $26.50
2 1003 1 $840.00 $846.50
⋮
1 1023 2 $40.00 $46.50
2 1023 2 $116.00 $122.50
3 1023 1 $80.00 $86.50
4 1023 1 $228.00 $234.50
5 1023 1 $170.00 $176.50
6 1023 1 $190.00 $196.50
The following query assigns the label span to the
column that displays the results of subtracting the DATETIME column call_dtime from
the DATETIME column res_dtime.
Figure 5. Query
SELECT customer_num, call_code, call_dtime,
res_dtime - call_dtime span
FROM cust_calls
ORDER BY customer_num;
The span column is labeled in the output.
Figure 6. Query result
customer_num call_code call_dtime span
106 D 1998-06-12 08:20 0 00:05
110 L 1998-07-07 10:24 0 00:06
116 I 1997-11-28 13:34 0 03:13
116 I 1997-12-21 11:24 5 20:55
119 B 1998-07-01 15:00 0 17:21
121 O 1998-07-10 14:05 0 00:01
127 I 1998-07-31 14:30