Anup Shah on WPF and Silverlight (Programming Garden)

IT 's For You!!!

Showing posts with label .Net Framework. Show all posts
Showing posts with label .Net Framework. Show all posts

Wednesday, April 16, 2014

Difference between inner join and equi join and natural join

4:20 PM
​

Inner Join

This is the most used join in the SQL. this join returns only those records/rows that match/exists in both the database tables.

Inner Join Example

  
  1. SELECT * FROM tblEmp JOIN tblDept
  2. ON tblEmp.DeptID = tblDept.DeptID;
Inner Join Result
tblEmp.Name
tblEmp.DeptID
tblDept.Name
tblDept.DeptID
Hitesh
1
HR
1
Ankit
2
IT
2
Miki
2
IT
2
Anup
3
ADMIN
3
In the join condition, you can also use other operators like <,>,<>.

Equi Join

Equi join is a special type of join in which we use only equality operator. Hence, when you make a query for join using equality operator then that join query comes under Equi join.

Equi Join Example

  
  1. SELECT * FROM tblEmp JOIN tblDept
  2. ON tblEmp.DeptID = tblDept.DeptID;
  3. --Using Clause is not supported by SQL Server
  4. --Oracle and MySQL Query
  5. SELECT * FROM tblEmp INNER JOIN tblDept USING(DeptID)
Equi Join Result
tblEmp.Name
tblEmp.DeptID
tblDept.Name
tblDept.DeptID
Hitesh
1
HR
1
Ankit
2
IT
2
Miki
2
IT
2
Anup
3
ADMIN
3

Note

  1. Inner join can have equality (=) and other operators (like <,>,<>) in the join condition.
  2. Equi join only have equality (=) operator in the join condition.
  3. Equi join can be an Inner join, Left Outer join, Right Outer join
  4. The USING clause is not supported by SQL Server and Sybase. This clause is supported by Oracle and MySQL.

Natural Join

Natural join is a type of equi join which occurs implicitly by comparing all the same names columns in both tables. The join result have only one column for each pair of equally named columns.

Natural Join Example

  
  1. --Run in Oracle and MySQL
  2. SELECT * FROM tblEmp NATURAL JOIN tblDept
Natural Join Result
DeptID
tblEmp.Name
tblDept.Name
1
Hitesh
HR
2
Ankit
IT
2
Miki
IT
3
Anup
ADMIN
In the above join result we have only one column "DeptID" for each pair of equally named columns.

Note

  1. In Natural join, you can't see what columns from both the tables will be used in the join. In Natural join, you might not get the desired result what you are expecting.
  2. Natural join clause is not supported by SQL Server, it is supported by Oracle and MySQL.
​

--
Thank you.

Kind Regards,
Anup Shah.
Mobile : +91 8460372171 
Skype  : anupshah.india | gtalk: anupshah2it

​​

Thursday, February 21, 2013

Portable Library Tools

2:25 PM
I came across Microsoft's Portable Library Tools add-in for Visual Studio supports the cross-platform development of .NET Framework apps Click Here to download...

Write and Build Portable assemblies that work without modification on multiple platforms, 
such as Windows 7, Windows 8, Silverlight, Windows Phone, and Xbox 360.

For example,

you can create classes that contain shared business logic for desktop apps, Windows Store apps, and mobile apps, and you can then reference those classes from your apps.

The Portable Class Library project supports a subset of assemblies from the .NET Framework, Silverlight, .NET for Windows Store apps, Windows Phone, and Xbox 360, and provides a Visual Studio template that you can use to build assemblies that run without modification on these platforms.


With the Portable Class Library project, you can reduce the time and costs of developing and testing code by building portable assemblies that are shared across apps for different devices.


Download The Portable Class Library

Target Platforms:
Platform
Versions
.NET Framework
.NET Framework 4 and later
Update 4.0.3 and later platform updates for the .NET Framework 4
.NET Framework 4.5 (selected by default)
Silverlight
Silverlight 4 and later (selected by default)
Silverlight 5
Windows Phone
Windows Phone 7 and later (selected by default)
Windows Phone 7.5
.NET for Windows Store apps (*)
N/A
Xbox 360
N/A

Features:


















Base Reference Sites:
http://msdn.microsoft.com/en-us/library/gg597391.aspx#prereq
http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981