Skip to main content

Command Palette

Search for a command to run...

๐Ÿš€ Understanding INNER JOIN in Oracle SQL (Combining Tables)

Updated
โ€ข2 min read
๐Ÿš€ Understanding INNER JOIN in Oracle SQL (Combining Tables)

As part of my continued learning with Oracle Autonomous Database, I explored how to combine data from multiple tables using SQL JOIN operations. This is a fundamental concept in relational databases.

๐ŸŽฏ Objective

The goal of this activity was to:

Understand relationships between tables Combine data using INNER JOIN Practice real-world SQL queries

๐Ÿ’ป Step 1: Creating Tables

CREATE TABLE departments ( dept_id NUMBER, dept_name VARCHAR2(50) );

CREATE TABLE employees ( emp_id NUMBER, emp_name VARCHAR2(50), dept_id NUMBER );

๐Ÿงช Step 2: Inserting Data

INSERT INTO departments VALUES (1, 'IT'); INSERT INTO departments VALUES (2, 'HR');

INSERT INTO employees VALUES (1, 'Ali', 1);

INSERT INTO employees VALUES (2, 'Sara', 2);

INSERT INTO employees VALUES (3, 'Ahmed', 1);

๐Ÿ“Š Step 3: Viewing Tables

SELECT * FROM employees;

SELECT * FROM departments;

๐Ÿ”— Step 4: Performing INNER JOIN

SELECT e.emp_name, d.dept_name

FROM employees e INNER JOIN departments d

ON e.dept_id = d.dept_id;

This query combines employee names with their respective departments.

๐Ÿ’ก What I Learned

How relational databases connect tables Using INNER JOIN to combine data Writing efficient multi-table queries

๐Ÿš€ Conclusion

This activity helped me understand how to work with multiple tables in Oracle SQL. JOIN operations are essential for real-world database applications and data analysis.

More from this blog

๏ฟฝ

๐Ÿš€ Getting Started with Oracle Autonomous Database (Free Tier) โ€“ My First Hands-on Experience

15 posts