So... you want to know the basics to SQL? Well, you have come to the right place.
Ultimately, there are 6 key categories; Select; From; Where; Group By; Having; and Order By.
Each performs a different function and allows the user to return more detailed queries from their data source.
If you are more familiar with Alteryx then this may be an easier way to visualise what each does.
Select: allows us to select the specific data one requires from the data source
From: follows a specific file path whereby the data will be retrieved from
Where: matches the data you have asked for in the select function and draws the column headers for that data
Group By: allows the user to aggregate the data which has been matched in the where function
Having: similarly to the where function, filters the data on an aggregated level
Order By: sorts the data, either in an ascending or descending order
Examples:
The following query asks to return each city which contains 'town' within them.
![](https://www.thedataschool.co.uk/content/images/2022/10/image-65.png)
This returns any unprofitable within either the state of Illinois and the East side of North America:
![](https://www.thedataschool.co.uk/content/images/2022/10/image-66.png)
Happy SQL'ing!!