Mastering SQL INNER JOIN: Essential Queries & Examples

Опубликовано: 09 Апрель 2026
на канале: Analytics Hub
164
8

Unlock the power of SQL with our comprehensive guide to INNER JOIN! In this video, we dive into the basics of INNER JOIN, demonstrating how to fetch matching records between two tables and solve common query problems.

🔍 What You'll Learn:

INNER JOIN Basics: Understand how INNER JOIN retrieves matching records between two tables.
Practical Examples:
Orders Not From USA: Find orders that are not from customers in the USA and are still in process.
Orders for Specific Products: Discover orders for Planes, Ships, and Trains that are neither Shipped, In Process, nor Resolved.
Price Comparison: Identify orders where the selling price is higher than the original product price.
Script available : https://shorturl.at/HcNrp
-- INNER JOIN or also referred to as JOIN
-- INNER Join always fetches MATCHING records between the 2 tables.

1) Find all the orders which do not belong to customers from USA and are still in process.

select s.*
from Sales_order s
inner join Customers c on c.customer_id=s.customer
where c.country != 'USA' and s.status='In Process'

select * from Sales_order;
select * from Customers;
select * from Products;

select distinct product_line from Products;




2) Find all orders for Planes, Ships and Trains which are neither Shipped nor In Process nor Resolved.

select s.*
from Sales_order s
join Products p on s.product=p.product_code
where p.product_line in('Planes','Ships','Trains')
and s.status not in ('Shipped','In Process','Resolved');


select * from Sales_order;
select * from Customers;
select * from Products;

3) Find orders which sold the product for price higher than its original price.
-- Find the original price
-- compare org price with sold price

select s.order_number,s.price_each as sold_price, p.price as org_price,
round(s.price_each-p.price,2) as price_diff
from Sales_order s
join Products p on s.product=p.product_code
where s.price_each (Greaterthan) p.price

Perfect for beginners and seasoned SQL users alike, this video will enhance your skills in querying relational databases. Don’t forget to like, subscribe, and hit the bell for more SQL tutorials!

SQL for Beginners: A Complete Introduction to SQL Basics!
   • SQL for Beginners: A Complete Introduction...  

Master SQL Commands: DDL, Data Types & Constraints Explained!
   • Master SQL Commands: DDL, Data Types & Con...  

Mastering SQL Constraints: Primary Key, Unique Key, Not Null, and CHECK Explained!
   • Mastering SQL Constraints: Primary Key, Un...  

Understanding SQL Foreign Keys: Building Relationships Between Tables
   • Understanding SQL Foreign Keys: Building R...  

SQL Identity Column: Auto-Generating Unique Values for Your Tables
   • SQL Identity Column: Auto-Generating Uniqu...  

SQL DML & DDL Commands Explained | Insert, Update, Delete, Truncate, Drop
   • SQL DML & DDL Commands Explained | Insert,...  

Master Basic SQL Queries & Operators | Part 1: Fetch, Filter & Count
   • Master Basic SQL Queries & Operators | Par...  

SQL Functions and Queries: Aggregate, CAST, REPLACE, ROUND, GETDATE
   • SQL Functions and Queries: Aggregate, CAST...  

Mastering SQL INNER JOIN: Essential Queries & Examples
   • Mastering SQL INNER JOIN: Essential Querie...  

SQL Group By Explained with Examples | Master Aggregate Queries
   • SQL Group By Explained with Examples | Mas...  

Mastering SQL: Group By, Having, CASE, Order By, Join, Top, and Limit
   • Mastering SQL: Group By, Having, CASE, Ord...  

Introduction to SQL Normalization: 1NF (First Normal Form) - Part 1
   • Introduction to SQL Normalization: 1NF (Fi...  

Understanding SQL Normalization: 2NF (Second Normal Form) - Part 2
   • Understanding SQL Normalization: 2NF (Seco...  

Mastering SQL Normalization: 3NF (Third Normal Form) Explained - Part 3
   • Mastering SQL Normalization: 3NF (Third No...  

Master SQL Subqueries: Scalar, Multi-Row, and Correlated Subqueries Explained
   • Master SQL Subqueries: Scalar, Multi-Row, ...  

SQL Tutorial: Remove Duplicate Data Efficiently | Common Interview Question
   • SQL Tutorial: Remove Duplicate Data Effici...  

SQL Joins Explained: Master INNER, LEFT, RIGHT, FULL, CROSS & SELF Joins with Examples
   • SQL Joins Explained: Master INNER, LEFT, R...  

Master SQL Joins: Self Joins, Outer Joins, and More!
   • Master SQL Joins: Self Joins, Outer Joins,...  

SQL Queries Using CTE: Profitability & Monthly Sales Differences
   • SQL Queries Using CTE: Profitability & Mon...  

Calculate User Popularity Percentage with SQL CTEs
   • Calculate User Popularity Percentage with ...  

SQL Window Functions Explained: ROW_NUMBER, RANK & DENSE_RANK
   • SQL Window Functions Explained: ROW_NUMBER...  

SQL Window Functions Explained: LEAD & LAG with Real Examples!
   • SQL Window Functions Explained: LEAD & LAG...  

Master SQL Window Functions: FIRST_VALUE, LAST_VALUE, and More!
   • Master SQL Window Functions: FIRST_VALUE, ...  

Easily Delete Duplicate Rows in SQL Server with ROW_NUMBER()
   • Easily Delete Duplicate Rows in SQL Server...  

Understanding Recursive CTEs in SQL: A Simple Guide
   • Understanding Recursive CTEs in SQL: A Sim...  

Master SQL PIVOT: Transform Rows into Columns
   • Master SQL PIVOT: Transform Rows into Columns  



#SQL #INNERJOIN #SQLQueries #DataRetrieval #SQLTutorial #LearnSQL"