I want to convert this:
SELECT id,songTitle,artistName, trackId
FROM songs
WHERE (songTitle, artistName) IN (('come together', 'the beatles'),('all the small things', 'blink-182'))
To something like this but I don't know the right syntax:
SELECT id,songTitle,artistName, trackId
FROM songs
WHERE (songTitle, artistName) IN LIKE (('%come together%', '%the beatles%'),('%all the small things%', '%blink-182%'))
Except I'm searching 100s of more songs at once. We could use REGEXP too I just don't know the right syntax for either of those.
WHERE (a,b) IN ((1,2), ...)
is very poorly optimized.LIKE
prevents use of an index.So, performance aside, let's look at how to perform the task:
WHERE ( songTitle LIKE '%come together%' AND artistName LIKE '%the beatles%')
OR ( .... )
OR ...
Sorry, there is no short cut.
REGEXP can't help in this case.
FULLTEXT
indexing is something to consider, but I don't see that it would help in this example.