Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Basic Sorting | Sorting Data
Introduction to SQL
course content

Course Content

Introduction to SQL

Introduction to SQL

1. Getting Started
3. Sorting Data
4. Populating a Database
5. Updating & Deleting Data

book
Basic Sorting

Note

The rows fetched by a SELECT statement are ordered by default based on the date and time of insertion, with the oldest inserted row at the top and the most recently inserted row at the bottom. In the upcoming sections, we will learn how to insert rows into tables.

Summary:

  • We can sort the results of a SELECT statement by using an ORDER BY clause;
  • The syntax of the ORDER BY clause is: ORDER BY column_name [ASC|DESC];
  • The keywords ASC or DESC can be optionally used to specify the sorting order;
  • Usage Example: SELECT * FROM students ORDER BY age DESC.

1. Which clause can be used for ordering the retrieved data?

2. What is the correct syntax for using the ORDER BY clause?

Which clause can be used for ordering the retrieved data?

Which clause can be used for ordering the retrieved data?

Select the correct answer

question-icon

What is the correct syntax for using the ORDER BY clause?

Click or drag`n`drop items and fill in the blanks

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 1
We're sorry to hear that something went wrong. What happened?
some-alt