USE OLAP
--Dropping columns
ALTER TABLE ##Countries
    DROP COLUMN F3,F4,F5,F6,F7,F8,F9

--Getting rid of rows
SELECT distinct product_line FROM ##products
SELECT distinct product_line FROM ##products

--blank rows in sales
SELECT count(*) FROM ##sales
WHERE [Date] is null
DELETE FROM ##sales
WHERE [Date] is null
SELECT count(*) FROM ##sales
WHERE [Date] is null

--Modifying datatypes
--Countries table
ALTER TABLE ##Countries ALTER COLUMN country char(120) --change datatype to char(20)
ALTER TABLE ##Countries ALTER COLUMN city char(120) --change datatype to char(20)

--Sales table
ALTER TABLE ##sales ALTER COLUMN [date] date
ALTER TABLE ##sales ALTER COLUMN Retailer_city char(120)
ALTER TABLE ##sales ALTER COLUMN Order_method_type char(120)
--select max(len(urgent)) from ##sales
ALTER TABLE ##sales ALTER COLUMN Urgent char(10)
ALTER TABLE ##sales ALTER COLUMN Retailer_type char(120)
--select max(len(product_code)) from ##sales
ALTER TABLE ##sales ALTER COLUMN Product_code char(15)
ALTER TABLE ##sales ALTER COLUMN Sale_price money
ALTER TABLE ##sales ALTER COLUMN Quantity_sold int

--Check the changes
SELECT * FROM ##countries
SELECT * FROM ##sales
SELECT * FROM ##products