查询
select (distinct) column, group function(avg(),count(),sum(),min(),max())
from table_name1,table_name2
where(select字句) 等值连接=,非等值连接!=,外连接,自连接(按行过滤,且组函数不能出现在where子句中)
group by column ,group function(select中出现的字段必须在此出现) 分组
having (select字句) 过滤分组后的数据,不能替代where的位置
删表:drop table table_name;
建表:create table table_name(
column type;
.......
)
增加记录:insert into table_name values(*,*,.......)
删除记录:delete from table_name where ****
更新记录:update table set column=**** where ****
实体 约束 实体
主键和外键构成完整性约束的基石。
ORACLE的索引注意点
1.使用不等号 <> !=会进行全表扫描 改成 < or >就能正确使用索引
2.is null 和is not null 会跳过索引 ,最好应该把索引列标记为not null
3 使用函数
4 不匹配的数据类型
innodb不锁表
单点故障
访问速度,国内复杂网络环境 CDN加速
insert异步化
数据压力与峰值:
数据、功能、部署尽可能拆分
SqlMapBaseDAO 分库
架构:
过度设计
数据库:
分库,分表
MySQL proxy
缓存:优先考虑跨级缓存,要考虑Down机的风险
网站哪些事儿(康神):http://video.sina.com.cn/v/b/42166796-1700099614.html
caoz或者曹政