Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Outer joins in database query

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 45
    Comment on it

    Joins in database, We can easily determine the meaning of joins very easily. In database we use the concept of joining in tables to fetch the data combination. There are different type of methods of joining two or more than two tables in database. You can categories joins in two simple types. one is inner join and outer join. We are here to discuss the outer joins only. Lets discuss the outer joins.

    Outer joins are useful to get the records if it does not match with other table records. It means joined table will retains all the records if matching records not available. Lets take an small example. Suppose we have two table one is emp and other is salary.
    Emp

    Id Name
    1 Tom
    2 Sommy
    3 Bunny
    4 Runny


    Salary

    Id salary
    1 1004
    4 2443
    3 342323
    5 2423

    You can create mysql query for joining these two tables with outer join.

    SELECT * from emp as e LEFT OUTER JOIN salary as s on s.Id=e.Id
    

    e.Id e.Name s.Id s.salary
    1 Tom 1 1004
    2 Sommy 2 NULL
    3 Bunny 3 342323
    4 Runny 4 2443
    NULL NULL 5 2423

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: