1.怎样在一个表中查询指定字段值为null的记录?
最直接想法:select * from 表名 where 字段 = null
测试结果:没有报错,但什么也没有显示出来。
正确答案:select * from 表名 where 字段 is null
2.SQL的ISNULL问题:
使用ISNULL函数,可以使用指定的值替换null
语法如下:ISNULL (
check
_
expression
,
replacement_value
)
即:当查询出的check
_
expression的值为null时,即使用
replacement_value(比如0之类的)替换掉。
注意:第2个参数是和第1个参数同类型的值类型,不能也是表达式,否则会报错。
3.关于case when then 语句:
举例:case when money is null then 0 else money end
即:当字段money的值为null时,使用0进行表示,否则直接money字段的数值。
4.添加页面,控件位置设置“正确”,都已经对齐了,但是运行结果画面却有两个控件没对齐,看着很不舒服。
原因:form窗体在default的语言环境下设置控件的,应该是在中文的环境下进行(将语言环境从default设置成中文后,添加页面显示出,那两个控件果然没有对齐)。
注意:应该是在统一指定的语言环境下进行coding,否则容易出现一些乱七八糟的问题。
分享到:
相关推荐
一、SQL 结构化查询语言 包括DDL(数据定义语言)、DCL(数据控制语言)、 DQL(数据查询语言)、DML(数据操纵语言) 二、SQL的特点 SQL 语句不区分大小写 SQL 语句能输入一行或多行 关键字不能整行缩写或...
substring(),charindex(),PATINDEX(),convert(),case when then end,cast(),ISNULL(),Len(),Replace(),Right()
select type,sum(case vender when 'A' then pcs else 0 end),sum(case vender when 'C' then pcs else 0 end),sum(case vender when 'B' then pcs else 0 end) FROM tablename group by type 显示结果: type ...
Ø 常用查询 MySQL结束符是“;”结束。 1、 显示所有数据库 show databases; 2、 删除数据库 ...Ø select 查询、function 函数 select查询语句用得最广泛、功能也最丰富。可以完成单条记录、多条记录、单表...
select id,case sex when 1 then '女' when 0 then '男' else '未填' end case from students) temp --PL/SQL基础6 循环Loop declare n number(10):=1; cnt number(15):=0; begin loop exit when n>100; --...
结构化查询语言(Structured Query Language)简称SQL,是一种关系数据库查询语言,用于存取数据以及查询、更新和管理关系数据库系统。 1.2 语句结构 1.2.1 数据查询语言(DQL) 对数据库进行的信息查询,select。 ...
update a set aa=null where aa is not null; delete from a where rowid!= (select max(rowid) from a b where a.aa=b.aa); 13、删除同其他表相同的行 delete from a where exits (select \'X\' from b ...
/* –整理者:永恒de影 –整理时间:2010/06/08 –内容:SQL函数的介绍: */ –★★SQL2000查询出各(某)表字段的属性:★★★★★★★★★★★★★★★★★★ SELECT 表名 = case when a.colorder=1 then d.name ...
select type,sum(case vender when 'A' then pcs else 0 end),sum(case vender when 'C' then pcs else 0 end),sum(case vender when 'B' then pcs else 0 end) FROM tablename group by type 显示结果: type ...
select type,sum(case vender when 'A' then pcs else 0 end),sum(case vender when 'C' then pcs else 0 end),sum(case vender when 'B' then pcs else 0 end) FROM tablename group by type 显示结果: type ...
SQL sever 2008 Rar! ?s X祕BwL0 17240671-1.sql ?年3月9日 --1.查询course表的所有信息(所有行所有列) USE Xk GO SELECT * FROM Course --有哪些种类的选修课?学分是多少 USE XK GO SELECT Kind,Credit FROM ...
第三章 Sql查询与函数 一、 SQL概述 SQL(Structured Query Language)结构化查询语言,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统。同时也是数据库脚本文件的扩展名。 SQL...
--(函数nvl() 求出员工的"年薪 + 提成(或奖金)问题") 45、select max(sal) from emp; -- (函数max() 求出emp表中sal字段的最大值) 46、select min(sal) from emp; -- (函数max() 求出emp表中sal字段的最小值) ...
具体的java.sql.Clob, Character[], char[] 和 java.lang.String 将被持久化为 Clob 类型. java.sql.Blob, Byte[], byte[] 和 serializable type 将被持久化为 Blob 类型。 @Lob public String getFullText() { ...