Repository navigation
KoddQL Tutorial
NynrahGhost edited this page Mar 20, 2021
·
13 revisions
All selection queries must end with forwarding operator (->) pointing to RESULT constant.
To select all the data from the table, you need to just specify table's name and forward it to RESULT.
| table | -> | RESULT |
|---|
If you only need a part of table's columns, you can apply projection.
| table | [field1, field2] | -> | RESULT |
|---|
To select data by criteria, you need to use restriction.
Only those rows that match the condition will be returned.>br/>
Condition can be convoluted by using logical operators between expressions.
| table | [field1 θ field2] | -> | RESULT |
|---|
List of operations:
- Comparisions
- (>, <, ==, <>, >=, <=)
- Arithmethic
- (+, -, *, /, %)
- Logical
- (&, |, ^)
- Grouping
- ( "expr0" θ ("expr1" θ "expr2") )
- Similarity
- Like ("string" ~ "wildcard")
- In range ("number" ~ "lower limit" & "higher limit")
- Division
- ( : )
To select data from multiple tables, you need to join them first. There are 4 types of joins:
| tableLeft | [L.field θ R.field] | tableRight | -> | RESULT |
|---|
| tableLeft | <[L.field θ R.field] | tableRight | -> | RESULT |
|---|
| tableLeft | [L.field θ R.field]> | tableRight | -> | RESULT |
|---|
| tableLeft | >[L.field θ R.field] | tableRight | -> | RESULT |
|---|
| tableLeft | [L.field θ R.field]< | tableRight | -> | RESULT |
|---|
| tableLeft | >[L.field θ R.field]< | tableRight | -> | RESULT |
|---|
You can access tables' columns by using L and R constants.
To join more then two tables, you need to join them consequently:
| tableFirst | [L.field θ R.field] | tableSecond | [L.field θ R.field] | tableThird | ... | -> | RESULT |
|---|