Structured Query Language (SQL).

Introduction:

I think it is an important distinction to say that SQL is a Programming Language. Hence, the last word of SQL being “Language”.

There are some major advantages to using traditional relational databases, which we interact with using SQL. The five most apparent are:

  • SQL is easy to understand.
  • Traditional databases allow us to access data directly.
  • Traditional databases allow us to audit and replicate our data.
  • SQL is a great tool for analysing multiple tables at once.
  • SQL allows you to analyse more complex questions than dashboard tools like Google Analytics.

Why Businesses like Databases:

  1. Data integrity is ensured – only the data you want entered is entered, and only certain users are able to enter data into the database.
  2. Data can be accessed quickly – SQL allows you to obtain results very quickly from the data stored in a database. Code can be optimized to quickly pull results.
  3. Data is easily shared – multiple individuals can access data stored in a database, and the data is the same for all users allowing for consistent results for anyone with access to your database.

Entity Relationship Diagram (ERD):

An Entity Relationship Diagram (ERD) is a common way to view data in a database. Below is the ERD for a database called “Parch and Posey”. These diagrams help you visualize the data you are analysing including:

  1. The names of the tables.
  2. The columns in each table.
  3. The way the tables work together.

(You can think of each of the boxes below as a spreadsheet)

IMA-SQL-1

In the “Parch and Posey” database there are five tables (Essentially 5 spreadsheets):

  1. web_events
  2. accounts
  3. orders
  4. sales_reps
  5. region

IMA-SQL- 2

You can think of each of these tables as an individual spreadsheet. Then the columns in each spreadsheet are listed below the table name. For example, the region table has two columns: id and name. Alternatively, the web_events table has four columns.

The “crow’s foot” that connects the tables together shows us how the columns in one table relate to the columns in another table.

SQL vs. NoSQL:

You may have heard of NoSQL, which stands for not only SQL. Databases using NoSQL allow for you to write code that interacts with the data a bit differently than what we will do in SQL. These NoSQL environments tend to be particularly popular for web-based data, but less popular for data that lives in spreadsheets the way we have been analysing data up to this point. One of the most popular NoSQL languages is called MongoDB.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.