Skip to content

Commit cbb8c40

Browse files
authored
Merge pull request #6555 from segmentio/maleman842-patch-1
Update query-language.md
2 parents 7357e57 + 9094cc3 commit cbb8c40

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/api/public-api/query-language.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ Another way to think of this scenario would be:
423423
Here's how you could do that in Segment's query language:
424424

425425
```sql
426-
event(Shoes Bought).where( property(price) >= 100 ).within(7 days).count() >= 1
426+
event('Shoes Bought').where( property('price') >= 100 ).within(7 days).count() >= 1
427427
```
428428

429429
#### Bought and returned
@@ -435,10 +435,10 @@ This example collects:
435435
- and the user performed the `Shoes Returned` event at least once, five days after the `Shoes Bought` event
436436

437437
```sql
438-
event(Shoes Bought).where(
439-
property(price) >= trait(avg_spend)
438+
event('Shoes Bought').where(
439+
property('price') >= trait('avg_spend')
440440
AND
441-
event(Shoes Returned).within(parent: 5 days).count() >= 1
441+
event('Shoes Returned').within(parent: 5 days).count() >= 1
442442
).within(30 days).count() >= 1
443443
```
444444

@@ -447,31 +447,31 @@ event(‘Shoes Returned’).within(parent: 5 days).count() >= 1
447447
This example collects all users who did not perform the `Shoes Bought` event at least once and don't have a `total_spend` trait with a value greater than `200`:
448448

449449
```sql
450-
NOT ( event(Shoes Bought).count() >= 1 AND trait(total_spend) > 200 )
450+
NOT ( event('Shoes Bought').count() >= 1 AND trait('total_spend') > 200 )
451451
```
452452

453453
#### Bought with minimum total spend
454454

455455
This example collects all accounts where all associated users performed the `Shoes Bought` event at least once and have a `total_spend` trait greater than `200`:
456456

457457
```sql
458-
ALL ( event(Shoes Bought).count() >= 1 AND trait(total_spend) > 200 )
458+
ALL ( event('Shoes Bought').count() >= 1 AND trait('total_spend') > 200 )
459459
```
460460

461461
#### No users bought at least once
462462

463463
This example collects all accounts where no associated users performed the `Shoes Bought` event at least once:
464464

465465
```sql
466-
ALL NOT event(Shoes Bought).count() >= 1
466+
ALL NOT event('Shoes Bought').count() >= 1
467467
```
468468

469469
#### Any users bought at least once
470470

471471
This example collects all accounts where any associated users performed the `Shoes Bought` event at least once:
472472

473473
```sql
474-
ANY event(Shoes Bought).count() >= 1
474+
ANY event('Shoes Bought').count() >= 1
475475
```
476476

477477
### Computed Traits
@@ -487,15 +487,15 @@ Another way to think of this would be:
487487
Here's how you could do that in Segment's query language:
488488

489489
```sql
490-
event(Shoes Bought).within(30 days).avg(property(spend))
490+
event('Shoes Bought').within(30 days).avg(property('spend'))
491491
```
492492

493493
#### Calculate minimum spend
494494

495495
This example calculates the minimum spend for each user, based on all `Shoes Bought` events, where the price was greater than `100` and the brand was `My_Brand`:
496496

497497
```sql
498-
event(Shoes Bought).where( property(price) > 100 AND property(brand) = My Brand ).min(property(spend))
498+
event('Shoes Bought').where( property('price') > 100 AND property('brand') = 'My Brand' ).min(property('spend'))
499499
```
500500

501501
#### Calculate first seen spend

0 commit comments

Comments
 (0)