‘壹’ sql语句:如何查询出一张表中所有字段里面内容为空
是mysql吗 可以这样 比如你有一个文本 文本里有两列数据用逗号隔开 然后你就可以用 load data infile '文件路径' into table tablename fields terminated by ',' lines terminated by '\n' (col1,col2) 别的字段不管就好了,当然你的表设计时候就需要默认为null
‘贰’ sql语句怎么能把考试成绩为空的,不算考试了一次
这样
select学生姓名,count(成绩)fromtablegroupby学生姓名
如果成绩为空,则不计次数,你试验一下
‘叁’ sql怎么查询为空值的数据
sql查询空值的字段写法:SELECT A.字段 FROM student A WHERE A.字段 LIKE'% %' (student为表名)
查询类似空值的写法:
1、查询名称有退格键:select * from t_bd_item_info where charindex(char(8),item_name) > 0 go
2、查询名称有制表符tab:select * from t_bd_item_info where charindex(char(9),item_name) > 0 go
3、查询名称有换行:select * from t_bd_item_info where charindex(char(10),item_name) > 0 go
4、查询名称有回车:select * from t_bd_item_info where charindex(char(13),item_name) > 0 go
5、查询名称的空格(前空格、后空格、所有空格):select * from t_bd_item_info where isnull(charindex(' ',item_name),0) > 0go
6、查询名称的单引号:select * from t_bd_item_info where charindex(char(39),item_name) > 0 go
7、查询名称的双单引号:select * from t_bd_item_info where charindex(char(34),item_name) > 0 go
(3)sql查询所有成绩为空的扩展阅读
1、处理名称有退格键
update t_bd_item_info set item_name = replace(item_name,char(8),'')
where charindex(char(9),item_name) > 0 go
2、处理名称有制表符tab
update t_bd_item_info set item_name = replace(item_name,char(9),'')
where charindex(char(9),item_name) > 0 go
3、处理名称有换行
update t_bd_item_info set item_name = replace(item_name,char(10),'')
where charindex(char(10),item_name) > 0 go
4、处理名称有回车
update t_bd_item_info set item_name = replace(item_name,char(13),'')
where charindex(char(13),item_name) > 0 go
5、处理名称的空格(前空格、后空格、所有空格)
update t_bd_item_info set item_name = replace(rtrim(ltrim(item_name)),' ','')
where isnull(charindex(' ',item_name),0) > 0go
6、处理名称的单引号
update t_bd_item_info set item_name = replace(item_name,char(39),'')
where charindex(char(39),item_name) > 0 go
7、处理名称的双单引号
update t_bd_item_info set item_name = replace(item_name,char(34),'')
where charindex(char(34),item_name) > 0 go
‘肆’ sql 语句 查询 为空的
select * from table where id is null or id=''
---补充---
select SUM(p.DRP) as drp from st_stbprp_b
有的数据库,函数的结果不让在where条件中使用
况且,如果这个是空值,根本就不会输出,想输出的话请用左连接
‘伍’ sql2000如何查询没有成绩的同学(即成绩未空)
select * from 表 where 成绩 is null
有问题hi我
‘陆’ SQL,将各门课程缺少考试成绩的学生查询出来
SELECTDISTINCT学生表.学生ID,姓名FROM学生表,成绩表
WHERE学生表.学生ID=成绩表.学生ID
AND成绩ISNULL;