--Data before loading
USE OLAP

SELECT count(*) as products_before_loading FROM products 
SELECT count(*) as countries_before_loading FROM countries 
SELECT count(*) as sales_2016_before_loading FROM sales_2016
SELECT count(*) as sales_2017_before_loading FROM sales_2017

--ETL 
exec ETL 1

--Data after loading
SELECT count(*) as products_after_loading FROM products 
SELECT count(*) as countries_after_loading FROM countries 
SELECT count(*) as sales_2016_after_loading FROM sales_2016
SELECT count(*) as sales_2017_after_loading FROM sales_2017

--More detailed check
SELECT * FROM products
SELECT * FROM countries
SELECT * FROM sales_2016
SELECT * FROM sales_2017

--check retailer type profile
SELECT retailer_type,count(*) as count
FROM ##sales
GROUP BY retailer_type

--Check that we have a product line for all our products
SELECT count(*) as count_nulls
FROM products
WHERE product_line is null


----Clearning the OLTP tables
--USE OLTP
--TRUNCATE TABLE Countries
--TRUNCATE TABLE Products
--TRUNCATE TABLE sales
----Check the data has been removed
--SELECT count(*) FROM products
--SELECT count(*) FROM countries
--SELECT count(*) FROM sales