SQL for BAs

Most large organizations use relational database management systems (RDBMS) to store data. A relational database is a data store in which data is stored in tables (rows and columns) that are linked together using unique keys. This ensures data is not duplicated and remains consistent. Oracle, MS SQL Server and Sybase are all examples of enterprise level databases that are used. Organisations are bound by regulators to store the data for over ten years. That means ten years’ worth of transactions, customer details and internal reports. In order to be able to make sense of all this data a BA needs to be able to ‘query’ the database. This is done using Structured Query Language (SOL). SQL allows you to join up all the tables in the database and then apply filtering conditions so you only see data you’re interested in. Imagine putting a filter on a large excel spreadsheet and then filtering on a column so you only see rows (records) you’re interested in. Same concept, but database applications won’t crash like Excel 2003 when you have more than 65,000 rows.

For example: If I wanted to find some details for anyone with a surname of ‘Smith’ from a “Customer” table in a database I might write a query like this:
SELECT First Name, Phone Number FROM Customer WHERE Surname ‘Smith’
SELECT — anything appearing after this, but before WHERE is a comma separated list of results columns that you want to see. In this case all we will see from the “Customer” table will be the customer’s first name and phone number, even if there are lots of other columns in that table.
FROM — this is just specifying from what table you’re referring to in the database. In our case, the “Customer” table.
WHERE — anything after the WHERE clause is defining some restrictions on the data, so it’s more specific to what you want to see. Without this, in our case, we would see all first names and Phone numbers for every customer record in our “Customer” table. With the WHERE clause we will only see first names and Phone numbers of customers with a surname of “Smith”.
This is a very basic example, but the point is that Business Analysts shouldn’t be afraid to learn SQL as it’s a very logical language that isn’t anywhere near as difficult as object orientated programming such as C# or Java.