mysql的基础题,在表中查询出姓 ‘张’或者‘刘’的作者的信息

mysql的基础题,在表中查询出姓 ‘张’或者‘刘’的作者的信息,第1张

sql语句里面的并且和或是and和or,select *from authorwhere au_name like '刘%' or au_name like '张%'而且in 查询里面应该是具体的查询结果

set names gbk # windows 下一定要加上。cmd命令行中,如果在文件中改为utf8

drop table if exists user

CREATE TABLE `user` (

`id` int(11) unsigned NOT NULL auto_increment,

`txt` text NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8

insert into user (txt) values ('张三'),('小张'),('张'),('李'),('李四'),('小李')

select * from user where txt like '张%'

select * from user where txt like '李%'


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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存