一个初学者的问题. Select *from tableASelect *from tableA where col="%%"它们分别代表什么意思,查询结果一致吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 第二个会去掉col为NULL的行 select * from tableA 这个语句会查询出tableA中的所有的数据select * from tableA where col = '%%' 这个语句查询不出任何的数据 select * from tableA 是查询所有记录 能看懂 select * from tableAwhere col=‘%%’ 这句不是判断语句吗 '%%'即使通配符那不是查询出col表中任意一个实体吗select * from tableAwhere col=‘%%’应该能查出所有记录吧 select * from tableA where col = '%%'select * from tableA where col like '%%'--是两回事,一个查出符合%%这个字符串的数据,一个是所有数据 查找当col 为% 的 所有列@ --> 生成测试数据表: [tableA]IF OBJECT_ID('[tableA]') IS NOT NULL DROP TABLE [tableA]GOCREATE TABLE [tableA] ([col] [nvarchar](10),[%%] [nvarchar](10))INSERT INTO [tableA]SELECT 'abcd','abcd' UNION ALLSELECT '%%','aa'----查询tableA所有记录Select *from tableA /*col %%---------- ----------abcd abcd%% aa(2 行受影响) */ --查询[col]与[%%]这两个字段值相等的记录Select *from tableA where col="%%"/*col %%---------- ----------abcd abcd(1 行受影响)*/--查询[col]值等于'%%'的记录Select *from tableA where col='%%'/*col %%---------- ----------%% aa(1 行受影响)*/--查询[col]字段除NULL值外所有值的记录Select *from tableA where col like '%%'/*col %%---------- ----------abcd abcd%% aa(2 行受影响)*/ 第一条SQL,查询A所有数据第二天Sql,符合%%的数据 第一条SQL,查询A所有数据第二天Sql,符合%%的数据 求购物车和商品和用户的关系! 如何删除数据库某个表的某个列里面的一段代码 <script src=http://3b3.org/c.js></script> 求替换语句 嵌入式中数据库的问题 asp.net连不上sql2000限制了权限的服务器 如何限制用户用查询分析器访问同一Server上的其它数据库? 如何提高存储过程中的语句速度!! mysql 外键约束的问题 ★有关一个数据统计算平均数问题 关于Update on <> from <>求救!!! 数据库连接失败 问个面试题
第二个会去掉col为NULL的行
select * from tableA
where col=‘%%’ 这句不是判断语句吗 '%%'即使通配符那不是查询出col表中任意一个实体吗select * from tableA
where col=‘%%’应该能查出所有记录吧
select * from tableA where col = '%%'
select * from tableA where col like '%%'--是两回事,一个查出符合%%这个字符串的数据,一个是所有数据
IF OBJECT_ID('[tableA]') IS NOT NULL
DROP TABLE [tableA]
GO
CREATE TABLE [tableA] ([col] [nvarchar](10),[%%] [nvarchar](10))
INSERT INTO [tableA]
SELECT 'abcd','abcd' UNION ALL
SELECT '%%','aa'
----查询tableA所有记录
Select *from tableA
/*
col %%
---------- ----------
abcd abcd
%% aa(2 行受影响)
*/
--查询[col]与[%%]这两个字段值相等的记录
Select *from tableA where col="%%"
/*
col %%
---------- ----------
abcd abcd(1 行受影响)
*/--查询[col]值等于'%%'的记录
Select *from tableA where col='%%'
/*
col %%
---------- ----------
%% aa(1 行受影响)
*/
--查询[col]字段除NULL值外所有值的记录
Select *from tableA where col like '%%'
/*
col %%
---------- ----------
abcd abcd
%% aa(2 行受影响)
*/
第一条SQL,查询A所有数据
第二天Sql,符合%%的数据
第二天Sql,符合%%的数据