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

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 222
    Comment on it

    SQL Cross means cartesian product of the rows of two or more tables . It return all the rows of the table when each row of the first table combined with the each row of the second table . It is also known as cartesian or cross join .
    Cross Join can be represent by two ways :
    1) Using Join Syntax .
    2) from clause without using a where clause .

    Syntax :

    1. select * from table1 cross join table2 ;
    2. or
    3. select * from table1 , table2 ;

    Example of Cross join :
    First Table name : Employee_Info

    1. Employee_Id Employee_name Employee_Age
    2. 1 Mukesh 23
    3. 2 Ayush 24

    Second Table name : student

    1. Student_name Student_Age
    2. Abhishek 26
    3. Ravi 25

    Query for Cross Join :

    1. select * from Employee_Info cross join student ;

    Output :

    1. Employee_Id Employee_name Employee_Age Student_name Student_Age
    2. 1 Mukesh 23 Abhishek 26
    3. 2 Ayush 24 Abhishek 26
    4. 1 Mukesh 23 Ravi 25
    5. 2 Ayush 24 Ravi 25

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: