Databases Reporting with SQL Ordering, Limiting and Paging Results Limiting Results

Adam Tyler
Adam Tyler
5,332 Points

Why does this need a WHERE clause?

I am getting an error saying I need a where clause, but I don't see why? I have ordered the table then used LIMIT 1 to get the top result, why would I need to do anything else?

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 49,689 Points

The instructions are to find the earliest Science Fiction book in our library. So you have two criteria: a date and a genre. The ORDER BY clause can be used to get the correct date. The WHERE clause is used to filter the genre to just Science Fiction.