What is SQL?
Structured Query Language (“SEQUEL) was developed by IBM Corporation Inc. SQL is an ANSI and ISO standard computer language for accessing, manipulating and controlling data’s in database systems. It is a structured query language, it is used to interact with databases. It is not a programming language. It is not case sensitive. It is a common language to use for all the databases. It works with database programs like ORACLE, MS SQL Server, My SQL, Teradata, MS Access, DB2, Informix, Sybase, etc.,
When data from more than one table in the database is required, a join condition is used. Rows in one table can be joined to rows in another table according to common values existing in corresponding columns, that is, usually primary and foreign key columns. If a row does not satisfy a join condition, the row will not appear in the query. If two tables have a column name in common, you must qualify all references to these columns throughout the query with its table names to avoid ambiguity.
When we join two tables or datasets together on equality (i.e. column or set of columns) we are performing an inner join.
Left Outer Join:
Left outer join produces the results, which contains all the rows from left table and matched rows from the right table.
Right Outer Join:
Right outer join produces the result set, which contains all the rows from right table and matched rows from the left table.
Full Outer Join:
Full outer join produces the result set, which contains all the rows from left table and all the rows from the right table.
There are few more joins which you can know:
A natural join will join two data sets on all matching column names, regardless of whether the columns are actually related in anything other than name.
A join without having any condition is known as cross join, in cross join every row in first table is joins with every row in the second table. Cross join is nothing but cartesian product.
A self join is a join which a table is joined with itself.