SQL Sample Database
In the coming articles, we will be using our sample database which is an HR database. It has multiple seven tables which will be interlinked to get answered our question.
The description of tables are as mentioned below
jobs table stores the job data including job title and salary range.
dependents table stores the employee’s dependents.
employees table stores the data of employees.
departments table stores department data.
regions table stores the data of regions such as Asia, Europe, America, and the Middle East and Africa. The countries are grouped into regions.
locations table stores the location of the departments of the company.
countries table stores the data of countries where the company is doing business.
To use this we need to install a Relational Database Management System (RDBMS) to work with SQL. If SQL(such as MySQL, PostgreSQL, Oracle Database, and SQL Server) is already installed there you can create tables from the below attachment.
If it is not installed or due to any reason you can’t install then you can use the online option. I have mentioned below options for working SQL online. These all are SQL compilers.
Oracle Live : Provided by Oracle. Very easy to use. Just need to get logged in for using it. I will be using this throughout this tutorial.
mycompiler It is also a very good online compiler for SQL use. It provides multiple different other programming language options.
Before we start working with SQL we should go through the concept of Difference between Primary Key and Foreign Key. It will help in creating tables in SQL.