Today DS40 had our first session on SQL "Structured Query Language ". Arguably the most commonly used data tool it is an important skill to pick up at the data school both for placements and post-data school life. SQL allows us to query data sets and build them into tables. It relies on a simple set of instructions. To pick apart and put back together data sets. Like all languages, it can be broken down into its parts.
SQL has an order of operations, I think this as being similar to BODMASS. In this Blog, we will look at the first 3 SELECT, FROM, and WHERE.
SELECT: This is asking SQL to return whichever fields (Columns/Categories) follow it. SELECT ORDER_ID will return to you everything in the ORDER_ID field. We can reference multiple fields if we separate them with a ","
SELECT: Orders, Customers
Will Return data from both Orders and Customers field
SELECT * will return all the values contained within the data set. NOTE if your data set is too large this way will crash your computer. We can sample the data set using the LIMIT 100 which will return 100 lines.
FROM: Here we are specifying the data set from which we are going to be pulling our data. In this case DataSchoolDataSet
WHERE: This allows us to add a filter to the data which will be returned. an example where sales> 10
To combine our steps
SELECT: Orders, Customers
From: DataSchoolDataSet
Where sales >10
In plain English what we are asking SQL is to return all the values from the Orders and Customers field in the DataSchoolDataSet where Sales values are greater than 10.
