Tables used in my JOIN tutorial series
In order to make the concept of SQL join easy to understand I have created and populated two very simple tables.
Table 1: EMP this is a very simple table which consists of 3 columns emp id, emp name and emp salary where column emp id is the primary key.
The query to create this table is:
CREATE TABLE emp
  (
    emp_id    NUMBER(2) CONSTRAINT emp_col1_pk PRIMARY KEY,
    emp_name VARCHAR2(20),
    emp_salary NUMBER(5)
  );
Table 2: The second table is DEPT this table also consists of 3 columns dept id, dept name and emp id. Column dept id is the primary key here and column emp id is the foreign key reference from the emp table.
The query to create this table is:
CREATE TABLE dept
  (
    dept_id    NUMBER(2) CONSTRAINT emp_col1_pk PRIMARY KEY,
    dept_name VARCHAR2(20),
    emp_id CONSTRAINT dept_col3_fk REFERENCES emp(emp_id)
  );
Data in the table.
You can insert whatever data you want in these tables but for the demonstration of the SQL join I have inserted 5 rows in each table.
I am providing you the SQL script where you can find the query for Table Creation and Data insertion.