Https://www.codecademy.com/paths/web-development/tracks/sql-for-web-development/modules/webdev-sql-intro/lessons/sql-queries-code-challenge/exercises/headlines-iii

why is this correct:

select *
from news
where category = ‘b’
order by timestamp desc
limit 20;

and not this:

select *
from news
where category = ‘b’
and order by timestamp desc
limit 20;

basically isn’t the logic the same?

1 Like

Hello, @method7432690185! Welcome to the forum. The issue is with your use of and. AND is a logical operator. It is not used as it is in spoken or written human language to append. We may tell someone to take out the trash and feed the dog and wash the dishes and mop the floor. In computer languages the usage is completely different. In your provided code, you would only use AND if you wanted to apply another condition that also had to be true in your WHERE clause. You aren’t specifying another condition. Instead, you are immediately applying an ORDER BY clause. Hopefully that made some sense.

1 Like