最近面试,深知作为一个PM,数据库的重要性。
unit1 了解数据库
1.库-database
表-table——列-column,按行存储-row——唯一标志主键-primary key
模式-属性
数据分解,数据类型,数据类型兼容
2.SQL-Structured QueryLanguage(结构化查询语言)
unit2 检索数据-select
1.关键字-keyword,通配符*
2.select p_name,p_price from Prdoucts;
全部——select * from Products;
去重——select distinct p_name from Products;
限制返回行数——select p_name from Products limit 5;
3.注释 -- # /* */
排序检索数据-order by
select p_name from Products order by p_name;
select p_name,p_price from Products order by p_name,p_price;
select p_price from Products order by p_price desc; --降序 --反之升序-asc
过滤数据-where
select p_name from Products where p_name='施‘; --加上操作符,加上单引号!
范围-between A and B
探空-is null
组合where语句
操作符-用来联结或改变WHERE子句中的子句的关键字,也称为逻辑操作符(logical operator)
并,交集-select p_name,p_price from Products where p_name='施‘ and p_price <=5;
合,并集-select p_name,p_price from Products where p_name='施‘ or p_price <=5;
在where中合理使用(),提高优先级
指定条件范围-select p_name from Products where p_name in ('施‘,'军');
否定-...where not p_name='施'; --not=<>
通配符过滤