gpt4 book ai didi

mysql - 如何在MySQL中搜索带有H的名字?

转载 作者:行者123 更新时间:2023-11-29 06:56:37 25 4
gpt4 key购买 nike

它应该很简单,但它不起作用

 SELECT * FROM profile WHERE name LIKE = 'H%';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'H%'' at line 1

表中的列

SHOW COLUMNS FROM profile;
+-------+-------------------------------------------------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------------------------------------------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(20) | NO | | NULL | |
| birth | date | YES | | NULL | |
| color | enum('blue','red','green','brown','black','white') | YES | | NULL | |
| foods | set('lutefisk','burrito','curry','eggroll','fadge','pizza') | YES | | NULL | |
| cats | int(11) | YES | | NULL | |

我应该尝试什么?

最佳答案

在 select 语句中删除 =所以;

 SELECT * FROM profile WHERE name LIKE  'H%';

关于mysql - 如何在MySQL中搜索带有H的名字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45344914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com