SQL CARTESIAN or CROSS JOINSThe CARTESIAN JOIN or CROSS JOIN returns the Cartesian product of the sets of records from two or more joined tables. Thus, it equates to an inner join where the join- condition always evaluates to either True or where the join- condition is absent from the statement. Syntax. The basic syntax of the CARTESIAN JOIN or the CROSS JOIN is as follows −. SELECT table. 1. column. FROM table. 1, table. Example. Consider the following two tables. Table 1 − CUSTOMERS table is as follows. ID | NAME | AGE | ADDRESS | SALARY |. Ramesh | 3. 2 | Ahmedabad | 2. Khilan | 2. 5 | Delhi | 1. Kota | 2. 00. 0. Chaitali | 2. 5 | Mumbai | 6. Hardik | 2. 7 | Bhopal | 8. Komal | 2. 2 | MP | 4. Muffy | 2. 4 | Indore | 1. Table 2: ORDERS Table is as follows −. SQL INNER JOIN Keyword. The INNER JOIN keyword selects records that have matching values in both tables. INNER JOIN Syntax. OID | DATE | CUSTOMER_ID | AMOUNT |. Now, let us join these two tables using INNER JOIN as follows −. SQL> SELECT ID, NAME, AMOUNT, DATE. FROM CUSTOMERS, ORDERS. This would produce the following result −. ID | NAME | AMOUNT | DATE |. Ramesh | 3. 00. Ramesh | 1. 50. Ramesh | 1. 56. Ramesh | 2. 06. An SQL join clause combines columns from one or more tables in a relational database. It creates a set that can be saved as a table or used as it is. Description. SQL JOINS are used to retrieve data from multiple tables. A SQL JOIN is performed whenever two or more tables are listed in a SQL statement. Khilan | 3. 00. Khilan | 1. 50. Khilan | 1. 56. Khilan | 2. 06. Chaitali | 3. 00. Chaitali | 1. 50. Chaitali | 1. 56. Chaitali | 2. 06. Hardik | 3. 00. Hardik | 1. 50. Hardik | 1. 56. Hardik | 2. 06. Komal | 3. 00. 0 | 2. Komal | 1. 50. 0 | 2. Komal | 1. 56. 0 | 2. Komal | 2. 06. 0 | 2. Muffy | 3. 00. 0 | 2. Muffy | 1. 50. 0 | 2. Muffy | 1. 56. 0 | 2. Muffy | 2. 06. 0 | 2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |