You work for a company that provides marketing data to other companies.
You have the following TransactSQL
statement:
DECLARE @CustomerDemographics XML
SET @CustomerDemographics=N’
<CustomerDemographics>
<Customer CustomerID=”1″ Age=”21″ Education=”High School”>
<IsCoffeeDrinker>0</IsCoffeeDrinker>
</Customer>
<Customer CustomerID=”2″ Age=”27″ Education=”College”>
<IsCoffeeDrinker>1</IsCoffeeDrinker>
<IsFriendly>1</IsFriendly>
</Customer>
<Customer CustomerID=”3″ Age=”35″ Education=”Unknown”>
<IsCoffeeDrinker>1</IsCoffeeDrinker>
<IsFriendly>1</IsFriendly>
</Customer>
</CustomerDemographics>’
DECLARE @OutputAgeOfCoffeeDrinkers XML
SET @OutputAgeOfCoffeeDrinkers = @CustomerDemographics.query(‘
for $output in /child::CustomerDemographics/child::Customer[
( child::IsCoffeeDrinker[1] cast as xs:boolean )]
return
<CoffeeDrinkingCustomer>
{ $output/attribute::Age \}
</CoffeeDrinkingCustomer>’)
SELECT @OutputAgeOfCoffeeDrinkers
You need to determine the result of the query.
What result should you expect?
A.
<CoffeeDrinkingCustomer Age=”27″ />
<CoffeeDrinkingCustomer Age=”35″ />
B.
<CoffeeDrinkingCustomer Age=”21″ />
C.
<CustomerDemographics>
<Customer>
<CoffeeDrinkingCustomer Age=”21″ />
</Customer>
</CustomerDemographics>
D.
<CustomerDemographics>
<Customer>
<CoffeeDrinkingCustomer Age=”27″ />
</Customer>
<Customer>
<CoffeeDrinkingCustomer Age=”35″ />
</Customer>
</CustomerDemographics>