Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Sorting by one column | Sorting
SQL Basics

book
Sorting by one column

Welcome to the fourth section! Now it's time to learn how to sort the table based on some criteria.

For example, we want to sort the entire audi_cars table based on the mileage column. In SQL to sort by column use ORDER BY col_name statement preceded by WHERE, FROM, and SELECT statements.

SELECT *
FROM audi_cars
ORDER BY mileage
123
SELECT * FROM audi_cars ORDER BY mileage
copy

Please note, that sorting in SQL is realized in ascending order by default.

Compito

Swipe to start coding

From the audi_cars table extract all the cars sorted by price.

Soluzione

SELECT *
FROM audi_cars
ORDER BY price

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 1

Query ResultQuery Result
No query executed yet...

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

We use cookies to make your experience better!
some-alt