数据库
《数据库系统概念》:http://pan.baidu.com/s/1hsiEaVE
小李的数据库之旅(上):http://chuansong.me/n/742733851433
小李的数据库之旅(下):http://chuansong.me/n/753738551331
1、数据库系统的应用
2、数据库系统的目标
How to learn SQL:https://www.quora.com/How-do-I-learn-SQL
Learn the analytic/windowing functions. You probably know SUM() - it's time to learnSUM () OVER (). Tom Kyte's excellent Expert One-On-One Oracle has a thorough chapter on analytic functions in SQL. In many cases, entire subqueries can be replaced with cleverly-used analytic functions. Even if you're not using Oracle, many modern RDBMS support analytic functions and his resource is second-to-none. The book is required reading for anyone who works with databases.
Learn what SQL functions are included with your database. Each database offers a set of string, numeric, aggregation, statistical, and analytic functions. One of the ways I became interested in advanced statistics was by reading the Oracle documentation and learning about the statistical functions supplied with the database.
If your database supports it, write some user-defined functions. Even some procedures. User-defined functions are a terrific way to extend the capabilities of your database.
《Expert One-On-One Oracle》:https://wenku.baidu.com/view/23365148cf84b9d528ea7a37.html
3、分析函数
function 子句
partition 子句
order by 子句
windowing 子句
range 窗口
rows 窗口
specifying 窗口
SQL OLAP Functions:http://web.cs.ucla.edu/classes/spring03/cs240B/notes/guion1.pdf
4、SQL中的OLAP
交叉表
数据立方体
交叉表和关系表
pivot 子句
cube 子句
rollup 子句
grouping 子句
Python实现cube
import itertools var_list = ['a', 'b', 'c'] for i in range(0, len(var_list)+1): for subset in itertools.combinations(var_list, i): print subset
()
('a',)
('b',)
('c',)
('a', 'b')
('a', 'c')
('b', 'c')
('a', 'b', 'c')
Java实现cube
import java.util.LinkedHashSet; import java.util.Set; import com.google.common.collect.Sets; public class GuavaCombinations { public static void main(String[] args) { Set<String> set = new LinkedHashSet<String>(); set.add("a"); set.add("b"); set.add("c"); Set<Set<String>> powerSet = Sets.powerSet(set); for (Set<String> subSet : powerSet) { System.out.println(subSet); } } }
[]
[a]
[b]
[a, b]
[c]
[a, c]
[b, c]
[a, b, c]
5、OLAP的分类
多维OLAP:Multi-Dimensional OLAP,简称MOLAP
关系OLAP:Relational OLAP,简称ROLAP
混合OLAP:Hybird OLAP,简称HOLAP