How to Set up a Database in SQL

Join over 2 million students who advanced their careers with 365 Data Science. Learn from instructors who have worked at Meta, Spotify, Google, IKEA, Netflix, and Coca-Cola and master Python, SQL, Excel, machine learning, data analysis, AI fundamentals, and more.

Start for Free
Martin Ganchev 25 Apr 2023 5 min read

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.

sql and tableau, set up a database in sql  

This will be the last piece before you are able to roll up your sleeves and proceed with more thought-provoking coding.

The Dataset

If you have already worked with the ‘employees’ database, you will find the work with the ‘employees_mod’ table easier.

git hub employees employee mod, set up a database in sql

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.

employees mod file, set up a database in sql

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.

schemas, set up a database in sql

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.

database employees, set up a database in sql

The difference is that they have a prefix ‘t_’, standing for ‘Tableau’.

database employees mod

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’.

employees modification

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.

employees mod

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

Martin Ganchev

Instructor at 365 Data Science

Martin holds an MSc degree in Economic and Social Sciences from Bocconi University. His diverse academic and research experience combined with his friendly and explanatory approach to teaching have made him one of the most beloved instructors on our team. Some of the courses he has authored include: SQL, SQL + Tableau, SQL+Tableau+Python, Introduction to Python, Introduction to Jupyter, to name a few.

Top