MySQL:判断字段是否为空

MySQL:判断字段是否为空,第1张

字段为空有两种情况

判断字段为空

判断字段不为空

trim可以不写,直接写(column)

参考: https://www.cnblogs.com/kingboy-xin/p/10825085.html .

1、mysql中创建测试表,create table test_user(id int, name varchar(20))

2、插入测试数据,

insert into test_user values(1001,'jack')

insert into test_user values(1002,'lucy')

insert into test_user values(1003,'mike')

insert into test_user values(1004,'john')

insert into test_user values(1005,'may')

3、查看表中所有数据,select * from test_user

4、编写sql,查询name列是否有jack名,

select * from test_user t where name = 'jack'


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6096593.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-14
下一篇 2023-03-14

发表评论

登录后才能评论

评论列表(0条)

保存