select as 及 isnull()的解释

来源:互联网 发布:水果作曲软件中文版 编辑:程序博客网 时间:2024/05/20 11:20

select as

给查询对象起个别名。

把查询对像起个别名的作用。 select ID as 用户ID,Name as 用户名 from Table_user


SQL 里面 AS 用法是 给指定一个表(table) 命名。比如SELECT * FROM Employee AS emp这句意思是查找所有Employee 表里面的数据,并把Employee表格命名为 emp。当你命名一个表之后,你可以在下面用 emp 代替 Employee.例如 SELECT * FROM emp.PS: AS多用于 JOIN 语句。(query with nested tables)
</pre><pre id="answer-content-800959615" class="answer-text mb-10" name="code" style="background-color: rgb(255, 255, 255); white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 26px;">isnull()
<pre id="best-content-1293960065" accuse="aContent" class="best-text mb-10" style="margin-top: 0px; margin-bottom: 10px; background-color: rgb(241, 254, 221); padding: 0px; font-family: arial, 'courier new', courier, 宋体, monospace; white-space: pre-wrap; word-wrap: break-word; color: rgb(51, 51, 51); line-height: 24px;">isnull(参数1,参数2)  判断参数1 是否为NULL,如果是 返回参数2 否则返回参数1.isnull(列名,0) :    isnull()函数是用来判断列名是否为null   如果为NUll 则返回0  否则 返回列名的值<>:是不等号 与!= 一样  比如: select 3 where 1<>2 查出来的结果是3   select 3 where 1<>1则查不出结果。 isnull(列名,0)<>0:    先判断 列名是否为null ,然后再与0比较  等于零返回结果为True 否则为False 列如:isnull(3,0) 返回的结果为 3 因为3 不是null.           isnull(null,'空')  返回结果是'空'

                                             
0 0
原创粉丝点击