Db2 SQL Tutorial 1 – Intro to Db2

First off, what is a database? A database stores data, which is any information that might be of use to a company.

Db2 is a database created by IBM that is best known as an enterprise database, so we are talking about a database used by huge companies who have more data than they know what to do with. The great part for us is that that there are multiple editions of Db2 going all of the way up to the enterprise editions, but actually starting with a completely free version. That’s what I’ll be using.

So back on the topic of data. A database will often be used behind the scenes when you are using some software. Anytime you put information in software that you can access at a later time, that information will be stored in a database.

What’s the Big Deal with Data?

Databases are often used by businesses and organizations. The data that they store in a database is anything that they need to maintain their business, but also grow their business.

As an example, a company will likely keep track of all their sales and store that information in a database. They can then look back at their data and use that to figure out what products people like, which ones are earning the most money, and which ones they should discontinue. You may have heard of analytics, which is used to analyze data.

Structured and Unstructured Data

The data inside of a database is often represented in tables. A table will have columns and rows.

At the top we will have column headers that describe the structure of our data. Let’s say we have a table, users:


Each row is an individual user. This is how we store structured data, which fits nicely in a table. Db2 also supports unstructured data, which doesn’t necessarily fit the structure of a table.

There are endless ways you could represent this as unstructured data. One example would be like so:

Notice that we have the email now included for Amy. This syntax is called JSON which is a standard for representing unstructured data and is supported in Db2. Right now, the exact way we represent our data doesn’t matter. What matters is that we know Db2 is versatile when it comes to storing data.

Why a Database?

Why would you use a database when there are so many other options out there for data storage. As an example, why not use spreadsheets to store our data?

The first reason is data security. If we were trying to use something such as a spreadsheet to store our data, we would be in serious trouble because spreadsheets are all-or-nothing. If you want to share a spreadsheet with coworkers, you have to send them the whole document. This could work okay for small companies, but once we get a few employees this can introduce some serious security issues and data integrity issues when you make all of your data accessible to the organization. Even if you restrict access to certain people, those select people will still have access to the entire spreadsheet.

A database allows you to be extremely selective on who can read certain data and who can add data to the database. Imagine you had a spreadsheet with a social security number column. This is extremely sensitive data that you could not easily hide. With a database, you can restrict the reading of data at the column level through views showing only the data you want readable. There are immense capabilities when it comes to securing our data with a database.

The second reason is scalability. Scalability is the ability for you to easily grow your business without outgrowing your technology infrastructure. A simple example of this is how a database supports a very high number of concurrent users. Databases are built to allow multiple connections at one time without the risk of data conflict. This means as your data needs grow, you already have the infrastructure to keep up. With Db2, there is virtually unlimited scalability thanks to technologies such as pureScale, Db2’s clustering technology, and BlueMix, a cloud platform where you can easily provision 32 x 2.7 GHz Xeon processors and a terabyte of RAM for your Db2 database.

A database offers disaster recovery, data compression, and is designed to work well with programming languages. Db2 can be coded against using all of the major programming languages and frameworks–Java, C/C++, .Net, Ruby on Rails, PHP, Perl, and Python.

If you are building an application that is going to have any complexity or more than a few users, a database is essential. Of all the database options out there, Db2 makes a pretty good choice.

Why Db2?

First, the price of starting off with Db2 is free. That’s usually enough to get me interested, but as I mentioned before, Db2 has multiple editions allowing you to scale from being a sole developer in your mom’s basement, to running a fortune 100 company across the world. Db2 offers more than the competitors at a cheaper cost. Many companies have experienced cost savings of over 50-60% compared to Oracle Database, a competitor of Db2.

The lower price tag is not at the expense of performance. Users of Db2 have also experienced extreme performance through built in technologies such as BLU acceleration, which allows for extremely fast analytical processing.

Throughout these blogs we are going to explore the basics of Db2 and also some of the cool capabilities.

Db2 is a database that you need to add to your resume. Check out the next blog to learn more!

Further Study

Check out the first video in my Db2 Video Series (coming soon)!

Download Db2 and give it a go!

Leave a Reply

Your email address will not be published. Required fields are marked *