SQL is a high level programming language for pulling and transforming
data, which are two of the most time consuming tasks in corporate finance. SQL
is high level, in that the user only has to write a few lines of code to
perform a massive number of calculations. This means that SQL is easy to learn, and has high utility. Finance folks can use
SQL to automate much of boring parts of their jobs, and spend more time providing
analysis and recommendations to management.
The main clauses
of a SQL select statement are select, from, where, and group by.
Select
The “select” clause is where you list the columns of the data you
want to pull, separated by commas. You can rename columns by typing “as [insert
name].” You can perform calculations on data using ordinary mathematical operations.
From
The “from” clause is where you list the tables which store
the data you want, separated by commas.
Where
This is where you list the table filters and join conditions. Join conditions are cross table filters used to relate tables.
Here is a link to learn more about joins: SQL Joins
Group by
The “group by” clause is a list of columns for which you are
summarizing data. Here is a link to learn more about aggregating data. Aggregating data
Simple Example
Assume there is a table named departments that has two columns- department and number_of_employees. To return the number of employees in finance you would write
"Select
number_of_employees
from
departments
where
department = 'finance' "
No comments:
Post a Comment