2. About me
• Education
• NCU (MIS)、NCCU (CS)
• Work Experience
• Telecom big data Innovation
• AI projects
• Retail marketing technology
• User Group
• TW Spark User Group
• TW Hadoop User Group
• Taiwan Data Engineer Association Director
• Research
• Big Data/ ML/ AIOT/ AI Columnist
2
13. SQL 練習
• 查詢 1995-10-11 ~ 1996-07-01 出口國家的訂單筆數?
• 查詢所有銷售紀錄中,銷售業績最好的前三名業務?
13
select shipcountry,count(*) from orders
where orderdate between date('1995-10-11') and date('1996-07-01')
group by 1
select sum(sales_price) as total_sales, firstname from (
select c.firstname,sales_price from orders a
join (select orderid, unitprice*quantity as sales_price from `order details`) b
on a.orderid=b.orderid
join employees c
on a.employeeid=c.employeeid
)d
group by 2
order by 1 desc
14. SQL 練習
• 查詢 1996整年度訂單銷售當中,依照分類(CategoryName)計算
銷售金額
14
select categoryname, sum(sales_price) as total_sales from (
select a.orderid, c.productid, b.unitprice*quantity as sales_price, categoryname from (
select orderid from orders
where year(orderdate)=1996
)a
join `order details` b
on a.orderid=b.orderid
join products c
on b.productid=c.productid
join categories d
on c.categoryid=d.categoryid
)e
group by 1
order by 2
24. ETL on using Python
• ETL 常見的資料整理方式
• drop table if exists
• create temp table
• drop temp table
• select * from table into table
• create table as select
• table join
• select * from table where column in
24
25. ETL on using Python
• 讀取本地端 csv 檔案,透過 Python 進行資料整理,寫入資料庫
• 讀取 MySQL 上的資料表,經過資料整理轉換後,再寫入資料庫
25
etl.ipynb