Info |
---|
Clarification on higher/lower terminology:
Think about it like a race. |
When a new table join is made, the logic ensures that if the table on the right has a lower priority number than the table on the left. This is always the case regardless of the type of join (Inner, Left or Right joins), so that the SQL gets generated correctly.
If the table on the right has a higher priority, then the priority of the table on the right will be rewritten to be the same as the table on the left but with an increment of 0.5.
The list of tables is then re-ordered based on the priority numbers, with each priority number being displayed as resolved to an integer.
If a new table is inserted into the middle of the existing list of tables, all tables that come after the newly inserted table will have their priority numbers increased by 1 regardless of there being a space or notgap in the numbers.In the following
For example:
You have Table A, Table C, Table D and Table E. You’ve just added Table B. You want to make a join between Table A and Table B:
Drawio | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Table A - Priority 999
Table B - Priority 999.5 (
...
the newly inserted table, where a join was made with Table A which was to the left of the newly inserted table)
Table C - Priority 1000
Table D - Priority 1009
Table E - Priority 1010
To ensure that all tables are displayed in the correct order and all priority numbers are integers the tables would be re-ordered and displayed as follows:
Table A - Priority 999
Table B - Priority 1000
Table C - Priority 1001
Table D - Priority 1010
Table E - Priority 1011