I have only a very basic knowledge of SQL, so pls do forgive if this is a stupid Q. I hunted the internet but could not get an answer.
I have three tables:
title
id int <- PK
artist_id int
album_id int
desc varchar
artist
arist_id int <- FK
desc varchar
album
album_id int <- FK
desc varchar
title data
1, 1, 1, "Give me everything"
1, 2, 2, "More"
1, 3, 3, "What makes you beautiful"
artist data
1, "Pitbull"
2, "Usher"
3, "One Direction"
album data
1, "Planet Pit"
2, "More"
3, "Up All Night"
If I want to do a search of one table I do like so:
select * from artist where desc like '%direction%';
My objective is to do a search across three tables. The search SQL query should return rows for "title" table where the search criteria has been met in the "desc" field of any of the three tables using the artist_id and album_id fields (which are the linking keys).
My brain is totally muddled today. If the Q is not clear, pls do ask for clarity.