Inner join is a default type of SQL Join that return the records matching in all the tables joined in sql query satisfying the condition specified in WHERE clause.
Inner join includes 3 types of joins similar to one another.
Self Join: Self join joins a single sql database table to itself. You can see the example of self join here … Self Join In Sql Server 2000 2005
Equi Join: Equi Join returns all the columns from both tables and filters the records satisfying the matching condition specified in Join “ON” statement of sql inner join query.
SQL Inner Equi Join Example:
USE NORTHWIND
SELECT * FROM CATEGORIES C INNER JOIN PRODUCTS P ON P.CATEGORYID = C.CATEGORYID
Result will display the following columns:
CategoryID, CategoryName, Description, Picture, ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued
Above equi join sql query will display the categoryId two times in a row because both the tables have categoryId column. You can convert the result into natural join by elimination the identical columns and unnecessary columns.
Click here to learn how to specify the column names in natural join sql query.
Be the first to rate this post
Tags: sql, sql joins, sql inner join, sql equi join, sql join example
8/23/2008 9:08:45 PM