Sql Left Join Clause

Sql Left Join Clause

  • Left Join brings the left table all records and the matching records of right table.
  • We can use right join, if we change the tables position in query.
  • Left join and left outer join are same clauses. You may use you want.

Sql Left Join Syntax

Select columnNames from tableName1 left Join TableName2 on  tableName1.relationColumn = tableName2.relationColumn

Note: The TableName1 is the table,that we want to bring all records.

Sql Left Join Examples on Library Database

TO DOWNLOAD THE SAMPLE LİBRARY DATABASE CLICK

Example 1:List all student’s name,surname and the borrow’s taken date. Students who do not read books are also listed.

If we change table’s position

Example 2: List all the datas of students who do not read book.

Example 3: List, All of the student’s name, surname and count of  the read books. Students who do not read books are also listed with zero data.

Note: Star character could be written inside count function. If we do, It had been wrong. Because The number of books read, would be one.

YOU MAY WANT TO SEE OUR ALL EXAMPLES PAGE, THEN CLICK HERE

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: