In this tutorial, we will demonstrate the easiest way to set up a database in SQL. We will be loading a big dataset which is a modification of the ‘employees’ database that can be found on GitHub. The latter is frequently used by programmers who are about to step it up a notch and dig deeper into SQL. However, in order to do that, it wouldn’t be a bad idea to figure out why and how SQL and Tableau are integrated.
This will be the last piece before you are able to roll up your sleeves and proceed with more thought-provoking coding.
We've also developed a variety of flashcard decks to assist you in your SQL learning journey. These cover the basics of databases and this essential query language. Check them out here: Foundations of Databases and SQL Flashcards and SQL Data Types, Relationships, Keys, and Constraints Flashcards.
The Dataset
If you have already worked with the ‘employees’ database, you will find the work with the ‘employees_mod’ table easier.
We hope you’ll find this relation helpful, allowing you to manipulate a database whose structure and content you are already acquainted with, while focusing on challenging Business Intelligence tasks.
The Right Way to Set Up a Database in SQL
We have re-organized the database script in an SQL file ('employees_mod.sql') that you can download and run.
Important: Don't forget the location you are storing it in!
Once this process is ready, try opening the script file from Workbench as you would open other SQL files.
Creating the Database
As you scroll down, you’ll see the code that will create your entire database from the first to the last piece.
There’s nothing else to say. Please, run this file and wait for a while.
Once the execution phase is over, you should refresh the data in your schemas section.
You’ll see the “employees_mod” database appear on your list. So, after arranging the database in Workbench, from this moment on you can concentrate on business intelligence tasks.
A Few Notes
All tables in the ‘employees_mod’ database bear the same name as the tables from the ‘employees’ database they are corresponding to.
The difference is that they have a prefix ‘t_’, standing for ‘Tableau’.
The idea of using such names is to help you so you don’t confuse the content between the same tables from the two databases. While still reminding you that you are working on SQL-Tableau exercises with a modified version of the ‘employees’ database – ‘employees_mod’.
The Relational Schema of the Database
Apart from the SQL file containing the database you’ll need, you can download the relational schema of “employees_mod”. Please use this PDF file as a reference when joining tables.
Now you know how to set up a database in SQL. In our case, it was the ‘employees_mod’ database.
Remember the part when we mentioned writing thought-provoking code? How about we turn the conversation into action? Don’t think twice before jumping into our tutorial where we will solve a business task and visualize it in Tableau.
***
Eager to hone your SQL and Tableau skills? Enroll in our SQL + Tableau course.
Next Tutorial: Solving a Business Task in SQL and Visualizing it in Tableau