If you want to be a developer then you must be aware about sql joins. This is really important. Well joins are use to create a relation between two or more tables. I created two tables “Customers” and “Orders”
The above table shows Customers detail
The above table shows orders detail
“select C.name,C.email,O.id,O.order_date from customers C join orders O on O.customer_id = C.id “
here i created alias “C” for customers and alias “O” for orders and i joined them through O.customer_id = C.id . The result will be
It got detail for all customers who’s Customer Id available in orders table. You don’ see records of parmod and dicky because id 5,6 not available in orders table
look at the difference with left join here you can see records of parmod and dicky but id and order_date is null . It will fetch records of left table
Right join is similar to left join . look at the query difference.
Inner joins are really important. There is 90% use of inner joins in almost every big projects. Joins are really important when you are going for interview. You must read this Tutorial before going for interview.