64 lines
2.2 KiB
Markdown
64 lines
2.2 KiB
Markdown
# Util Result1
|
|
Analysis generated on: 4/2/2025 10:15:21 AM
|
|
---
|
|
## SQL Statement
|
|
```sql
|
|
SELECT [Util Selection 3].*, Process.* INTO [Util Selection C1]
|
|
FROM ([Util Selection 2] RIGHT JOIN [Util Selection 3] ON [Util Selection 2].prt = [Util Selection 3].PRDNO) LEFT JOIN Process ON [Util Selection 2].PartNumber = Process.PartNumber;
|
|
|
|
```
|
|
## Dependencies
|
|
- [[Tables/Process]]
|
|
## Parameters
|
|
- *Error analyzing parameters: For loop not initialized*
|
|
## What it does
|
|
**SQL Code Explanation**
|
|
==========================
|
|
|
|
### Overview
|
|
|
|
The provided SQL code performs a complex data transformation involving multiple table joins and selections.
|
|
|
|
### Breakdown
|
|
|
|
#### Select Statement
|
|
|
|
```sql
|
|
SELECT *
|
|
```
|
|
|
|
This line selects all columns (`*`) from the subsequent tables in the query.
|
|
|
|
#### Table Aliases
|
|
|
|
```markdown
|
|
[Util Selection 3].*
|
|
Process.*
|
|
INTO [Util Selection C1]
|
|
```
|
|
|
|
The `*` in `[Util Selection 3]` and `Process.*` indicates that all columns are being selected. The `INTO` clause specifies a temporary table alias, `[Util Selection C1]`, where the transformed data will be stored.
|
|
|
|
#### Join Operations
|
|
|
|
#### Join 1: RIGHT JOIN [Util Selection 2] and [Util Selection 3]
|
|
|
|
```sql
|
|
FROM ([Util Selection 2] RIGHT JOIN [Util Selection 3]
|
|
ON [Util Selection 2].prt = [Util Selection 3].PRDNO)
|
|
```
|
|
|
|
This join performs a right outer join between `[Util Selection 2]` and `[Util Selection 3]`. The `RIGHT JOIN` clause specifies that all rows from the left table (`[Util Selection 2]`) will be included in the results, along with matching rows from the right table (`[Util Selection 3]`). The `ON` clause specifies the join condition: `prt = PRDNO`.
|
|
|
|
#### Join 2: LEFT JOIN Process
|
|
|
|
```sql
|
|
LEFT JOIN Process ON [Util Selection 2].PartNumber = Process.PartNumber;
|
|
```
|
|
|
|
This left outer join combines the result of the previous join with the `Process` table. The `LEFT JOIN` clause ensures that all rows from the first join are included, even if there is no matching row in the second table (`Process`). The `ON` clause specifies the join condition: `PartNumber = PartNumber`.
|
|
|
|
#### Result
|
|
|
|
The final result set will contain all columns from both `[Util Selection 3]` and `Process`, aliased as `[Util Selection C1]`.
|