SQL where clause is not working in my database.
I have a table called "sites" and structure like that
id site
1 xyz.com
2 google.com
3 example.com
I am running this SQL query
SELECT * FROM `sites` WHERE `site` = "google.com";
But I am getting this output
MySQL returned an empty result set (i.e. zero rows). (Query took 0.0009 sec)
I never see before like that in my life.
Update: Screenshot
I do not want to apply this query in project.
SELECT * FROM `sites` WHERE `site` LIKE "%google.com%";
#
The real problem was in insert
commands on creation of DB.
Try
INSERT INTO sites (id, site) VALUES (1, '
xyz.com
'), (2, '
google.com
'), (3, '
example.com
')
and manually check records in the table. You would not see line breaks. This is an issue in SQL I've noticed.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…