查询模型
1.列 看作 变量;
2.列是可以计算的;
3.表达式;(跟在后面的查询条件、过滤等的表达式)
示例:
select name from users where age>=10;
可以形象的看作是下面这样:
let arr = [];
let users = [
{name:'a',age:15},
{name:'b',age:15},
{name:'c',age:9}
];
users.forEach(item=>{
if(item.age >= 10){
arr.push(item.name);
}
});
广义投影
是指列与列之间进行运算得出的结果,叫做广义投影
关于NULL的查询
因为
null 表达的意思是 空;
null == null //false
null != null //false
所以
select * from 表名 where 字段=NULL;
返回的查询结果是空的;
查询值为NULL得有特殊的谓词
两个例子:
select * from 表名 where 字段 is NULL;
select * from 表名 where 字段 is not NULL;