Get It All
select * from sales;
In SQL, the simplest queries are often the most powerful. This grabs every row and every column. If the table is under 50,000 rows, you should have no problem opening it in Excel. If it's bigger, the program may slow down, depending on your RAM and what other applications are running.
Get Columns and Rows of Interest
select date, revenue, salesperson from sales where region =
'South';
If your organization has too much data to pull down all at once, it's easy enough to work around. Often, you'll be looking for specific slices of the data. It may be by date, salesperson, or even a combination of the two. Again, this simple query returns *almost* all the data, giving you freedom to explore in Excel.
Instant Pivot Table
select salesperson,sum(revenue) total_revenue from sales group
by salesperson;
This query is a little more complex, but may instantly provide one of your first insights. It's doing exactly the same thing as a pivot table in Excel, summing the revenue for each salesperson. Once you become comfortable with this query, you're well on your way to more advanced functionalities within SQL!
That's it! I hope that reading this quick introduction pays off in spades.
By Matthew Ritter via datasciencecentral.com
No comments:
Post a Comment