Joins in Database world

I don't remember when I last touched databases before today. It must be in my college days. These days almost every software system is built on a database. So I thought why not to refurbish my owns knowledge. So today I have picked up a very important terminology from Database world, "Join".
There are 3 kinds of joins as;
  • Join
  • Left Join
  • Right Join
What I learned for today is what is the basic difference between these.
Let's say we have 2 tables as;
Customer(Cno, Cname, Address);
Order(Tid, description, amount, Cno);

So the query can be written in format as;
Select <<Column names>> from <<Table name1>> <<Join type>> <<Table name2>> ON <<table name.column>> = = <<table name2.column>>

These 3 types of joins can be summarized as,
  1. Join returns records from both the tables if at-least one condition is matching.
  2. Left join returns records from the left table even if no condition is matching.
  3. Right join returns records from the right table even if no condition is matching.



No comments:

Post a Comment

Labels

.net .Net Instrumentation logging .net localization Agile amazon amazon elasticache amazon services AppDomain Application Domain architecture asp ASP.Net authentication authentication mechanisms Byte order mark c# cache canvas app cdata certifications class classic mode cloud cloud computing cluster code-behind Combobox compilation Configuration providers configurations connection connectionString constructors control controls contructor CSV CTS .net types conversion database DataGridView DataSource DataTable DataType DBML delegates design pattern dispose double encoding Entity framework Events exception handling expiry fault contracts fault exceptions function pointers functions generics help HostingEnvironmentException IIS inner join instance management integrated mode javascript join left outer join LINQ LINQ join LINQ to SQL memory leak methods microsoft model driven app modes in IIS MSIL multiple catch blocks no primary key Nullable Osmos Osmotic Osmotic communication Osmotic communications page events page life cycle partial class PMI powerapps preserve precision points private contructor ProcessExit Project management properties property protect connectionString providerName providers query regular expression repository Responsive Web Design return type run-time RWD Saas self join session session expiry sessions singelton singleton pattern software as a service source control system SQLMetal string toolstrip ToolStrip controls ToolStripControlHost tortoise SVN ToString() try catch finally update wcf web application web design web site web.config where-clause xml

Pages