Anda di halaman 1dari 17

1

SSMS vs SSIS

 SQL Server Management Studio (SSMS)


 creating databases, design tables, adding
data, updating data and running queries.
 SQL Server Integration Services (SSIS)
 extraction, transformation, and loading (ETL)
of data for data warehousing
Merge Join
 is used to merge two sorted data sets into a
single dataset by executing inner join, left outer
join etc.
 requires sorted data for their inputs. It means
both data flows must be sorted by the columns
to be used as the join condition.
Inner join vs left outer join

Includes rows only when the data


matches between the two tables

Includes all rows from the left table, but


only matching rows from the right table
Conditional Split

 can split data rows to different


outputs or branches depending
on the criteria/condition you
have given.
 Case 1: UK
 Case 2: USA
Union All
Input 1: UK
215 records
Input 1: US
 allows you to combine multiple inputs 584 record
and produce one output.
 Its add inputs to transformation output
one after the other and doesn’t sort
the data nor remove duplicates.

Output: UK & USA


799 records
6
Selecting data

SELECT *
FROM Products

SELECT ProductID, ProductName, Price, ProductDescription


FROM Products

SELECT ProductID, ProductName, Price, ProductDescription


FROM Products
WHERE Price < 60
7
Where

SalesOrderID Line Total SalesOrderID Line Total

1 100 1 400
2 200 1 300
1 300
3 550
2 500

SELECT SalesOrderID, [Line Total]


FROM SalesOrderDetails
Where SalesOderID = 1
8
Where

Salesperson Line Total Salesperson Line Total

Chan 100 Chan 400


Wong 200 Chan 300
Chan 300
Lee 550
Wong 500

SELECT Salesperson, [Line Total]


FROM SalesOrderDetails
WHERE Salesperson=‘Chan';
9
Group by

SalesOrderID Line Total


SalesOrderID SubTotal

1 100 1 400
2 200 2 700
1 300 3 550
3 550
2 500

SELECT SalesOrderID, SUM([Line Total]) AS SubTotal


FROM SalesOrderDetails
GROUP BY SalesOrderID
Order by

SalesOrderID Line Total SalesOrderID Line Total

1 100 3 550
2 200 2 500
1 300 1 300
3 550 2 200
2 500 1 100

SELECT SalesOrderID, [Line Total]


FROM SalesOrderDetails
ORDER BY [Line Total] DESC;
11

Data Warehouse: A Multi-Tiered Architecture

Monitor
& OLAP Server
Other Metadata
sources Integrator

Analysis
Operational Extract Query
DBs Transform Data Serve Reports
Load
Refresh
Warehouse Data mining

Data Marts

Data Sources Data Storage OLAP Engine Front-End Tools


12
OLAP and SSAS

 SSAS : tool to build OLAP database and perform OLAP


(multidimensional) analysis
 OLAP system:
 manages large amount of historical data,
 provides facilities for summarization and aggregation,
 manages information at different levels of granularity.
 OLAP database may contain many cubes
13
Cube

 Cube is the basic unit of storage and analysis in SSAS,


data has been aggregated in the cube
 Solve query problems for huge amounts of data
 Query results can be returned quickly
 In each cube, it contains fact table and dimension tables
(維度) [one or more]
14

Fact table
(with measures)

Dimension
tables (with
dimensions)
15
Other terms

• Fact tables (FT)


• contain the measures (量值) that you would like to analyze or summarize,
such as
• number of units sold,
• sales amount,
• order quantity
• unit price
• Dimension table (DT)
• contains hierarchical data by which you'd like to summarize.
• Each DT must link to FT within the cube, 2 basic OLAP schema:
 Star schema
 Snowflake schema
16
Star Schema

 Every dimension table is related directly to the fact table.


 star schema.
 Fact table contains measures (quantitative data) and FKs

At the center
17
snowflake schema

 Some dimension tables are related indirectly to the fact


table. This is called snowflake schema.

Anda mungkin juga menyukai