Created
December 12, 2023 08:20
-
-
Save sqlparser/d78009beb44f3bd1ec2dc90748ea380a to your computer and use it in GitHub Desktop.
Trino Sample SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```sql | |
MERGE INTO accounts t USING monthly_accounts_update s | |
ON (t.customer = s.customer) | |
WHEN MATCHED AND s.address = 'Centreville' | |
THEN DELETE | |
WHEN MATCHED | |
THEN UPDATE | |
SET purchases = s.purchases + t.purchases, address = s.address | |
WHEN NOT MATCHED | |
THEN INSERT (customer, purchases, address) | |
VALUES(s.customer, s.purchases, s.address) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment