Syntax

SQL Sort Results Syntax

In SQL, sort results: orders rows by one or more columns — SELECT * FROM users ORDER BY created_at DESC;

Quick Answer

Syntax
SELECT * FROM users ORDER BY created_at DESC;
SQLSyntax

Sort Results

Code example
SELECT * FROM users ORDER BY created_at DESC;

Orders rows by one or more columns.

Learn More

How to sort results in SQL

  1. Open your SQL file or editor.
  2. Copy the example, then replace its sample names and values for your code.

SQL Sort Results Syntax

Use SELECT * FROM users ORDER BY created_at DESC;.

Related Syntax References

Frequently asked questions

What is the SQL syntax for sort results?

Use this pattern: SELECT * FROM users ORDER BY created_at DESC;

Can I copy this SQL code example?

Yes. Use Copy code and adapt the example to your program.

Is this SQL syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify