1 创建一个库,需要在创建的时候说明创建日期,作者以及创建目的
2 在该库下面创建学生表,学生编号,院系,学生姓名,性别,父母信息,家庭住址(省市区街道门牌号),
先按年龄分区,在按照性别分区,根据院系分桶
3 修改表名,修改分区
4 查看按照院系分桶后的最开始桶的数据
create database studentdb with dbproperties(‘createtime’=‘2018-5-2’,‘author’=‘rosy’,‘ttime’=‘19:20’);
create table student(id int,department string,name string,sex int,parents string ,
address STRUCTprovince:string,city:string,qu:string,street:string,men:string COMMENT ‘homeAddress’)
partitioned by(ssage int,sssex int)
clustered by(department)into 4 buckets
row format delimited fields terminated by ‘\t’;
alter table student rename to restudent;
alter table restudent add partition(ssage=‘18’,sssex=‘0’);