If you are familiar with SQL, you might have written queries to fetch data using a single table. But SQL joins are used to fetch data from two or more tables. This can be considered as one of the most benefited features enable in SQL. Lets see how we can use SQL joins to fetch data . Rather than storing the same data in multiple tables,by using this method one table will keep a reference to a ID of the other table. This approach is more efficient and lets see we can do this using SQL joins. Types of Joins In MySql we can see there are mainly three joins , INNER JOIN LEFT JOIN RIGHT JOIN 01. INNER JOINS In INNER JOIN, the query selects all the rows from both tables where there is a match between the columns in both tables. SQL Query SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name=table2.column_name; Here the INNER JOIN is Specified by the ON keyword which is in the syntax. Example : Lets see How t...
Comments
Post a Comment