Rule Definition
The use of LIKE condition without wildcards is confusing for maintainers and could even generate performance issues, depending on the RDBMS.
Remediation
Check the statement and if so, replace LIKE with =.
Violation Code Sample
SELECT * FROM FOO WHERE BAR LIKE 'X'
Fixed Code Sample
If you look for BAR starting with X, you should replace with :
SELECT * FROM FOO WHERE BAR LIKE 'X%'
If you look for BAR equal with X, you should replace with :
SELECT * FROM FOO WHERE BAR = 'X'
Reference
Oracle:
https://docs.oracle.com/cd/B19306_01/server.102/b14200/conditions007.htm,
https://docs.oracle.com/cd/B19306_01/server.102/b14200/conditions007.htm
SQL Server:
https://www.sqlservertutorial.net/sql-server-basics/sql-server-like/
PostgreSQL:
https://www.postgresql.org/docs/9.0/functions-matching.html
MySQL:
https://www.mysqltutorial.org/mysql-like/
MariaDB:
https://mariadb.com/kb/en/like/
Teradata:
https://forgetcode.com/teradata/1766-like
Related Technologies
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.