How to use SQL “Order By” Statement?

Order by is a great statement to use if you want your data sorted ascendingly or descending.

If you have a sales table with a several fields and want only list of customers and sales value arranged alphabetically by customer name, the code would be:

SELECT Customers, Sales_Value

FROM Sales

ORDER BY First_Name ASC

Equally you might want to order the data descending by the highest sales value, in this case you will use the below code:

SELECT Customers, Sales_Value

FROM Sales

ORDER BY Sales_Value

#AnalyticsDrivenStratege #DataAnalytics #DataEngineering #DataScience #DataManipulation #DataCleansing #coding #SQL

Follow my Blog via Email

Enter your email address to follow this blog and receive notifications of new posts by email.

Note: I try to use photos from free resources as much as I can. Hope that this will help artists getting their names out there. Photo by Fabricio Trujillo from Pexels

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s