Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
product.description
ORDER BY customer.company_name,
product.name,
product.description;
Now there are zeroes in the result set to show which products had zero sales to
which customers:
company_name product_name product_description quantity amount
======================= ============ =================== ======== =======
Hometown Tee's Sweatshirt Hooded Sweatshirt 24 576.00
Hometown Tee's Sweatshirt Zipped Sweatshirt 0 0.00
Hometown Tee's Tee Shirt Crew Neck 0 0.00
Hometown Tee's Tee Shirt Tank Top 24 216.00
Hometown Tee's Tee Shirt V-neck 0 0.00
State House Active Wear Sweatshirt Hooded Sweatshirt 48 1152.00
State House Active Wear Sweatshirt Zipped Sweatshirt 48 1152.00
State House Active Wear Tee Shirt Crew Neck 0 0.00
State House Active Wear Tee Shirt Tank Top 0 0.00
State House Active Wear Tee Shirt V-neck 60 840.00
The LEFT, RIGHT, and SUBSTR functions all return substrings from a string
parameter. The LEFT function counts characters from the beginning, the
RIGHT function counts from the end, and the SUBSTR function uses a starting
point and a length. If you omit the length parameter from the SUBSTR call, it
takes all the characters up to the end of the string. All three are basic building
blocks for string manipulation processes, and they all work just fine on LONG
VARCHAR parameters. Here is an example to show some variations:
SELECT LEFT ( '12345', 2 ) AS a,
RIGHT ( '12345', 2 ) AS b,
SUBSTR ( '12345', 2, 3 ) AS c,
SUBSTR ( '12345', 2 ) AS d;
Here are the results:
a b c d
==== ==== ===== ======
'12' '45' '234' '2345'
Note: All string functions in SQL Anywhere start counting string positions at
1, not 0. This is SQL, not C; there are no zero-based offsets or zero-byte string
terminators.