0
select authorname
from library
where author like '%ROSARIO RAMIREZ CORTE%'
   or author like '%Ann Rice%'

Since the Excel sheet I have doesn't provide the exact match of author name, that's why I want to use like and I was able to find the 'missing' record. But I have like 300 authors in my list, anyway to combine the and and in together? Instead keep doing and author like forever?

For example here is my sample result, it is correct but I have to keep adding author like in each new line:

AuthorName
ROSARIO RAMIREZ CORTEZ
Anne Rice
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Instead of hard-coding the search expressions you can join to them. Please include sample data and desired results, see [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and Tag your database. – Stu Jun 08 '21 at 19:45
  • Tag your question with the database you are using. – Gordon Linoff Jun 08 '21 at 20:08
  • Depending of RDBMS [Is there a combination of “LIKE” and “IN” in SQL?](https://stackoverflow.com/a/52264937/5070879) – Lukasz Szozda Jun 08 '21 at 20:15

1 Answers1

-2

You can use the IN operator as a shorthand for multiple OR's I'm pretty sure.

SELECT authorName FROM library WHERE authorName IN ('%Ann Rice%', ...)

  • You can't do that. See : https://stackoverflow.com/questions/3014940/is-there-a-combination-of-like-and-in-in-sql – Julien Jun 08 '21 at 20:53