I think you'll find it helpful to create a more rigorous specification of what you require from your query.
Guessing, it seems your videos
table contains some duplicates; otherwise SELECT *
would do what you need. So, guessing, it seems like you're looking for a query to eliminate duplicates.
The question is, how do you define a duplicate? If you have two rows with the same Title
it means you have two listings for that particular video. Presumably you want to display just one of them. Which one? How can distinguish the one you want to display from the one you want to omit?
SELECT DISTINCT
is pretty good for eliminating duplicates in a simple way. But it's not very sophisticated. If your table has a primary key, perhaps called id
, SELECT DISTINCT *
will not find any duplicates, because there aren't any (every id is different from the previous one, of course).
Pro tip: avoid using SELECT *
in your programs. Avoid specifications that say you need "everything out of the query." Instead, in your query name the columns you actually need to appear in your result set.
If you do a query like this
SELECT DISTINCT Title,
Director,
Year
FROM videos
WHERE Title LIKE '%lovelace%'
you may actually get the result you're looking for. But it's hard to help with the actual query because you haven't disclosed the columns in your table.