数据库系统概念学习笔记
程序员文章站
2022-06-27 11:14:39
...
as关键字
as可以用作别名:
select avg(salary) as avg_salary
from instructor
where dept_name = 'Comp. Sci.';
distinct
select count(distinct ID)
from teachers
where semester = 'Spring' and year = 2010;
group by
"找出每个系在2010年春季学期讲授课程的教师人数"
select dept_name, count(distinct ID) as instr_count
from instructor natural join teachers
where semester = 'Spring' and year = 2010
group by dept_name;
some
"找出满足下面条件的所有教师的姓名,他们的工资至少比Biology系的某一个教师的工资要高"
select distinct T.name
from instructor as T, instructor as S
where T.salary > S.salary and S.dept_name = 'Biology'
或者
select name
from instructor
where salary > some (select salary
from instructor
where dept_name = 'Biology');
some支持 =, < , > , <=, >=, <>
all
all的用法与some类似
exists not exists
空关系测试
unique
重复元组存在性测试
关系范式
简单的理解, 范式即使标准,衡量数据库设计的规范等级,一般地,考虑到BC范式即可。
可以参考知乎上的回答https://www.zhihu.com/question/24696366
上一篇: 36个月不卡!ColorOS 12升级计划公布:支持一加9R
下一篇: 数据库系统概念学习笔记2