C h a p t e r 1 0 : S Q L S e r v e r R e p o r t i n g S e r v i c e s 337
The joins between the tables are read from the underlying database schema and
put into place automatically. In this example a change is needed. There are three
dates available in the FactInternetSales table, but only one will be used. Therefore,
the joins between the TimeKey field in DimTime and the DueDateKey and
ShipDateKey fields in FactInternetSales should be deleted. This means that TimeKey
in DimTime will only be tied to OrderDateKey in FactInternetSales.
After selecting these tables, the developer chooses the following fields from the
following tables:
DimCustomer: FirstName, LastName
DimTime: FullDateAlternateKey
DimProductSubcategory: EnglishProductSubcategoryName
DimProduct: EnglishProductName
FactInternetSales: SalesAmount
It??™s certainly possible to add additional fields or combine the first and last names
into a single column, but this example will remain simple in order to drive home a
couple of key points.
As it stands, the query is rather simple in that it only selects a few fields, and then
contains a number of inner joins between the tables. The last step in this example
is for the developer to add some parameters. This can be done by simply adding a
WHERE clause to the query and setting values equal to a parameter name, which
in the case of SQL Server is a name preceded by an at sign (the @ symbol). The
WHERE clause should filter on a product category, a year, and a country.
Pages:
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428