A database keeps data in tables: each row is a record (a book, an employee) and each column is a property of that record (its title, its price). In SQL you write what you want, not how to find it; the database decides how to go through the rows.
SELECT title, priceFROM booksORDER BY price DESCLIMIT 5;
FROM says which table, SELECT which columns. ORDER BY sorts the result: left alone it runs small to large (ASC), with DESC large to small. LIMIT 5 keeps the first five rows. This example lists the five most expensive books.A query does not run in the order it is written: FROM first (take the table), then SELECT (pick the columns), then ORDER BY (sort), and LIMIT last (cut). So LIMIT is always applied after the sorting, and "the top three" is written ORDER BY ... DESC LIMIT 3.