INNER JOIN and LEFT JOIN - SQL Query
The Joins are used to combine rows from two or more tables, based on the common field between two tables.
The telecom company has a list of some clients and transactions of their paid bill payments.
Consider the following tables Table1 and Table2.
INNER JOINQ. Write a query to display the record that contain columns such as C_ID, Client_Name, Amount from Table1 and Table2.
The inner join selects all rows from both columns, if there is a match between them. The column 'C_ID' is common to both column.
SELECT Client.Client_Name, Payment.Transaction_ID, Payment.Amount
INNER JOIN Payment
ON Payment.C_ID = Clients.C_ID
LEFT JOIN or LEFT OUTER JOINQ. From given tables, write a query to display record that contain columns such as C_ID, Client_Name, Amount from Table1 and Table2.
Consider table1 as left table and table2 as right table.
SELECT Clients.Client_Name, Clients.Client_Phone, Payment.Amount
LEFT JOIN Payment
ON Payment.C_ID = Payment.C_ID