Print all the records having 'The' but not 'The '

I was going through Learn SQL course and came through like keyword.
Then a question came to my mind.
We have to print movies starting with ‘The’ but should not include movies 'The '.

  1. The Avengers
  2. The Galaxy man
  3. The Hulk
  4. There was a sunshine
  5. There it is
  6. There is many like us

Then our query should return 4, 5, 6 records only not 1, 2, 3.

Hi @betaplayer51745,

If it may help please see the following example which shows how you would explicitly use the SQL LIKE to set what terms to search on and what to omit.
The trick is just matching patterns with what you WANT and what you do NOT.

SQL Movies The Example.

EDIT: I should mention, incase one is not familiar with this; one should select [Build Schema] on the left first, to populate the tables. Then on the right hit [Run SQL]. The results are displayed on the bottom. You can edit the SQL as needs be. However please not it is based on MS SQL syntax.

1 Like

I have solved it using this trick but the codecademy platform was not giving me the records, so I thought I am wrong and haven’t tried it anywhere else and just posted the question. Thanks for figuring that out! Peace.

1 Like