Can you give me a real-time scenario where you have applied CROSS JOIN in your project?
Loading
Can you give me a real-time scenario where you have applied CROSS JOIN in your project?
The CROSS JOIN is used to generate a paired combination of each row of the first table with each row of the second table. This join type is also known as cartesian join. Suppose that we are sitting in a coffee shop and we decide to order breakfast.
if I want to create a report which has all options.
| ComponentId | ComponentCode |
|---|---|
| 1 | Engine |
| 2 | Break System |
| InspectionId | InspectionDescription |
|---|---|
| 1 | Is Making Noise? |
| 2 | Is Over heating? |
select ComponentCode, InspectionDescription, 'Actual', from
Components CROSS JOIN Inspections
The final result will be.
| ComponetCode | InspectionDescription | Actual |
|---|---|---|
| Engine | Is Making Noise? | |
| Break System | Is Making Noise | |
| Engine | Is Over heating? | |
| Break System | Is Over heating? |