The following isql query to the pubs2 database finds information on discounts:
select * from discounts
This query produces the following result set:
discounttype stor_id lowqty highqty discount --------------------- ------- ------ ------- --------- Initial Customer NULL NULL NULL 10.500000 Volume Discount NULL 100 1000 6.700000 Huge Volume Discount NULL 1001 NULL 10.000000 Customer Discount 8042 NULL NULL 5.000000
This result set can be represented in XML in many ways. The following is an XML representation produced by ASE Web Services and formatted in SQLX, which is part of the ANSI standard for SQL:
<?xml version="1.0" encoding="UTF-8"> <ws xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <row> <discounttype>Initial Customer</discounttype> <discount>10.5</discount> </row> <row> <discounttype>Volume Discount</discounttype> <lowqty>100</lowqty> <highqty>1000</highqty> <discount>6.7</discount> </row> <row> <discounttype>Huge Volume Discount </discounttype> <lowqty>1001</lowqty> <discount>10.0</discount> </row> <row> <discounttype>Customer Discount</discounttype> <stor_id>8042</stor_id> <discount>5.0</discount> </row> </ws>
The initial line describes the XML version and character encoding. The remaining tags are user-defined and describe both the structure and data of the document. These user-defined tags enable documents to be customized for a specific application, such as one that uses discount information to compute prices.