Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL Join Query

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 213
    Comment on it

    SQL Join query is used to join the two tables i.e add or combine two or more tables .
    This clause take data from two or more table in database and then combine them to produce new table . Joining is based upon the common fields from the tables .
    Advantage :
    Using this you can access more than one table with the help of select statement .
    Join has 4 types :
    *1) Inner Join : * it also known as simple join , it is widely used .

    Example :

    First Table name : Employee_Info

     
    Employee_Id    Employee_name            Employee_Age          Employee _Salary
      1            Mukesh                  23                           100000
      2            Ayush                   24                           200000
      3            Ishan                   20                           400000
      4            Pranav                  35                           700000
      5            Abhishek                26                           800000
      6            Ravi                    25                           300000
      7            David                   40                           800000
    

    Second Table name : student

        Student_Id  Student_name            Student_Age          Student_Id
           1        Mukesh                  23                    1
           3        Ayush                   24                    2
           4        Ishan                   20                    4
           16        Pranav                  35                    7
           15        Abhishek                26                    8
           12        Ravi                    25                    3
    

    Now to join these above two tables then you can use simple join see below :

    select Employee_Id , Employee_name , Student_name from Employee_Info e , student s where e.Employee_Id = s.Student_Id ;
    

    Output : Onlye common column will come

    Employee _Id       Employee_name                 Student_name 
            1            Mukesh                          Mukesh
            3            Ishan                           Ayush
            4            Pranav                          Ishan
    

 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: