2-02:理解查询模型

查询模型

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;

posted @ 2018-08-29 17:20  智深  阅读(88)  评论(0编辑  收藏  举报
时间会让你变成大师,任何人从来都不缺少天资!